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

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

Overview

Google Chat API

Enables apps to fetch information and perform actions in Google Chat. Authentication is a prerequisite for using the Google Chat REST API.

Examples:

require 'google/apis/chat_v1'

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

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHangoutsChatService

Returns a new instance of HangoutsChatService.



46
47
48
49
50
51
# File 'lib/google/apis/chat_v1/service.rb', line 46

def initialize
  super('https://chat.googleapis.com/', '',
        client_name: 'google-apis-chat_v1',
        client_version: Google::Apis::ChatV1::GEM_VERSION)
  @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.



39
40
41
# File 'lib/google/apis/chat_v1/service.rb', line 39

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.



44
45
46
# File 'lib/google/apis/chat_v1/service.rb', line 44

def quota_user
  @quota_user
end

Instance Method Details

#create_space(space_object = nil, request_id: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Space

Creates a named space. Spaces grouped by topics aren't supported. For an example, see Create a space. 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. Requires user authentication.

Parameters:

  • space_object (Google::Apis::ChatV1::Space) (defaults to: nil)
  • request_id (String) (defaults to: nil)

    Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



170
171
172
173
174
175
176
177
178
179
180
# File 'lib/google/apis/chat_v1/service.rb', line 170

def create_space(space_object = nil, request_id: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/spaces', options)
  command.request_representation = Google::Apis::ChatV1::Space::Representation
  command.request_object = space_object
  command.response_representation = Google::Apis::ChatV1::Space::Representation
  command.response_class = Google::Apis::ChatV1::Space
  command.query['requestId'] = request_id unless request_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_space_member(parent, membership_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Membership

Creates a human membership or app membership for the calling app. Creating memberships for other apps isn't supported. For an example, see Create a membership. 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. Requires user authentication. To specify the member to add, set the membership.member.name in the CreateMembershipRequest: - To add the calling app to a space or a direct message between two human users, use users/app. Unable to add other apps to the space. - 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 person_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 resourceName for user@example.com is people/123456789, you can add the user to the space by setting the membership.member.name to users/user@example.com or users/123456789.

Parameters:

  • parent (String)

    Required. The resource name of the space for which to create the membership. Format: spaces/space

  • membership_object (Google::Apis::ChatV1::Membership) (defaults to: nil)
  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



518
519
520
521
522
523
524
525
526
527
528
# File 'lib/google/apis/chat_v1/service.rb', line 518

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

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

Creates a message in a Google Chat space. For an example, see Create a message. Calling this method requires authentication and supports the following authentication types: - For text messages, user authentication or app authentication are supported. - For card messages, only app authentication is supported. (Only Chat apps can create card messages.)

Parameters:

  • parent (String)

    Required. The resource name of the space in which to create a message. Format: spaces/space``

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

    Optional. A custom name for a Chat message assigned at creation. Must start with client- and contain only lowercase letters, numbers, and hyphens up to 63 characters in length. Specify this field to get, update, or delete the message with the specified value. Assigning a custom name lets a a Chat app recall the message without saving the message name from the response body returned when creating the message. Assigning a custom name doesn't replace the generated name field, the message's resource name. Instead, it sets the custom name as the clientAssignedMessageId field, which you can reference while processing later operations, like updating or deleting the message. For example usage, see Name a created message.

  • message_reply_option (String) (defaults to: nil)

    Optional. Specifies whether a message starts a thread or replies to one. Only supported in named spaces.

  • request_id (String) (defaults to: nil)

    Optional. A unique request ID for this message. Specifying an existing request ID returns the message created with that ID instead of creating a new message.

  • thread_key (String) (defaults to: nil)

    Optional. Deprecated: Use thread.thread_key instead. ID for the thread. Supports up to 4000 characters. To start or add to a thread, create a message and specify a threadKey or the thread.name. For example usage, see Start or reply to a message thread.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
# File 'lib/google/apis/chat_v1/service.rb', line 740

def create_space_message(parent, message_object = nil, message_id: nil, message_reply_option: nil, request_id: 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['messageId'] = message_id unless message_id.nil?
  command.query['messageReplyOption'] = message_reply_option unless message_reply_option.nil?
  command.query['requestId'] = request_id unless request_id.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

#create_space_message_reaction(parent, reaction_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Reaction

Creates a reaction and adds it to a message. For an example, see Create a reaction. Requires user authentication. Only unicode emoji are supported.

Parameters:

  • parent (String)

    Required. The message where the reaction is created. Format: spaces/space/ messages/message``

  • reaction_object (Google::Apis::ChatV1::Reaction) (defaults to: nil)
  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
# File 'lib/google/apis/chat_v1/service.rb', line 1091

def create_space_message_reaction(parent, reaction_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/reactions', options)
  command.request_representation = Google::Apis::ChatV1::Reaction::Representation
  command.request_object = reaction_object
  command.response_representation = Google::Apis::ChatV1::Reaction::Representation
  command.response_class = Google::Apis::ChatV1::Reaction
  command.params['parent'] = parent unless parent.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(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::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. Requires user authentication from a user who has permission to delete the space.

Parameters:

  • name (String)

    Required. Resource name of the space to delete. Format: spaces/space``

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



207
208
209
210
211
212
213
214
215
# File 'lib/google/apis/chat_v1/service.rb', line 207

def delete_space(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

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

Deletes a membership. For an example, see Delete a membership. Requires user authentication.

Parameters:

  • name (String)

    Required. Resource name of the membership to delete. Chat apps can delete human users' or their own memberships. Chat apps can't delete other apps' memberships. When deleting a human membership, requires the chat.memberships scope and spaces/space/members/memberformat. You can use the email as an alias formember. For example, `spaces/`space`/members/example@gmail. com` where `example@gmail.com` is the email of the Google Chat user. When deleting an app membership, requires the `chat.memberships.app` scope and ` spaces/`space`/members/app` format. Format: `spaces/`space`/members/`member or spaces/space/members/app.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



560
561
562
563
564
565
566
567
568
# File 'lib/google/apis/chat_v1/service.rb', line 560

def delete_space_member(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, '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

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

Deletes a message. For an example, see Delete a message. Requires authentication. Fully supports service account authentication and user authentication. Requests authenticated with service accounts can only delete messages created by the calling Chat app.

Parameters:

  • name (String)

    Required. Resource name of the message that you want to delete, in the form spaces/*/messages/* Example: spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB. BBBBBBBBBBB

  • force (Boolean) (defaults to: nil)

    When true, deleting a message also deletes its threaded replies. When false , if a message has threaded replies, deletion fails. Only applies when authenticating as a user. Has no effect when authenticating with a service account.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



790
791
792
793
794
795
796
797
798
799
# File 'lib/google/apis/chat_v1/service.rb', line 790

def delete_space_message(name, force: nil, 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['force'] = force unless force.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_reaction(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Empty

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

Parameters:

  • name (String)

    Required. Name of the reaction to delete. Format: spaces/space/messages/ message/reactions/reaction``

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



1126
1127
1128
1129
1130
1131
1132
1133
1134
# File 'lib/google/apis/chat_v1/service.rb', line 1126

def delete_space_message_reaction(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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/google/apis/chat_v1/service.rb', line 76

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

#find_space_direct_message(name: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::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 user authentication, returns the direct message space between the specified user and the authenticated user. With service account authentication, returns the direct message space between the specified user and the calling Chat app. Requires user authentication or service account authentication.

Parameters:

  • name (String) (defaults to: nil)

    Required. Resource name of the user to find direct message with. Format: users/user, whereuseris either theperson_idfor the [person]( https://developers.google.com/people/api/rest/v1/people) from the People API, or the `id` for the [user](https://developers.google.com/admin-sdk/directory/ reference/rest/v1/users) in the Directory API. For example, if the People API ` Person.resourceName` is `people/123456789`, you can find a direct message with that person by using `users/123456789` as the `name`. When [authenticated as a user](https://developers.google.com/chat/api/guides/auth/users), you can use the email as an alias foruser`. For example,users/example@gmail.com whereexample@gmail.com` is the email of the Google Chat user.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



256
257
258
259
260
261
262
263
264
# File 'lib/google/apis/chat_v1/service.rb', line 256

def find_space_direct_message(name: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/spaces:findDirectMessage', options)
  command.response_representation = Google::Apis::ChatV1::Space::Representation
  command.response_class = Google::Apis::ChatV1::Space
  command.query['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(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::Space

Returns details about a space. For an example, see Get a space. Requires authentication. Fully supports service account authentication and user authentication.

Parameters:

  • name (String)

    Required. Resource name of the space, in the form "spaces/*". Format: spaces/ space``

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



292
293
294
295
296
297
298
299
300
# File 'lib/google/apis/chat_v1/service.rb', line 292

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 details about a membership. For an example, see Get a membership. Requires authentication. Fully supports service account authentication and user authentication.

Parameters:

  • name (String)

    Required. Resource name of the membership to retrieve. To get the app's own membership, you can optionally use spaces/space/members/app. Format: spaces/space/members/memberor `spaces/`space`/members/app` When [ authenticated as a user](https://developers.google.com/chat/api/guides/auth/ users), you can use the user's email as an alias formember`. For example, spaces/space/members/example@gmail.comwhereexample@gmail.com` is the email of the Google Chat user.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



601
602
603
604
605
606
607
608
609
# File 'lib/google/apis/chat_v1/service.rb', line 601

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 details about a message. For an example, see Read a message. Requires authentication. Fully supports service account authentication and user authentication. Note: Might return a message from a blocked member or space.

Parameters:

  • name (String)

    Required. Resource name of the message to retrieve. Format: spaces/space/ messages/message`If the message begins withclient-`, then it has a custom name assigned by a Chat app that created it with the Chat REST API. That Chat app (but not others) can pass the custom name to get, update, or delete the message. To learn more, see create and name a 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



832
833
834
835
836
837
838
839
840
# File 'lib/google/apis/chat_v1/service.rb', line 832

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. For an example, see Get a message attachment. Requires service account authentication.

Parameters:

  • name (String)

    Required. 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



1056
1057
1058
1059
1060
1061
1062
1063
1064
# File 'lib/google/apis/chat_v1/service.rb', line 1056

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, filter: nil, page_size: nil, page_token: nil, show_invited: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::ListMembershipsResponse

Lists memberships in a space. For an example, see List memberships. 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. Requires authentication. Fully supports service account authentication and user authentication.

Parameters:

  • parent (String)

    Required. The resource name of the space for which to fetch a membership list. Format: spaces/space

  • filter (String) (defaults to: nil)

    Optional. A query filter. You can filter memberships by a member's role ( role) and type (member.type). To filter by role, set role to ROLE_MEMBER or ROLE_MANAGER. To filter by type, set member.type to HUMAN or BOT. To filter by both role and type, use the AND operator. To filter by either role or type, use the OR operator. For example, the following queries are valid: role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" member. type = "HUMAN" AND role = "ROLE_MANAGER" The following queries are invalid: member.type = "HUMAN" AND member.type = "BOT" role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" Invalid queries are rejected by the server with an INVALID_ARGUMENT error.

  • page_size (Fixnum) (defaults to: nil)

    Optional. The maximum number of memberships to return. The service might return fewer than this value. If unspecified, at most 100 memberships are returned. The maximum value is 1,000. If you use a value more than 1,000, it's automatically changed to 1,000. Negative values return an INVALID_ARGUMENT error.

  • page_token (String) (defaults to: nil)

    Optional. A page token, received from a previous call to list memberships. Provide this parameter to retrieve the subsequent page. When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters might lead to unexpected results.

  • show_invited (Boolean) (defaults to: nil)

    Optional. When true, also returns memberships associated with invited members, in addition to other types of memberships. If a filter is set, invited memberships that don't match the filter criteria aren't returned. Currently requires user authentication.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



673
674
675
676
677
678
679
680
681
682
683
684
685
# File 'lib/google/apis/chat_v1/service.rb', line 673

def list_space_members(parent, filter: nil, page_size: nil, page_token: nil, show_invited: 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['filter'] = filter unless filter.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['showInvited'] = show_invited unless show_invited.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_message_reactions(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::ListReactionsResponse

Lists reactions to a message. For an example, see List reactions. Requires user authentication.

Parameters:

  • parent (String)

    Required. The message users reacted to. Format: spaces/space/messages/ message``

  • filter (String) (defaults to: nil)

    Optional. A query filter. You can filter reactions by emoji (either emoji.unicode or emoji.custom_emoji.uid) and user (user.name). To filter reactions for multiple emojis or users, join similar fields with the OR operator, such as emoji. unicode = "🙂" OR emoji.unicode = "👍" and user.name = "users/AAAAAA" OR user. name = "users/BBBBBB". To filter reactions by emoji and user, use the AND operator, such as emoji.unicode = "🙂" AND user.name = "users/AAAAAA". If your query uses both AND and OR, group them with parentheses. For example, the following queries are valid: user.name = "users/`user`" emoji.unicode = "🙂" emoji.custom_emoji.uid = "`uid`" emoji.unicode = "🙂" OR emoji.unicode = "👍 " emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "`uid`" emoji.unicode = "🙂" AND user.name = "users/`user`" (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "`uid`") AND user.name = "users/`user`" The following queries are invalid: emoji.unicode = "🙂" AND emoji.unicode = "👍" emoji.unicode = "🙂" AND emoji. custom_emoji.uid = "`uid`" emoji.unicode = "🙂" OR user.name = "users/`user`" emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "`uid`" OR user.name = "users/` user`" emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "`uid`" AND user.name = "users/`user`" Invalid queries are rejected by the server with an INVALID_ARGUMENT error.

  • page_size (Fixnum) (defaults to: nil)

    Optional. The maximum number of reactions returned. The service can return fewer reactions than this value. If unspecified, the default value is 25. The maximum value is 200; values above 200 are changed to 200.

  • page_token (String) (defaults to: nil)

    Optional. (If resuming from a previous query.) A page token received from a previous list reactions call. Provide this to retrieve the subsequent page. When paginating, the filter value should match the call that provided the page token. Passing a different value might lead to unexpected results.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
# File 'lib/google/apis/chat_v1/service.rb', line 1189

def list_space_message_reactions(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}/reactions', options)
  command.response_representation = Google::Apis::ChatV1::ListReactionsResponse::Representation
  command.response_class = Google::Apis::ChatV1::ListReactionsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['filter'] = filter unless filter.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_space_messages(parent, filter: nil, order_by: nil, page_size: nil, page_token: nil, show_deleted: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::ListMessagesResponse

Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. For an example, see List messages. Requires user authentication.

Parameters:

  • parent (String)

    Required. The resource name of the space to list messages from. Format: spaces/space``

  • filter (String) (defaults to: nil)

    A query filter. You can filter messages by date (create_time) and thread ( thread.name). To filter messages by the date they were created, specify the create_time with a timestamp in RFC-3339 format and double quotation marks. For example, "2023-04-21T11:30:00- 04:00". You can use the greater than operator > to list messages that were created after a timestamp, or the less than operator < to list messages that were created before a timestamp. To filter messages within a time interval, use the AND operator between two timestamps. To filter by thread, specify the thread.name, formatted as spaces/space/threads/thread. You can only specify one `thread.name` per query. To filter by both thread and date, use the `AND` operator in your query. For example, the following queries are valid:create_time > "2012-04-21T11:30:00-04:00" create_time > "2012-04- 21T11:30:00-04:00" AND thread.name = spaces/AAAAAAAAAAA/threads/123 create_time > "2012-04-21T11:30:00+00:00" AND create_time < "2013-01-01T00:00: 00+00:00" AND thread.name = spaces/AAAAAAAAAAA/threads/123 thread.name = spaces/AAAAAAAAAAA/threads/123`Invalid queries are rejected by the server with anINVALID_ARGUMENT` error.

  • order_by (String) (defaults to: nil)

    Optional, if resuming from a previous query. How the list of messages is ordered. Specify a value to order by an ordering operation. Valid ordering operation values are as follows: - ASC for ascending. - DESC for descending. The default ordering is create_time ASC.

  • page_size (Fixnum) (defaults to: nil)

    The maximum number of messages returned. The service might return fewer messages than this value. If unspecified, at most 25 are returned. The maximum value is 1,000. If you use a value more than 1,000, it's automatically changed to 1,000. Negative values return an INVALID_ARGUMENT error.

  • page_token (String) (defaults to: nil)

    Optional, if resuming from a previous query. A page token received from a previous list messages call. Provide this parameter to retrieve the subsequent page. When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters might lead to unexpected results.

  • show_deleted (Boolean) (defaults to: nil)

    Whether to include deleted messages. Deleted messages include deleted time and metadata about their deletion, but message content is unavailable.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



903
904
905
906
907
908
909
910
911
912
913
914
915
916
# File 'lib/google/apis/chat_v1/service.rb', line 903

def list_space_messages(parent, filter: nil, order_by: nil, page_size: nil, page_token: nil, show_deleted: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}/messages', options)
  command.response_representation = Google::Apis::ChatV1::ListMessagesResponse::Representation
  command.response_class = Google::Apis::ChatV1::ListMessagesResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['filter'] = filter unless filter.nil?
  command.query['orderBy'] = order_by unless order_by.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['showDeleted'] = show_deleted unless show_deleted.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(filter: nil, 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. Group chats and DMs aren't listed until the first message is sent. For an example, see List spaces. Requires authentication. Fully supports service account authentication and user authentication. Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed until the first message is sent.

Parameters:

  • filter (String) (defaults to: nil)

    Optional. A query filter. Requires user authentication. You can filter spaces by the space type (space_type). To filter by space type, you must specify valid enum value, such as SPACE or GROUP_CHAT (the space_type can't be SPACE_TYPE_UNSPECIFIED). To query for multiple space types, use the OR operator. For example, the following queries are valid: space_type = " SPACE" spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" Invalid queries are rejected by the server with an INVALID_ARGUMENT error. With service account authentication, this field is ignored and the query always returns all spaces. But the Chat API still validates the query syntax with service accounts, so invalid queries are still rejected.

  • page_size (Fixnum) (defaults to: nil)

    Optional. The maximum number of spaces to return. The service might return fewer than this value. If unspecified, at most 100 spaces are returned. The maximum value is 1,000. If you use a value more than 1,000, it's automatically changed to 1,000. Negative values return an INVALID_ARGUMENT error.

  • page_token (String) (defaults to: nil)

    Optional. A page token, received from a previous list spaces call. Provide this parameter to retrieve the subsequent page. When paginating, the filter value should match the call that provided the page token. Passing a different value may lead to unexpected results.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



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

def list_spaces(filter: nil, 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['filter'] = filter unless filter.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

#patch_space(name, space_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::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. Requires user authentication.

Parameters:

  • name (String)

    Resource name of the space. Format: spaces/space``

  • space_object (Google::Apis::ChatV1::Space) (defaults to: nil)
  • update_mask (String) (defaults to: nil)

    Required. The updated field paths, comma separated if there are multiple. Currently supported field paths: - display_name (Only supports changing the display name of a space with the SPACE type, or when also including the space_type mask to change a GROUP_CHAT space type to SPACE. Trying to update the display name of a GROUP_CHAT or a DIRECT_MESSAGE space results in an invalid argument error. If you receive the error message ALREADY_EXISTS when updating the displayName, try a different displayName. An existing space within the Google Workspace organization might already use this display name.) - space_type (Only supports changing a GROUP_CHAT space type to SPACE. Include display_name together with space_type in the update mask and ensure that the specified space has a non-empty display name and the SPACE space type. Including the space_type mask and the SPACE type in the specified space when updating the display name is optional if the existing space already has the SPACE type. Trying to update the space type in other ways results in an invalid argument error). - space_details - space_history_state (Supports turning history on or off for the space if the organization allows users to change their history setting. Warning: mutually exclusive with all other field paths.)

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/google/apis/chat_v1/service.rb', line 410

def patch_space(name, space_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v1/{+name}', options)
  command.request_representation = Google::Apis::ChatV1::Space::Representation
  command.request_object = space_object
  command.response_representation = Google::Apis::ChatV1::Space::Representation
  command.response_class = Google::Apis::ChatV1::Space
  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

#patch_space_message(name, message_object = nil, allow_missing: nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::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. Requires authentication. Fully supports service account authentication and user authentication. Requests authenticated with service accounts can only update messages created by the calling Chat app.

Parameters:

  • name (String)

    Resource name in the form spaces/*/messages/*. Example: spaces/AAAAAAAAAAA/ messages/BBBBBBBBBBB.BBBBBBBBBBB

  • message_object (Google::Apis::ChatV1::Message) (defaults to: nil)
  • allow_missing (Boolean) (defaults to: nil)

    Optional. If true and the message isn't found, a new message is created and updateMask is ignored. The specified message ID must be client-assigned or the request fails.

  • update_mask (String) (defaults to: nil)

    Required. The field paths to update. Separate multiple values with commas. Currently supported field paths: - text - attachment - cards (Requires service account authentication.) - cards_v2 (Requires service account authentication.)

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



960
961
962
963
964
965
966
967
968
969
970
971
972
# File 'lib/google/apis/chat_v1/service.rb', line 960

def patch_space_message(name, message_object = nil, allow_missing: nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, '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['allowMissing'] = allow_missing unless allow_missing.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

#setup_space(set_up_space_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::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. To specify the human members to add, add memberships with the appropriate member.name in the SetUpSpaceRequest. To add a human user, use users/user, whereusercan be the email address for the user. For users in the same Workspace organizationuser can also be theperson_id`for the person from the People API, or theid for the user in the Directory API. For example, if the People API Person resourceNameforuser@example.comispeople/123456789, you can add the user to the space by setting themembership.member.nametousers/user@ example.comorusers/123456789. For a space or group chat, if the caller blocks or is blocked by 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, setSpace. singleUserBotDmtotrueand 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 [create a membership](https://developers.google.com/chat/api/guides/v1/members/create). 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_EXISTSwhen setting up a space, try a differentdisplayName`. An existing space within the Google Workspace organization might already use this display name. Requires user authentication.

Parameters:

  • set_up_space_request_object (Google::Apis::ChatV1::SetUpSpaceRequest) (defaults to: nil)
  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



469
470
471
472
473
474
475
476
477
478
# File 'lib/google/apis/chat_v1/service.rb', line 469

def setup_space(set_up_space_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/spaces:setup', options)
  command.request_representation = Google::Apis::ChatV1::SetUpSpaceRequest::Representation
  command.request_object = set_up_space_request_object
  command.response_representation = Google::Apis::ChatV1::Space::Representation
  command.response_class = Google::Apis::ChatV1::Space
  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, allow_missing: nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::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. Requires authentication. Fully supports service account authentication and user authentication. Requests authenticated with service accounts can only update messages created by the calling Chat app.

Parameters:

  • name (String)

    Resource name in the form spaces/*/messages/*. Example: spaces/AAAAAAAAAAA/ messages/BBBBBBBBBBB.BBBBBBBBBBB

  • message_object (Google::Apis::ChatV1::Message) (defaults to: nil)
  • allow_missing (Boolean) (defaults to: nil)

    Optional. If true and the message isn't found, a new message is created and updateMask is ignored. The specified message ID must be client-assigned or the request fails.

  • update_mask (String) (defaults to: nil)

    Required. The field paths to update. Separate multiple values with commas. Currently supported field paths: - text - attachment - cards (Requires service account authentication.) - cards_v2 (Requires service account authentication.)

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
# File 'lib/google/apis/chat_v1/service.rb', line 1016

def update_space_message(name, message_object = nil, allow_missing: 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['allowMissing'] = allow_missing unless allow_missing.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

#upload_medium_attachment(parent, upload_attachment_request_object = nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ChatV1::UploadAttachmentResponse

Uploads an attachment. For an example, see Upload media as a file attachment. Requires user authentication. You can upload attachments up to 200 MB. Certain file types aren' t supported. For details, see File types blocked by Google Chat.

Parameters:

  • parent (String)

    Required. Resource name of the Chat space in which the attachment is uploaded. Format "spaces/space".

  • upload_attachment_request_object (Google::Apis::ChatV1::UploadAttachmentRequest) (defaults to: nil)
  • 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.

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

    IO stream or filename containing content to upload

  • content_type (String) (defaults to: nil)

    Content type of the uploaded content.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/google/apis/chat_v1/service.rb', line 123

def upload_medium_attachment(parent, upload_attachment_request_object = nil, fields: nil, quota_user: nil, upload_source: nil, content_type: nil, options: nil, &block)
  if upload_source.nil?
    command = make_simple_command(:post, 'v1/{+parent}/attachments:upload', options)
  else
    command = make_upload_command(:post, 'v1/{+parent}/attachments:upload', options)
    command.upload_source = upload_source
    command.upload_content_type = content_type
  end
  command.request_representation = Google::Apis::ChatV1::UploadAttachmentRequest::Representation
  command.request_object = upload_attachment_request_object
  command.response_representation = Google::Apis::ChatV1::UploadAttachmentResponse::Representation
  command.response_class = Google::Apis::ChatV1::UploadAttachmentResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end