# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'google/apis/core/base_service' require 'google/apis/core/json_representation' require 'google/apis/core/hashable' require 'google/apis/errors' module Google module Apis module ChatV1 # Google Chat API # # Enables apps to fetch information and perform actions in Google Chat. # Authentication using a service account is a prerequisite for using the Google # Chat REST API. # # @example # require 'google/apis/chat_v1' # # Chat = Google::Apis::ChatV1 # Alias the module # service = Chat::HangoutsChatService.new # # @see https://developers.google.com/hangouts/chat class HangoutsChatService < Google::Apis::Core::BaseService # @return [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. attr_accessor :key # @return [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. attr_accessor :quota_user def initialize super('https://chat.googleapis.com/', '', client_name: 'google-apis-chat_v1', client_version: Google::Apis::ChatV1::GEM_VERSION) @batch_path = 'batch' end # Legacy path for creating message. Calling these will result in a BadRequest # response. # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def messages_dm(parent, message_object = 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['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 # Legacy path for creating message. Calling these will result in a BadRequest # response. # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def webhooks_dm(parent, message_object = nil, request_id: nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+parent}/webhooks', 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['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 # Legacy path for creating message. Calling these will result in a BadRequest # response. # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def messages_dm_conversation(parent, message_object = 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['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 # Downloads media. Download is supported on the URI `/v1/media/`+name`?alt=media` # . # @param [String] resource_name # Name of the media that is being downloaded. See ReadRequest.resource_name. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [IO, String] download_dest # IO stream or filename to receive content download # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Media] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Media] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Legacy path for creating message. Calling these will result in a BadRequest # response. # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def messages_room(parent, message_object = 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['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 # Legacy path for creating message. Calling these will result in a BadRequest # response. # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def webhooks_room(parent, message_object = nil, request_id: nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+parent}/webhooks', 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['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 # Legacy path for creating message. Calling these will result in a BadRequest # response. # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def messages_room_conversation(parent, message_object = 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['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 # Returns a space. Requires [service account authentication](https://developers. # google.com/chat/api/guides/auth/service-accounts). # @param [String] name # Required. Resource name of the space, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAAA # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Space] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Space] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Lists spaces the caller is a member of. Requires [service account # authentication](https://developers.google.com/chat/api/guides/auth/service- # accounts). # @param [Fixnum] page_size # Requested page size. The value is capped at 1000. Server may return fewer # results than requested. If unspecified, server will default to 100. # @param [String] page_token # A token identifying a page of results the server should return. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::ListSpacesResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::ListSpacesResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Legacy path for creating message. Calling these will result in a BadRequest # response. # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def webhooks_space(parent, message_object = nil, request_id: nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+parent}/webhooks', 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['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 # Returns a membership. Requires [service account authentication](https:// # developers.google.com/chat/api/guides/auth/service-accounts). # @param [String] name # Required. Resource name of the membership to be retrieved, in the form "spaces/ # */members/*". Example: spaces/AAAAAAAAAAAA/members/111111111111111111111 # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Membership] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Membership] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Lists human memberships in a space. Requires [service account authentication]( # https://developers.google.com/chat/api/guides/auth/service-accounts). # @param [String] parent # Required. The resource name of the space for which membership list is to be # fetched, in the form "spaces/*". Example: spaces/AAAAAAAAAAAA # @param [Fixnum] page_size # Requested page size. The value is capped at 1000. Server may return fewer # results than requested. If unspecified, server will default to 100. # @param [String] page_token # A token identifying a page of results the server should return. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::ListMembershipsResponse] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::ListMembershipsResponse] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Creates a message. Requires [service account authentication](https:// # developers.google.com/chat/api/guides/auth/service-accounts). # @param [String] parent # Required. Space resource name, in the form "spaces/*". Example: spaces/ # AAAAAAAAAAA # @param [Google::Apis::ChatV1::Message] message_object # @param [String] request_id # 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. # @param [String] thread_key # Optional. 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 Chat apps # and webhooks from having to store the Google 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. # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required def create_space_message(parent, message_object = 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['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 # Deletes a message. Requires [service account authentication](https:// # developers.google.com/chat/api/guides/auth/service-accounts). # @param [String] name # Required. Resource name of the message to be deleted, in the form "spaces/*/ # messages/*" Example: spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Empty] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Empty] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Returns a message. Requires [service account authentication](https:// # developers.google.com/chat/api/guides/auth/service-accounts). # @param [String] name # Required. Resource name of the message to be retrieved, in the form "spaces/*/ # messages/*". Example: spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Updates a message. Requires [service account authentication](https:// # developers.google.com/chat/api/guides/auth/service-accounts). # @param [String] name # Resource name in the form `spaces/*/messages/*`. Example: `spaces/AAAAAAAAAAA/ # messages/BBBBBBBBBBB.BBBBBBBBBBB` # @param [Google::Apis::ChatV1::Message] message_object # @param [String] update_mask # Required. The field paths to be updated, comma separated if there are multiple. # Currently supported field paths: * text * cards * attachment # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Message] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 # Gets the metadata of a message attachment. The attachment data is fetched # using the media API. Requires [service account authentication](https:// # developers.google.com/chat/api/guides/auth/service-accounts). # @param [String] name # Required. Resource name of the attachment, in the form "spaces/*/messages/*/ # attachments/*". # @param [String] fields # Selector specifying which fields to include in a partial response. # @param [String] quota_user # 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. # @param [Google::Apis::RequestOptions] options # Request-specific options # # @yield [result, err] Result & error if block supplied # @yieldparam result [Google::Apis::ChatV1::Attachment] parsed result object # @yieldparam err [StandardError] error object if request failed # # @return [Google::Apis::ChatV1::Attachment] # # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification # @raise [Google::Apis::AuthorizationError] Authorization is required 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 protected def apply_command_defaults(command) command.query['key'] = key unless key.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? end end end end end