Class: Google::Apps::Chat::V1::ChatService::Rest::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/apps/chat/v1/chat_service/rest/client.rb

Overview

REST client for the ChatService service.

Enables developers to build Chat apps and integrations on Google Chat Platform.

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#attachment_path, #custom_emoji_path, #membership_path, #message_path, #quoted_message_metadata_path, #reaction_path, #space_event_path, #space_notification_setting_path, #space_path, #space_read_state_path, #thread_path, #thread_read_state_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new ChatService REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Apps::Chat::V1::ChatService::Rest::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the ChatService client.

Yield Parameters:



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 302

def initialize
  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end

  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @chat_service_stub = ::Google::Apps::Chat::V1::ChatService::Rest::ServiceStub.new(
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    credentials: credentials,
    logger: @config.logger
  )

  @chat_service_stub.logger(stub: true)&.info do |entry|
    entry.set_system_name
    entry.set_service
    entry.message = "Created client for #{entry.service}"
    entry.set_credentials_fields credentials
    entry.set "customEndpoint", @config.endpoint if @config.endpoint
    entry.set "defaultTimeout", @config.timeout if @config.timeout
    entry.set "quotaProject", @quota_project_id if @quota_project_id
  end
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the ChatService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all ChatService clients
::Google::Apps::Chat::V1::ChatService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 65

