Class: Google::Apis::ChatV1::HangoutsChatService

Inherits:
Google::Apis::Core::BaseService show all
Defined in:
generated/google/apis/chat_v1/service.rb

Overview

Hangouts Chat API

Enables bots to fetch information and perform actions in Hangouts Chat.

Examples:

require 'google/apis/chat_v1'

Chat = Google::Apis::ChatV1 # Alias the module
service = Chat::HangoutsChatService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Google::Apis::Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Google::Apis::Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Google::Apis::Core::Logging

#logger

Constructor Details

#initializeHangoutsChatService

Returns a new instance of HangoutsChatService.


45
46
47
48
# File 'generated/google/apis/chat_v1/service.rb', line 45

def initialize
  super('https://chat.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.


38
39
40
# File 'generated/google/apis/chat_v1/service.rb', line 38

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.


43
44
45
# File 'generated/google/apis/chat_v1/service.rb', line 43

def quota_user
  @quota_user
end

Instance Method Details

#create_space_message(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Message

Creates a message.

Parameters:

  • parent (String)

    Required. Space resource name, in the form "spaces/*". Example: spaces/ AAAAMpdlehY

  • message_object (Google::Apis::ChatV1::Message) (defaults to: nil)
  • thread_key (String) (defaults to: nil)

    Opaque thread identifier string that can be specified to group messages into a single thread. If this is the first message with a given thread identifier, a new thread is created. Subsequent messages with the same thread identifier will be posted into the same thread. This relieves bots and webhooks from having to store the Hangouts Chat thread ID of a thread (created earlier by them) to post further updates to it. Has no effect if thread field, corresponding to an existing thread, is set in message.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


252
253
254
255
256
257
258
259
260
261
262
263
# File 'generated/google/apis/chat_v1/service.rb', line 252

def create_space_message(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/messages', options)
  command.request_representation = Google::Apis::ChatV1::Message::Representation
  command.request_object = message_object
  command.response_representation = Google::Apis::ChatV1::Message::Representation
  command.response_class = Google::Apis::ChatV1::Message
  command.params['parent'] = parent unless parent.nil?
  command.query['threadKey'] = thread_key unless thread_key.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_space_message(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Empty

Deletes a message.

Parameters:

  • name (String)

    Required. Resource name of the message to be deleted, in the form "spaces// messages/" Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


286
287
288
289
290
291
292
293
294
# File 'generated/google/apis/chat_v1/service.rb', line 286

def delete_space_message(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v1/{+name}', options)
  command.response_representation = Google::Apis::ChatV1::Empty::Representation
  command.response_class = Google::Apis::ChatV1::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#download_medium(resource_name, fields: nil, quota_user: nil, download_dest: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Media

Downloads media. Download is supported on the URI /v1/media/+name?alt=media .

Parameters:

  • resource_name (String)

    Name of the media that is being downloaded. See ReadRequest.resource_name.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • download_dest (IO, String) (defaults to: nil)

    IO stream or filename to receive content download

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'generated/google/apis/chat_v1/service.rb', line 73

def download_medium(resource_name, fields: nil, quota_user: nil, download_dest: nil, options: nil, &block)
  if download_dest.nil?
    command = make_simple_command(:get, 'v1/media/{+resourceName}', options)
  else
    command = make_download_command(:get, 'v1/media/{+resourceName}', options)
    command.download_dest = download_dest
  end
  command.response_representation = Google::Apis::ChatV1::Media::Representation
  command.response_class = Google::Apis::ChatV1::Media
  command.params['resourceName'] = resource_name unless resource_name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_space(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Space

Returns a space.

Parameters:

  • name (String)

    Required. Resource name of the space, in the form "spaces/*". Example: spaces/ AAAAMpdlehY

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


109
110
111
112
113
114
115
116
117
# File 'generated/google/apis/chat_v1/service.rb', line 109

def get_space(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::ChatV1::Space::Representation
  command.response_class = Google::Apis::ChatV1::Space
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_space_member(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Membership

Returns a membership.

Parameters:

  • name (String)

    Required. Resource name of the membership to be retrieved, in the form "spaces/ /members/". Example: spaces/AAAAMpdlehY/members/105115627578887013105

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


174
175
176
177
178
179
180
181
182
# File 'generated/google/apis/chat_v1/service.rb', line 174

def get_space_member(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::ChatV1::Membership::Representation
  command.response_class = Google::Apis::ChatV1::Membership
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_space_message(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Message

Returns a message.

Parameters:

  • name (String)

    Required. Resource name of the message to be retrieved, in the form "spaces// messages/". Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


317
318
319
320
321
322
323
324
325
# File 'generated/google/apis/chat_v1/service.rb', line 317

def get_space_message(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::ChatV1::Message::Representation
  command.response_class = Google::Apis::ChatV1::Message
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_space_message_attachment(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Attachment

Gets the metadata of a message attachment. The attachment data is fetched using the media API.

Parameters:

  • name (String)

    Resource name of the attachment, in the form "spaces//messages//attachments/* ".

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


387
388
389
390
391
392
393
394
395
# File 'generated/google/apis/chat_v1/service.rb', line 387

def get_space_message_attachment(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::ChatV1::Attachment::Representation
  command.response_class = Google::Apis::ChatV1::Attachment
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_space_members(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::ListMembershipsResponse

Lists human memberships in a space.

Parameters:

  • parent (String)

    Required. The resource name of the space for which membership list is to be fetched, in the form "spaces/*". Example: spaces/AAAAMpdlehY

  • page_size (Fixnum) (defaults to: nil)

    Requested page size. The value is capped at 1000. Server may return fewer results than requested. If unspecified, server will default to 100.

  • page_token (String) (defaults to: nil)

    A token identifying a page of results the server should return.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


210
211
212
213
214
215
216
217
218
219
220
# File 'generated/google/apis/chat_v1/service.rb', line 210

def list_space_members(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}/members', options)
  command.response_representation = Google::Apis::ChatV1::ListMembershipsResponse::Representation
  command.response_class = Google::Apis::ChatV1::ListMembershipsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_spaces(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::ListSpacesResponse

Lists spaces the caller is a member of.

Parameters:

  • page_size (Fixnum) (defaults to: nil)

    Requested page size. The value is capped at 1000. Server may return fewer results than requested. If unspecified, server will default to 100.

  • page_token (String) (defaults to: nil)

    A token identifying a page of results the server should return.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


142
143
144
145
146
147
148
149
150
151
# File 'generated/google/apis/chat_v1/service.rb', line 142

def list_spaces(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/spaces', options)
  command.response_representation = Google::Apis::ChatV1::ListSpacesResponse::Representation
  command.response_class = Google::Apis::ChatV1::ListSpacesResponse
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#update_space_message(name, message_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Message

Updates a message.

Parameters:

  • name (String)

    Resource name, in the form "spaces//messages/". Example: spaces/AAAAMpdlehY/ messages/UMxbHmzDlr4.UMxbHmzDlr4

  • message_object (Google::Apis::ChatV1::Message) (defaults to: nil)
  • update_mask (String) (defaults to: nil)

    Required. The field paths to be updated, comma separated if there are multiple. Currently supported field paths: * text * cards

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:


352
353
354
355
356
357
358
359
360
361
362
363
# File 'generated/google/apis/chat_v1/service.rb', line 352

def update_space_message(name, message_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:put, 'v1/{+name}', options)
  command.request_representation = Google::Apis::ChatV1::Message::Representation
  command.request_object = message_object
  command.response_representation = Google::Apis::ChatV1::Message::Representation
  command.response_class = Google::Apis::ChatV1::Message
  command.params['name'] = name unless name.nil?
  command.query['updateMask'] = update_mask unless update_mask.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end