def self.configure
  @configure ||= begin
    namespace = ["Google", "Apps", "Chat", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.create_message.timeout = 30.0
    default_config.rpcs.create_message.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.list_messages.timeout = 30.0
    default_config.rpcs.list_messages.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.list_memberships.timeout = 30.0
    default_config.rpcs.list_memberships.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_membership.timeout = 30.0
    default_config.rpcs.get_membership.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_message.timeout = 30.0
    default_config.rpcs.get_message.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.update_message.timeout = 30.0
    default_config.rpcs.update_message.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.delete_message.timeout = 30.0
    default_config.rpcs.delete_message.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_attachment.timeout = 30.0
    default_config.rpcs.get_attachment.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.upload_attachment.timeout = 30.0
    default_config.rpcs.upload_attachment.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.list_spaces.timeout = 30.0
    default_config.rpcs.list_spaces.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.search_spaces.timeout = 30.0
    default_config.rpcs.search_spaces.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_space.timeout = 30.0
    default_config.rpcs.get_space.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.create_space.timeout = 30.0
    default_config.rpcs.create_space.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.set_up_space.timeout = 30.0
    default_config.rpcs.set_up_space.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.update_space.timeout = 30.0
    default_config.rpcs.update_space.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.delete_space.timeout = 30.0
    default_config.rpcs.delete_space.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.complete_import_space.timeout = 30.0
    default_config.rpcs.complete_import_space.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.find_direct_message.timeout = 30.0
    default_config.rpcs.find_direct_message.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.create_membership.timeout = 30.0
    default_config.rpcs.create_membership.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.update_membership.timeout = 30.0
    default_config.rpcs.update_membership.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.delete_membership.timeout = 30.0
    default_config.rpcs.delete_membership.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.create_reaction.timeout = 30.0
    default_config.rpcs.create_reaction.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.list_reactions.timeout = 30.0
    default_config.rpcs.list_reactions.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.delete_reaction.timeout = 30.0
    default_config.rpcs.delete_reaction.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.create_custom_emoji.timeout = 30.0
    default_config.rpcs.create_custom_emoji.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_custom_emoji.timeout = 30.0
    default_config.rpcs.get_custom_emoji.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.list_custom_emojis.timeout = 30.0
    default_config.rpcs.list_custom_emojis.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.delete_custom_emoji.timeout = 30.0
    default_config.rpcs.delete_custom_emoji.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_space_read_state.timeout = 30.0
    default_config.rpcs.get_space_read_state.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.update_space_read_state.timeout = 30.0
    default_config.rpcs.update_space_read_state.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_thread_read_state.timeout = 30.0
    default_config.rpcs.get_thread_read_state.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_space_event.timeout = 30.0
    default_config.rpcs.get_space_event.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.list_space_events.timeout = 30.0
    default_config.rpcs.list_space_events.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.get_space_notification_setting.timeout = 30.0
    default_config.rpcs.get_space_notification_setting.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.update_space_notification_setting.timeout = 30.0
    default_config.rpcs.update_space_notification_setting.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#complete_import_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::CompleteImportSpaceResponse #complete_import_space(name: nil) ⇒ ::Google::Apps::Chat::V1::CompleteImportSpaceResponse

Completes the import process for the specified space and makes it visible to users.

Requires user authentication and domain-wide delegation with the authorization scope:

  • https://www.googleapis.com/auth/chat.import

For more information, see Authorize Google Chat apps to import data.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::CompleteImportSpaceRequest.new

# Call the complete_import_space method.
result = client.complete_import_space request

# The returned object is of type Google::Apps::Chat::V1::CompleteImportSpaceResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 2736

def complete_import_space request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CompleteImportSpaceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.complete_import_space..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.complete_import_space.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.complete_import_space.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.complete_import_space request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

Configure the ChatService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:



272
273
274
275
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 272

def configure
  yield @config if block_given?
  @config
end

#create_custom_emoji(request, options = nil) ⇒ ::Google::Apps::Chat::V1::CustomEmoji #create_custom_emoji(custom_emoji: nil) ⇒ ::Google::Apps::Chat::V1::CustomEmoji

Creates a custom emoji.

Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat and Manage custom emoji permissions.

Requires user authentication with the authorization scope:

  • https://www.googleapis.com/auth/chat.customemojis

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::CreateCustomEmojiRequest.new

# Call the create_custom_emoji method.
result = client.create_custom_emoji request

# The returned object is of type Google::Apps::Chat::V1::CustomEmoji.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3718

def create_custom_emoji request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateCustomEmojiRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_custom_emoji..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_custom_emoji.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_custom_emoji.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.create_custom_emoji request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_membership(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Membership #create_membership(parent: nil, membership: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Membership

Creates a membership for the calling Chat app, a user, or a Google Group. Creating memberships for other Chat apps isn't supported. When creating a membership, if the specified member has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified space.

Supports the following types of authentication:

  • App authentication with administrator approval and the authorization scope:

    • https://www.googleapis.com/auth/chat.app.memberships
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.memberships.app (to add the calling app to the space)
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and the following authorization scope is used:
      • https://www.googleapis.com/auth/chat.admin.memberships

App authentication is not supported for the following use cases:

  • Inviting users external to the Workspace organization that owns the space.
  • Adding a Google Group to a space.
  • Adding a Chat app to a space.

For example usage, see:

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::CreateMembershipRequest.new

# Call the create_membership method.
result = client.create_membership request

# The returned object is of type Google::Apps::Chat::V1::Membership.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3027

def create_membership request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateMembershipRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_membership..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_membership.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_membership.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.create_membership request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Message #create_message(parent: nil, message: nil, thread_key: nil, request_id: nil, message_reply_option: nil, message_id: nil) ⇒ ::Google::Apps::Chat::V1::Message

Creates a message in a Google Chat space. For an example, see Send a message.

Supports the following types of authentication:

  • App authentication with the authorization scope:
    • https://www.googleapis.com/auth/chat.bot
  • User authentication with one of the following authorization scopes:
    • https://www.googleapis.com/auth/chat.messages.create
    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)

Chat attributes the message sender differently depending on the type of authentication that you use in your request.

The following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the message sender. The content of the message can contain text (text), cards (cardsV2), and accessory widgets (accessoryWidgets).

Message sent with app
authentication

The following image shows how Chat attributes a message when you use user authentication. Chat displays the user as the message sender and attributes the Chat app to the message by displaying its name. The content of message can only contain text (text).

Message sent with user
authentication

The maximum message size, including the message contents, is 32,000 bytes.

For webhook requests, the response doesn't contain the full message. The response only populates the name and thread.name fields in addition to the information that was in the request.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::CreateMessageRequest.new

# Call the create_message method.
result = client.create_message request

# The returned object is of type Google::Apps::Chat::V1::Message.
p result

Overloads:

  • #create_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Message

    Pass arguments to create_message via a request object, either of type Google::Apps::Chat::V1::CreateMessageRequest or an equivalent Hash.

  • #create_message(parent: nil, message: nil, thread_key: nil, request_id: nil, message_reply_option: nil, message_id: nil) ⇒ ::Google::Apps::Chat::V1::Message

    Pass arguments to create_message via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 482

def create_message request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateMessageRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_message..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_message.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_message.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.create_message request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_reaction(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Reaction #create_reaction(parent: nil, reaction: nil) ⇒ ::Google::Apps::Chat::V1::Reaction

Creates a reaction and adds it to a message. For an example, see Add a reaction to a message.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.messages.reactions.create
  • https://www.googleapis.com/auth/chat.messages.reactions
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.import (import mode spaces only)

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::CreateReactionRequest.new

# Call the create_reaction method.
result = client.create_reaction request

# The returned object is of type Google::Apps::Chat::V1::Reaction.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3381

def create_reaction request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateReactionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_reaction..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_reaction.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_reaction.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.create_reaction request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space #create_space(space: nil, request_id: nil) ⇒ ::Google::Apps::Chat::V1::Space

Creates a space. Can be used to create a named space, or a group chat in Import mode. For an example, see Create a space.

Supports the following types of authentication:

  • App authentication with administrator approval and one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.app.spaces.create
    • https://www.googleapis.com/auth/chat.app.spaces
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.spaces.create
    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)

When authenticating as an app, the space.customer field must be set in the request.

When authenticating as an app, the Chat app is added as a member of the space. However, unlike human authentication, the Chat app is not added as a space manager. By default, the Chat app can be removed from the space by all space members. To allow only space managers to remove the app from a space, set space.permission_settings.manage_apps to managers_allowed.

Space membership upon creation depends on whether the space is created in Import mode:

  • Import mode: No members are created.
  • All other modes: The calling user is added as a member. This is:
    • The app itself when using app authentication.
    • The human user when using user authentication.

If you receive the error message ALREADY_EXISTS when creating a space, try a different displayName. An existing space within the Google Workspace organization might already use this display name.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::CreateSpaceRequest.new

# Call the create_space method.
result = client.create_space request

# The returned object is of type Google::Apps::Chat::V1::Space.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 2145

def create_space request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateSpaceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_space..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_space.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_space.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.create_space request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_custom_emoji(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_custom_emoji(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a custom emoji. By default, users can only delete custom emoji they created. Emoji managers assigned by the administrator can delete any custom emoji in the organization. See Learn about custom emojis in Google Chat.

Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat and Manage custom emoji permissions.

Requires user authentication with the authorization scope:

  • https://www.googleapis.com/auth/chat.customemojis

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::DeleteCustomEmojiRequest.new

# Call the delete_custom_emoji method.
result = client.delete_custom_emoji request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_custom_emoji(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_custom_emoji via a request object, either of type DeleteCustomEmojiRequest or an equivalent Hash.

  • #delete_custom_emoji(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_custom_emoji via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4044

def delete_custom_emoji request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteCustomEmojiRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_custom_emoji..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_custom_emoji.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_custom_emoji.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.delete_custom_emoji request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_membership(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Membership #delete_membership(name: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Membership

Deletes a membership. For an example, see Remove a user or a Google Chat app from a space.

Supports the following types of authentication:

  • App authentication with administrator approval and the authorization scope:

    • https://www.googleapis.com/auth/chat.app.memberships
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.memberships.app (to remove the calling app from the space)
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and the following authorization scope is used:
      • https://www.googleapis.com/auth/chat.admin.memberships

App authentication is not supported for the following use cases:

  • Removing a Google Group from a space.
  • Removing a Chat app from a space.

To delete memberships for space managers, the requester must be a space manager. If you're using app authentication the Chat app must be the space creator.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::DeleteMembershipRequest.new

# Call the delete_membership method.
result = client.delete_membership request

# The returned object is of type Google::Apps::Chat::V1::Membership.
p result

Overloads:

  • #delete_membership(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Membership

    Pass arguments to delete_membership via a request object, either of type DeleteMembershipRequest or an equivalent Hash.

  • #delete_membership(name: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Membership

    Pass arguments to delete_membership via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3287

def delete_membership request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteMembershipRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_membership..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_membership.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_membership.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.delete_membership request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_message(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_message(name: nil, force: nil) ⇒ ::Google::Protobuf::Empty

Deletes a message. For an example, see Delete a message.

Supports the following types of authentication:

  • App authentication with the authorization scope:

    • https://www.googleapis.com/auth/chat.bot
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)

When using app authentication, requests can only delete messages created by the calling Chat app.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::DeleteMessageRequest.new

# Call the delete_message method.
result = client.delete_message request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_message(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_message via a request object, either of type DeleteMessageRequest or an equivalent Hash.

  • #delete_message(name: nil, force: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_message via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 1345

def delete_message request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteMessageRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_message..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_message.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_message.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.delete_message request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_reaction(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_reaction(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a reaction to a message. For an example, see Delete a reaction.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.messages.reactions
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.import (import mode spaces only)

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::DeleteReactionRequest.new

# Call the delete_reaction method.
result = client.delete_reaction request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_reaction(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_reaction via a request object, either of type DeleteReactionRequest or an equivalent Hash.

  • #delete_reaction(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_reaction via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3626

def delete_reaction request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteReactionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_reaction..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_reaction.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_reaction.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.delete_reaction request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_space(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_space(name: nil, use_admin_access: nil) ⇒ ::Google::Protobuf::Empty

Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see Delete a space.

Supports the following types of authentication:

  • App authentication with administrator approval and the authorization scope:

    • https://www.googleapis.com/auth/chat.app.delete (only in spaces the app created)
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.delete
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and the following authorization scope is used:
      • https://www.googleapis.com/auth/chat.admin.delete

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::DeleteSpaceRequest.new

# Call the delete_space method.
result = client.delete_space request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_space(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_space via a request object, either of type DeleteSpaceRequest or an equivalent Hash.

  • #delete_space(name: nil, use_admin_access: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_space via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 2643

def delete_space request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteSpaceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_space..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_space.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_space.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.delete_space request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#find_direct_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space #find_direct_message(name: nil) ⇒ ::Google::Apps::Chat::V1::Space

Returns the existing direct message with the specified user. If no direct message space is found, returns a 404 NOT_FOUND error. For an example, see Find a direct message.

With app authentication, returns the direct message space between the specified user and the calling Chat app.

With user authentication, returns the direct message space between the specified user and the authenticated user.

Supports the following types of authentication:

  • App authentication with the authorization scope:

    • https://www.googleapis.com/auth/chat.bot
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.spaces.readonly
    • https://www.googleapis.com/auth/chat.spaces

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::FindDirectMessageRequest.new

# Call the find_direct_message method.
result = client.find_direct_message request

# The returned object is of type Google::Apps::Chat::V1::Space.
p result

Overloads:

  • #find_direct_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to find_direct_message via a request object, either of type FindDirectMessageRequest or an equivalent Hash.

  • #find_direct_message(name: nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to find_direct_message via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 2853

def find_direct_message request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::FindDirectMessageRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.find_direct_message..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.find_direct_message.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.find_direct_message.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.find_direct_message request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_attachment(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Attachment #get_attachment(name: nil) ⇒ ::Google::Apps::Chat::V1::Attachment

Gets the metadata of a message attachment. The attachment data is fetched using the media API. For an example, see Get metadata about a message attachment.

Requires app authentication with the authorization scope:

  • https://www.googleapis.com/auth/chat.bot

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetAttachmentRequest.new

# Call the get_attachment method.
result = client.get_attachment request

# The returned object is of type Google::Apps::Chat::V1::Attachment.
p result

Overloads:

  • #get_attachment(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Attachment

    Pass arguments to get_attachment via a request object, either of type GetAttachmentRequest or an equivalent Hash.

  • #get_attachment(name: nil) ⇒ ::Google::Apps::Chat::V1::Attachment

    Pass arguments to get_attachment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 1436

def get_attachment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetAttachmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_attachment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_attachment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_attachment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_attachment request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_custom_emoji(request, options = nil) ⇒ ::Google::Apps::Chat::V1::CustomEmoji #get_custom_emoji(name: nil) ⇒ ::Google::Apps::Chat::V1::CustomEmoji

Returns details about a custom emoji.

Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat and Manage custom emoji permissions.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.customemojis.readonly
  • https://www.googleapis.com/auth/chat.customemojis

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetCustomEmojiRequest.new

# Call the get_custom_emoji method.
result = client.get_custom_emoji request

# The returned object is of type Google::Apps::Chat::V1::CustomEmoji.
p result

Overloads:

  • #get_custom_emoji(request, options = nil) ⇒ ::Google::Apps::Chat::V1::CustomEmoji

    Pass arguments to get_custom_emoji via a request object, either of type GetCustomEmojiRequest or an equivalent Hash.

  • #get_custom_emoji(name: nil) ⇒ ::Google::Apps::Chat::V1::CustomEmoji

    Pass arguments to get_custom_emoji via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3817

def get_custom_emoji request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetCustomEmojiRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_custom_emoji..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_custom_emoji.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_custom_emoji.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_custom_emoji request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_membership(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Membership #get_membership(name: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Membership

Returns details about a membership. For an example, see Get details about a user's or Google Chat app's membership.

Supports the following types of authentication:

  • App authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.bot
    • https://www.googleapis.com/auth/chat.app.memberships (requires administrator approval)
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.memberships.readonly
    • https://www.googleapis.com/auth/chat.memberships
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and one of the following authorization scopes is used:
      • https://www.googleapis.com/auth/chat.admin.memberships.readonly
      • https://www.googleapis.com/auth/chat.admin.memberships

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetMembershipRequest.new

# Call the get_membership method.
result = client.get_membership request

# The returned object is of type Google::Apps::Chat::V1::Membership.
p result

Overloads:

  • #get_membership(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Membership

    Pass arguments to get_membership via a request object, either of type GetMembershipRequest or an equivalent Hash.

  • #get_membership(name: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Membership

    Pass arguments to get_membership via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 993

def get_membership request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetMembershipRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_membership..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_membership.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_membership.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_membership request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Message #get_message(name: nil) ⇒ ::Google::Apps::Chat::V1::Message

Returns details about a message. For an example, see Get details about a message.

Supports the following types of authentication:

  • App authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.bot: When using this authorization scope, this method returns details about a message the Chat app has access to, like direct messages and slash commands that invoke the Chat app.
    • https://www.googleapis.com/auth/chat.app.messages.readonly with administrator approval (available in Developer Preview). When using this authentication scope, this method returns details about a public message in a space.
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.messages.readonly
    • https://www.googleapis.com/auth/chat.messages

Note: Might return a message from a blocked member or space.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetMessageRequest.new

# Call the get_message method.
result = client.get_message request

# The returned object is of type Google::Apps::Chat::V1::Message.
p result

Overloads:

  • #get_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Message

    Pass arguments to get_message via a request object, either of type GetMessageRequest or an equivalent Hash.

  • #get_message(name: nil) ⇒ ::Google::Apps::Chat::V1::Message

    Pass arguments to get_message via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 1106

def get_message request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetMessageRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_message..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_message.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_message.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_message request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space #get_space(name: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Space

Returns details about a space. For an example, see Get details about a space.

Supports the following types of authentication:

  • App authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.bot
    • https://www.googleapis.com/auth/chat.app.spaces with administrator approval
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.spaces.readonly
    • https://www.googleapis.com/auth/chat.spaces
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and one of the following authorization scopes is used:
      • https://www.googleapis.com/auth/chat.admin.spaces.readonly
      • https://www.googleapis.com/auth/chat.admin.spaces

App authentication has the following limitations:

  • space.access_settings is only populated when using the chat.app.spaces scope.
  • space.predefind_permission_settings and space.permission_settings are only populated when using the chat.app.spaces scope, and only for spaces the app created.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetSpaceRequest.new

# Call the get_space method.
result = client.get_space request

# The returned object is of type Google::Apps::Chat::V1::Space.
p result

Overloads:

  • #get_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to get_space via a request object, either of type GetSpaceRequest or an equivalent Hash.

  • #get_space(name: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to get_space via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 2009

def get_space request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_space..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_space.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_space.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_space request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_space_event(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceEvent #get_space_event(name: nil) ⇒ ::Google::Apps::Chat::V1::SpaceEvent

Returns an event from a Google Chat space. The event payload contains the most recent version of the resource that changed. For example, if you request an event about a new message but the message was later updated, the server returns the updated Message resource in the event payload.

Note: The permissionSettings field is not returned in the Space object of the Space event data for this request.

Supports the following types of authentication with an authorization scope appropriate for reading the requested data:

  • App authentication with administrator approval in Developer Preview with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.app.spaces
    • https://www.googleapis.com/auth/chat.app.messages.readonly
    • https://www.googleapis.com/auth/chat.app.memberships
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.spaces.readonly
    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.messages.readonly
    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.reactions.readonly
    • https://www.googleapis.com/auth/chat.messages.reactions
    • https://www.googleapis.com/auth/chat.memberships.readonly
    • https://www.googleapis.com/auth/chat.memberships

To get an event, the authenticated caller must be a member of the space.

For an example, see Get details about an event from a Google Chat space.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetSpaceEventRequest.new

# Call the get_space_event method.
result = client.get_space_event request

# The returned object is of type Google::Apps::Chat::V1::SpaceEvent.
p result

Overloads:

  • #get_space_event(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceEvent

    Pass arguments to get_space_event via a request object, either of type GetSpaceEventRequest or an equivalent Hash.

  • #get_space_event(name: nil) ⇒ ::Google::Apps::Chat::V1::SpaceEvent

    Pass arguments to get_space_event via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4489

def get_space_event request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceEventRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_space_event..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_space_event.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_space_event.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_space_event request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_space_notification_setting(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceNotificationSetting #get_space_notification_setting(name: nil) ⇒ ::Google::Apps::Chat::V1::SpaceNotificationSetting

Gets the space notification setting. For an example, see Get the caller's space notification setting.

Requires user authentication with the authorization scope:

  • https://www.googleapis.com/auth/chat.users.spacesettings

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetSpaceNotificationSettingRequest.new

# Call the get_space_notification_setting method.
result = client.get_space_notification_setting request

# The returned object is of type Google::Apps::Chat::V1::SpaceNotificationSetting.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4774

def get_space_notification_setting request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceNotificationSettingRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_space_notification_setting..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_space_notification_setting.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_space_notification_setting.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_space_notification_setting request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_space_read_state(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState #get_space_read_state(name: nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState

Returns details about a user's read state within a space, used to identify read and unread messages. For an example, see Get details about a user's space read state.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.users.readstate.readonly
  • https://www.googleapis.com/auth/chat.users.readstate

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetSpaceReadStateRequest.new

# Call the get_space_read_state method.
result = client.get_space_read_state request

# The returned object is of type Google::Apps::Chat::V1::SpaceReadState.
p result

Overloads:

  • #get_space_read_state(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState

    Pass arguments to get_space_read_state via a request object, either of type GetSpaceReadStateRequest or an equivalent Hash.

  • #get_space_read_state(name: nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState

    Pass arguments to get_space_read_state via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4147

def get_space_read_state request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceReadStateRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_space_read_state..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_space_read_state.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_space_read_state.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_space_read_state request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_thread_read_state(request, options = nil) ⇒ ::Google::Apps::Chat::V1::ThreadReadState #get_thread_read_state(name: nil) ⇒ ::Google::Apps::Chat::V1::ThreadReadState

Returns details about a user's read state within a thread, used to identify read and unread messages. For an example, see Get details about a user's thread read state.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.users.readstate.readonly
  • https://www.googleapis.com/auth/chat.users.readstate

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::GetThreadReadStateRequest.new

# Call the get_thread_read_state method.
result = client.get_thread_read_state request

# The returned object is of type Google::Apps::Chat::V1::ThreadReadState.
p result

Overloads:

  • #get_thread_read_state(request, options = nil) ⇒ ::Google::Apps::Chat::V1::ThreadReadState

    Pass arguments to get_thread_read_state via a request object, either of type GetThreadReadStateRequest or an equivalent Hash.

  • #get_thread_read_state(name: nil) ⇒ ::Google::Apps::Chat::V1::ThreadReadState

    Pass arguments to get_thread_read_state via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4366

def get_thread_read_state request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetThreadReadStateRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_thread_read_state..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_thread_read_state.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_thread_read_state.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.get_thread_read_state request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_custom_emojis(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::CustomEmoji> #list_custom_emojis(page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::CustomEmoji>

Lists custom emojis visible to the authenticated user.

Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat and Manage custom emoji permissions.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.customemojis.readonly
  • https://www.googleapis.com/auth/chat.customemojis

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::ListCustomEmojisRequest.new

# Call the list_custom_emojis method.
result = client.list_custom_emojis request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Apps::Chat::V1::CustomEmoji.
  p item
end

Overloads:

  • #list_custom_emojis(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::CustomEmoji>

    Pass arguments to list_custom_emojis via a request object, either of type ListCustomEmojisRequest or an equivalent Hash.

  • #list_custom_emojis(page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::CustomEmoji>

    Pass arguments to list_custom_emojis via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3940

def list_custom_emojis request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListCustomEmojisRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_custom_emojis..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_custom_emojis.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_custom_emojis.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.list_custom_emojis request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_custom_emojis, "custom_emojis", request, result, options
    yield result, operation if block_given?
    throw :response, result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_memberships(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Membership> #list_memberships(parent: nil, page_size: nil, page_token: nil, filter: nil, show_groups: nil, show_invited: nil, use_admin_access: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Membership>

Lists memberships in a space. For an example, see List users and Google Chat apps in a space. Listing memberships with app authentication lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, including its own. Listing memberships with User authentication lists memberships in spaces that the authenticated user has access to.

Supports the following types of authentication:

  • App authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.bot
    • https://www.googleapis.com/auth/chat.app.memberships (requires administrator approval)
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.memberships.readonly
    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and one of the following authorization scopes is used:
      • https://www.googleapis.com/auth/chat.admin.memberships.readonly
      • https://www.googleapis.com/auth/chat.admin.memberships

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::ListMembershipsRequest.new

# Call the list_memberships method.
result = client.list_memberships request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Apps::Chat::V1::Membership.
  p item
end

Overloads:

  • #list_memberships(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Membership>

    Pass arguments to list_memberships via a request object, either of type ListMembershipsRequest or an equivalent Hash.

  • #list_memberships(parent: nil, page_size: nil, page_token: nil, filter: nil, show_groups: nil, show_invited: nil, use_admin_access: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Membership>

    Pass arguments to list_memberships via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 867

def list_memberships request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListMembershipsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_memberships..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_memberships.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_memberships.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.list_memberships request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_memberships, "memberships", request, result, options
    yield result, operation if block_given?
    throw :response, result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_messages(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Message> #list_messages(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Message>

Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. System messages, like those announcing new space members, aren't included. If you list messages from a space with no messages, the response is an empty object. When using a REST/HTTP interface, the response contains an empty JSON object, {}. For an example, see List messages.

Supports the following types of authentication:

  • App authentication with administrator approval in Developer Preview with the authorization scope:

    • https://www.googleapis.com/auth/chat.app.messages.readonly. When using this authentication scope, this method only returns public messages in a space. It doesn't include private messages.
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.messages.readonly
    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::ListMessagesRequest.new

# Call the list_messages method.
result = client.list_messages request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Apps::Chat::V1::Message.
  p item
end

Overloads:

  • #list_messages(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Message>

    Pass arguments to list_messages via a request object, either of type ListMessagesRequest or an equivalent Hash.

  • #list_messages(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Message>

    Pass arguments to list_messages via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 662

def list_messages request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListMessagesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_messages..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_messages.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_messages.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.list_messages request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_messages, "messages", request, result, options
    yield result, operation if block_given?
    throw :response, result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_reactions(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Reaction> #list_reactions(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Reaction>

Lists reactions to a message. For an example, see List reactions for a message.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.messages.reactions.readonly
  • https://www.googleapis.com/auth/chat.messages.reactions
  • https://www.googleapis.com/auth/chat.messages.readonly
  • https://www.googleapis.com/auth/chat.messages

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::ListReactionsRequest.new

# Call the list_reactions method.
result = client.list_reactions request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Apps::Chat::V1::Reaction.
  p item
end

Overloads:

  • #list_reactions(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Reaction>

    Pass arguments to list_reactions via a request object, either of type ListReactionsRequest or an equivalent Hash.

  • #list_reactions(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Reaction>

    Pass arguments to list_reactions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3533

def list_reactions request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListReactionsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_reactions..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_reactions.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_reactions.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.list_reactions request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_reactions, "reactions", request, result, options
    yield result, operation if block_given?
    throw :response, result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_space_events(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::SpaceEvent> #list_space_events(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::SpaceEvent>

Lists events from a Google Chat space. For each event, the payload contains the most recent version of the Chat resource. For example, if you list events about new space members, the server returns Membership resources that contain the latest membership details. If new members were removed during the requested period, the event payload contains an empty Membership resource.

Supports the following types of authentication with an authorization scope appropriate for reading the requested data:

  • App authentication with administrator approval in Developer Preview with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.app.spaces
    • https://www.googleapis.com/auth/chat.app.messages.readonly
    • https://www.googleapis.com/auth/chat.app.memberships
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.spaces.readonly
    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.messages.readonly
    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.reactions.readonly
    • https://www.googleapis.com/auth/chat.messages.reactions
    • https://www.googleapis.com/auth/chat.memberships.readonly
    • https://www.googleapis.com/auth/chat.memberships

To list events, the authenticated caller must be a member of the space.

For an example, see List events from a Google Chat space.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::ListSpaceEventsRequest.new

# Call the list_space_events method.
result = client.list_space_events request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Apps::Chat::V1::SpaceEvent.
  p item
end

Overloads:

  • #list_space_events(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::SpaceEvent>

    Pass arguments to list_space_events via a request object, either of type ListSpaceEventsRequest or an equivalent Hash.

  • #list_space_events(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::SpaceEvent>

    Pass arguments to list_space_events via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4680

def list_space_events request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListSpaceEventsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_space_events..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_space_events.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_space_events.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.list_space_events request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_space_events, "space_events", request, result, options
    yield result, operation if block_given?
    throw :response, result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_spaces(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space> #list_spaces(page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>

Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see List spaces.

Supports the following types of authentication:

  • App authentication with the authorization scope:

    • https://www.googleapis.com/auth/chat.bot
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.spaces.readonly
    • https://www.googleapis.com/auth/chat.spaces

To list all named spaces by Google Workspace organization, use the spaces.search() method using Workspace administrator privileges instead.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::ListSpacesRequest.new

# Call the list_spaces method.
result = client.list_spaces request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Apps::Chat::V1::Space.
  p item
end

Overloads:

  • #list_spaces(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>

    Pass arguments to list_spaces via a request object, either of type ListSpacesRequest or an equivalent Hash.

  • #list_spaces(page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>

    Pass arguments to list_spaces via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 1669

def list_spaces request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListSpacesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_spaces..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_spaces.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_spaces.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.list_spaces request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_spaces, "spaces", request, result, options
    yield result, operation if block_given?
    throw :response, result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#loggerLogger

The logger used for request/response debug logging.



349
350
351
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 349

def logger
  @chat_service_stub.logger
end

#search_spaces(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space> #search_spaces(use_admin_access: nil, page_size: nil, page_token: nil, query: nil, order_by: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>

Returns a list of spaces in a Google Workspace organization based on an administrator's search. In the request, set use_admin_access to true. For an example, see Search for and manage spaces.

Requires user authentication with administrator privileges and one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.admin.spaces.readonly
  • https://www.googleapis.com/auth/chat.admin.spaces

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::SearchSpacesRequest.new

# Call the search_spaces method.
result = client.search_spaces request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Apps::Chat::V1::Space.
  p item
end

Overloads:

  • #search_spaces(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>

    Pass arguments to search_spaces via a request object, either of type SearchSpacesRequest or an equivalent Hash.

  • #search_spaces(use_admin_access: nil, page_size: nil, page_token: nil, query: nil, order_by: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>

    Pass arguments to search_spaces via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 1886

def search_spaces request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::SearchSpacesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.search_spaces..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.search_spaces.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.search_spaces.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.search_spaces request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :search_spaces, "spaces", request, result, options
    yield result, operation if block_given?
    throw :response, result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#set_up_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space #set_up_space(space: nil, request_id: nil, memberships: nil) ⇒ ::Google::Apps::Chat::V1::Space

Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see Set up a space with initial members.

To specify the human members to add, add memberships with the appropriate membership.member.name. To add a human user, use users/{user}, where {user} can be the email address for the user. For users in the same Workspace organization {user} can also be the id for the person from the People API, or the id for the user in the Directory API. For example, if the People API Person profile ID for [email protected] is 123456789, you can add the user to the space by setting the membership.member.name to users/[email protected] or users/123456789.

To specify the Google groups to add, add memberships with the appropriate membership.group_member.name. To add or invite a Google group, use groups/{group}, where {group} is the id for the group from the Cloud Identity Groups API. For example, you can use Cloud Identity Groups lookup API to retrieve the ID 123456789 for group email [email protected], then you can add the group to the space by setting the membership.group_member.name to groups/123456789. Group email is not supported, and Google groups can only be added as members in named spaces.

For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn't have permission to add some members, then those members aren't added to the created space.

To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created.

To create a DM between the calling user and the calling app, set Space.singleUserBotDm to true and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see Invite or add a user or app to a space.

If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned.

Spaces with threaded replies aren't supported. If you receive the error message ALREADY_EXISTS when setting up a space, try a different displayName. An existing space within the Google Workspace organization might already use this display name.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.spaces.create
  • https://www.googleapis.com/auth/chat.spaces

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::SetUpSpaceRequest.new

# Call the set_up_space method.
result = client.set_up_space request

# The returned object is of type Google::Apps::Chat::V1::Space.
p result

Overloads:

  • #set_up_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to set_up_space via a request object, either of type SetUpSpaceRequest or an equivalent Hash.

  • #set_up_space(space: nil, request_id: nil, memberships: nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to set_up_space via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 2338

def set_up_space request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::SetUpSpaceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.set_up_space..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.set_up_space.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.set_up_space.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.set_up_space request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain



282
283
284
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 282

def universe_domain
  @chat_service_stub.universe_domain
end

#update_membership(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Membership #update_membership(membership: nil, update_mask: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Membership

Updates a membership. For an example, see Update a user's membership in a space.

Supports the following types of authentication:

  • App authentication with administrator approval and the authorization scope:

    • https://www.googleapis.com/auth/chat.app.memberships (only in spaces the app created)
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and the following authorization scope is used:
      • https://www.googleapis.com/auth/chat.admin.memberships

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::UpdateMembershipRequest.new

# Call the update_membership method.
result = client.update_membership request

# The returned object is of type Google::Apps::Chat::V1::Membership.
p result

Overloads:

  • #update_membership(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Membership

    Pass arguments to update_membership via a request object, either of type UpdateMembershipRequest or an equivalent Hash.

  • #update_membership(membership: nil, update_mask: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Membership

    Pass arguments to update_membership via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 3146

def update_membership request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateMembershipRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_membership..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_membership.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_membership.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.update_membership request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Message #update_message(message: nil, update_mask: nil, allow_missing: nil) ⇒ ::Google::Apps::Chat::V1::Message

Updates a message. There's a difference between the patch and update methods. The patch method uses a patch request while the update method uses a put request. We recommend using the patch method. For an example, see Update a message.

Supports the following types of authentication:

  • App authentication with the authorization scope:

    • https://www.googleapis.com/auth/chat.bot
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)

When using app authentication, requests can only update messages created by the calling Chat app.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::UpdateMessageRequest.new

# Call the update_message method.
result = client.update_message request

# The returned object is of type Google::Apps::Chat::V1::Message.
p result

Overloads:

  • #update_message(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Message

    Pass arguments to update_message via a request object, either of type UpdateMessageRequest or an equivalent Hash.

  • #update_message(message: nil, update_mask: nil, allow_missing: nil) ⇒ ::Google::Apps::Chat::V1::Message

    Pass arguments to update_message via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 1232

def update_message request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateMessageRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_message..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_message.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_message.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.update_message request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space #update_space(space: nil, update_mask: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Space

Updates a space. For an example, see Update a space.

If you're updating the displayName field and receive the error message ALREADY_EXISTS, try a different display name.. An existing space within the Google Workspace organization might already use this display name.

Supports the following types of authentication:

  • App authentication with administrator approval and one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.app.spaces
  • User authentication with one of the following authorization scopes:

    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.import (import mode spaces only)
    • User authentication grants administrator privileges when an administrator account authenticates, use_admin_access is true, and the following authorization scopes is used:
      • https://www.googleapis.com/auth/chat.admin.spaces

App authentication has the following limitations:

  • To update either space.predefined_permission_settings or space.permission_settings, the app must be the space creator.
  • Updating the space.access_settings.audience is not supported for app authentication.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::UpdateSpaceRequest.new

# Call the update_space method.
result = client.update_space request

# The returned object is of type Google::Apps::Chat::V1::Space.
p result

Overloads:

  • #update_space(request, options = nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to update_space via a request object, either of type UpdateSpaceRequest or an equivalent Hash.

  • #update_space(space: nil, update_mask: nil, use_admin_access: nil) ⇒ ::Google::Apps::Chat::V1::Space

    Pass arguments to update_space via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 2527

def update_space request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateSpaceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_space..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_space.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_space.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.update_space request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_space_notification_setting(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceNotificationSetting #update_space_notification_setting(space_notification_setting: nil, update_mask: nil) ⇒ ::Google::Apps::Chat::V1::SpaceNotificationSetting

Updates the space notification setting. For an example, see Update the caller's space notification setting.

Requires user authentication with the authorization scope:

  • https://www.googleapis.com/auth/chat.users.spacesettings

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::UpdateSpaceNotificationSettingRequest.new

# Call the update_space_notification_setting method.
result = client.update_space_notification_setting request

# The returned object is of type Google::Apps::Chat::V1::SpaceNotificationSetting.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4870

def update_space_notification_setting request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateSpaceNotificationSettingRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_space_notification_setting..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_space_notification_setting.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_space_notification_setting.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.update_space_notification_setting request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_space_read_state(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState #update_space_read_state(space_read_state: nil, update_mask: nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState

Updates a user's read state within a space, used to identify read and unread messages. For an example, see Update a user's space read state.

Requires user authentication with the authorization scope:

  • https://www.googleapis.com/auth/chat.users.readstate

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::UpdateSpaceReadStateRequest.new

# Call the update_space_read_state method.
result = client.update_space_read_state request

# The returned object is of type Google::Apps::Chat::V1::SpaceReadState.
p result

Overloads:

  • #update_space_read_state(request, options = nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState

    Pass arguments to update_space_read_state via a request object, either of type UpdateSpaceReadStateRequest or an equivalent Hash.

  • #update_space_read_state(space_read_state: nil, update_mask: nil) ⇒ ::Google::Apps::Chat::V1::SpaceReadState

    Pass arguments to update_space_read_state via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 4262

def update_space_read_state request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateSpaceReadStateRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_space_read_state..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_space_read_state.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_space_read_state.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.update_space_read_state request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#upload_attachment(request, options = nil) ⇒ ::Google::Apps::Chat::V1::UploadAttachmentResponse #upload_attachment(parent: nil, filename: nil) ⇒ ::Google::Apps::Chat::V1::UploadAttachmentResponse

Uploads an attachment. For an example, see Upload media as a file attachment.

Requires user authentication with one of the following authorization scopes:

  • https://www.googleapis.com/auth/chat.messages.create
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.import (import mode spaces only)

You can upload attachments up to 200 MB. Certain file types aren't supported. For details, see File types blocked by Google Chat.

Examples:

Basic example

require "google/apps/chat/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Apps::Chat::V1::ChatService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Apps::Chat::V1::UploadAttachmentRequest.new

# Call the upload_attachment method.
result = client.upload_attachment request

# The returned object is of type Google::Apps::Chat::V1::UploadAttachmentResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
# File 'lib/google/apps/chat/v1/chat_service/rest/client.rb', line 1532

def upload_attachment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UploadAttachmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.upload_attachment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Apps::Chat::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.upload_attachment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.upload_attachment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @chat_service_stub.upload_attachment request, options do |result, operation|
    yield result, operation if block_given?
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end