google-apps-chat-v1 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9615779f18c3531be92fd43d4db5b5fe9e03c496ecfbce96f5693c91391a7b5e
4
- data.tar.gz: 74bf7360b96a7ef540a6b84f8068948f8d1992c07e117ed0b1350a5eac62fb0a
3
+ metadata.gz: d8ff7e0632f11574b75c0910b722415eb6e565c3e933487e9117e33201d1ba51
4
+ data.tar.gz: f13737a9a5f5efdd8f57408fd9d63c8786392072c6e49110151553f33c6744b9
5
5
  SHA512:
6
- metadata.gz: 10f5baac4a6f7c1a59d15cc74b56aa867a2a34728ee86096803861a68ee441a7ae8799e3842140f782f7310437155a1b1be977720c1117f48a968a9fec375edb
7
- data.tar.gz: f5f7b886e36d78edd4332fffb9d7b31f8fbf0cabdb1ba0c9d8d145f026899c7455b6bdeb061d6f3c781867970b8a4c36cad830ddc58bac64917c0921d438ea78
6
+ metadata.gz: a83ac8f1a4c92a95857e393334889016789af6d1582251576fe5e87280370d4ed29eb4f078497c004425fa641c7ce3c4cd77763fc3cc46cb18db36df70bd893f
7
+ data.tar.gz: e53e90b80b8e40bc0c2f094e92a5ae817cb1f4255864e1b016456d6a5dd45d3e20b023861b89eb14210814694f30561544d7a141a19e27f2ae35a19c564f0a93
@@ -231,6 +231,31 @@ module Google
231
231
  initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
232
232
  }
233
233
 
234
+ default_config.rpcs.get_availability.timeout = 30.0
235
+ default_config.rpcs.get_availability.retry_policy = {
236
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
237
+ }
238
+
239
+ default_config.rpcs.mark_as_active.timeout = 30.0
240
+ default_config.rpcs.mark_as_active.retry_policy = {
241
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
242
+ }
243
+
244
+ default_config.rpcs.mark_as_away.timeout = 30.0
245
+ default_config.rpcs.mark_as_away.retry_policy = {
246
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
247
+ }
248
+
249
+ default_config.rpcs.mark_as_do_not_disturb.timeout = 30.0
250
+ default_config.rpcs.mark_as_do_not_disturb.retry_policy = {
251
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
252
+ }
253
+
254
+ default_config.rpcs.update_availability.timeout = 30.0
255
+ default_config.rpcs.update_availability.retry_policy = {
256
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
257
+ }
258
+
234
259
  default_config.rpcs.get_space_event.timeout = 30.0
235
260
  default_config.rpcs.get_space_event.retry_policy = {
236
261
  initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
@@ -4749,6 +4774,542 @@ module Google
4749
4774
  raise ::Google::Cloud::Error.from_error(e)
4750
4775
  end
4751
4776
 
4777
+ ##
4778
+ # Returns availability information for a human user in Google Chat. For
4779
+ # example, this can be used to check if a user is online or away, or to
4780
+ # retrieve their custom status message.
4781
+ #
4782
+ # This method only retrieves the authenticated user's availability.
4783
+ #
4784
+ # Requires [user
4785
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
4786
+ # with one of the following [authorization
4787
+ # scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
4788
+ #
4789
+ # - `https://www.googleapis.com/auth/chat.users.availability.readonly`
4790
+ # - `https://www.googleapis.com/auth/chat.users.availability`
4791
+ #
4792
+ # @overload get_availability(request, options = nil)
4793
+ # Pass arguments to `get_availability` via a request object, either of type
4794
+ # {::Google::Apps::Chat::V1::GetAvailabilityRequest} or an equivalent Hash.
4795
+ #
4796
+ # @param request [::Google::Apps::Chat::V1::GetAvailabilityRequest, ::Hash]
4797
+ # A request object representing the call parameters. Required. To specify no
4798
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
4799
+ # @param options [::Gapic::CallOptions, ::Hash]
4800
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
4801
+ #
4802
+ # @overload get_availability(name: nil)
4803
+ # Pass arguments to `get_availability` via keyword arguments. Note that at
4804
+ # least one keyword argument is required. To specify no parameters, or to keep all
4805
+ # the default parameter values, pass an empty Hash as a request object (see above).
4806
+ #
4807
+ # @param name [::String]
4808
+ # Required. The resource name of the availability to retrieve.
4809
+ #
4810
+ # Format: users/\\{user}/availability
4811
+ #
4812
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
4813
+ # API. For example, `users/123456789`.
4814
+ #
4815
+ # The user's email address or `me` can also be used as an alias to refer to
4816
+ # the caller. For example, `users/user@example.com` or `users/me`.
4817
+ #
4818
+ # @yield [response, operation] Access the result along with the RPC operation
4819
+ # @yieldparam response [::Google::Apps::Chat::V1::Availability]
4820
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
4821
+ #
4822
+ # @return [::Google::Apps::Chat::V1::Availability]
4823
+ #
4824
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
4825
+ #
4826
+ # @example Basic example
4827
+ # require "google/apps/chat/v1"
4828
+ #
4829
+ # # Create a client object. The client can be reused for multiple calls.
4830
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
4831
+ #
4832
+ # # Create a request. To set request fields, pass in keyword arguments.
4833
+ # request = Google::Apps::Chat::V1::GetAvailabilityRequest.new
4834
+ #
4835
+ # # Call the get_availability method.
4836
+ # result = client.get_availability request
4837
+ #
4838
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
4839
+ # p result
4840
+ #
4841
+ def get_availability request, options = nil
4842
+ raise ::ArgumentError, "request must be provided" if request.nil?
4843
+
4844
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetAvailabilityRequest
4845
+
4846
+ # Converts hash and nil to an options object
4847
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4848
+
4849
+ # Customize the options with defaults
4850
+ metadata = @config.rpcs.get_availability.metadata.to_h
4851
+
4852
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4853
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4854
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
4855
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
4856
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4857
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4858
+
4859
+ header_params = {}
4860
+ if request.name
4861
+ header_params["name"] = request.name
4862
+ end
4863
+
4864
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
4865
+ metadata[:"x-goog-request-params"] ||= request_params_header
4866
+
4867
+ options.apply_defaults timeout: @config.rpcs.get_availability.timeout,
4868
+ metadata: metadata,
4869
+ retry_policy: @config.rpcs.get_availability.retry_policy
4870
+
4871
+ options.apply_defaults timeout: @config.timeout,
4872
+ metadata: @config.metadata,
4873
+ retry_policy: @config.retry_policy
4874
+
4875
+ @chat_service_stub.call_rpc :get_availability, request, options: options do |response, operation|
4876
+ yield response, operation if block_given?
4877
+ end
4878
+ rescue ::GRPC::BadStatus => e
4879
+ raise ::Google::Cloud::Error.from_error(e)
4880
+ end
4881
+
4882
+ ##
4883
+ # Marks user as `ACTIVE` in Google Chat.
4884
+ #
4885
+ # Sets the user's availability state to `ACTIVE`. The `ACTIVE` state
4886
+ # lasts until the specified expiration, at which point the user's state
4887
+ # becomes `AWAY`. Note that if the user is actively using Chat, the `ACTIVE`
4888
+ # state duration may extend beyond the provided expiration.
4889
+ #
4890
+ # This method only updates the authenticated user's availability.
4891
+ #
4892
+ # Requires [user
4893
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
4894
+ # with [authorization
4895
+ # scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
4896
+ #
4897
+ # - `https://www.googleapis.com/auth/chat.users.availability`
4898
+ #
4899
+ # @overload mark_as_active(request, options = nil)
4900
+ # Pass arguments to `mark_as_active` via a request object, either of type
4901
+ # {::Google::Apps::Chat::V1::MarkAsActiveRequest} or an equivalent Hash.
4902
+ #
4903
+ # @param request [::Google::Apps::Chat::V1::MarkAsActiveRequest, ::Hash]
4904
+ # A request object representing the call parameters. Required. To specify no
4905
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
4906
+ # @param options [::Gapic::CallOptions, ::Hash]
4907
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
4908
+ #
4909
+ # @overload mark_as_active(name: nil, expire_time: nil, ttl: nil)
4910
+ # Pass arguments to `mark_as_active` via keyword arguments. Note that at
4911
+ # least one keyword argument is required. To specify no parameters, or to keep all
4912
+ # the default parameter values, pass an empty Hash as a request object (see above).
4913
+ #
4914
+ # @param name [::String]
4915
+ # Required. The resource name of the availability to mark as active.
4916
+ # Format: users/\\{user}/availability
4917
+ #
4918
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
4919
+ # API. For example, `users/123456789`.
4920
+ #
4921
+ # The user's email address or `me` can also be used as an alias to refer to
4922
+ # the caller. For example, `users/user@example.com` or `users/me`.
4923
+ # @param expire_time [::Google::Protobuf::Timestamp, ::Hash]
4924
+ # The absolute timestamp when the ACTIVE state expires.
4925
+ #
4926
+ # Note: The following parameters are mutually exclusive: `expire_time`, `ttl`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
4927
+ # @param ttl [::Google::Protobuf::Duration, ::Hash]
4928
+ # The duration from the current time until the ACTIVE state expires.
4929
+ # Using a short TTL can effectively reset the user's state to be based
4930
+ # on activity after this brief duration.
4931
+ #
4932
+ # Note: The following parameters are mutually exclusive: `ttl`, `expire_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
4933
+ #
4934
+ # @yield [response, operation] Access the result along with the RPC operation
4935
+ # @yieldparam response [::Google::Apps::Chat::V1::Availability]
4936
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
4937
+ #
4938
+ # @return [::Google::Apps::Chat::V1::Availability]
4939
+ #
4940
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
4941
+ #
4942
+ # @example Basic example
4943
+ # require "google/apps/chat/v1"
4944
+ #
4945
+ # # Create a client object. The client can be reused for multiple calls.
4946
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
4947
+ #
4948
+ # # Create a request. To set request fields, pass in keyword arguments.
4949
+ # request = Google::Apps::Chat::V1::MarkAsActiveRequest.new
4950
+ #
4951
+ # # Call the mark_as_active method.
4952
+ # result = client.mark_as_active request
4953
+ #
4954
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
4955
+ # p result
4956
+ #
4957
+ def mark_as_active request, options = nil
4958
+ raise ::ArgumentError, "request must be provided" if request.nil?
4959
+
4960
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::MarkAsActiveRequest
4961
+
4962
+ # Converts hash and nil to an options object
4963
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4964
+
4965
+ # Customize the options with defaults
4966
+ metadata = @config.rpcs.mark_as_active.metadata.to_h
4967
+
4968
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4969
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4970
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
4971
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
4972
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4973
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4974
+
4975
+ header_params = {}
4976
+ if request.name
4977
+ header_params["name"] = request.name
4978
+ end
4979
+
4980
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
4981
+ metadata[:"x-goog-request-params"] ||= request_params_header
4982
+
4983
+ options.apply_defaults timeout: @config.rpcs.mark_as_active.timeout,
4984
+ metadata: metadata,
4985
+ retry_policy: @config.rpcs.mark_as_active.retry_policy
4986
+
4987
+ options.apply_defaults timeout: @config.timeout,
4988
+ metadata: @config.metadata,
4989
+ retry_policy: @config.retry_policy
4990
+
4991
+ @chat_service_stub.call_rpc :mark_as_active, request, options: options do |response, operation|
4992
+ yield response, operation if block_given?
4993
+ end
4994
+ rescue ::GRPC::BadStatus => e
4995
+ raise ::Google::Cloud::Error.from_error(e)
4996
+ end
4997
+
4998
+ ##
4999
+ # Marks user as `AWAY` in Google Chat.
5000
+ #
5001
+ # Sets the user's state to away and is not affected by the user's
5002
+ # activity.
5003
+ #
5004
+ # This method only updates the authenticated user's availability.
5005
+ #
5006
+ # Requires [user
5007
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
5008
+ # with [authorization
5009
+ # scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
5010
+ #
5011
+ # - `https://www.googleapis.com/auth/chat.users.availability`
5012
+ #
5013
+ # @overload mark_as_away(request, options = nil)
5014
+ # Pass arguments to `mark_as_away` via a request object, either of type
5015
+ # {::Google::Apps::Chat::V1::MarkAsAwayRequest} or an equivalent Hash.
5016
+ #
5017
+ # @param request [::Google::Apps::Chat::V1::MarkAsAwayRequest, ::Hash]
5018
+ # A request object representing the call parameters. Required. To specify no
5019
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
5020
+ # @param options [::Gapic::CallOptions, ::Hash]
5021
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
5022
+ #
5023
+ # @overload mark_as_away(name: nil)
5024
+ # Pass arguments to `mark_as_away` via keyword arguments. Note that at
5025
+ # least one keyword argument is required. To specify no parameters, or to keep all
5026
+ # the default parameter values, pass an empty Hash as a request object (see above).
5027
+ #
5028
+ # @param name [::String]
5029
+ # Required. The resource name of the availability to mark as away.
5030
+ # Format: users/\\{user}/availability
5031
+ #
5032
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
5033
+ # API. For example, `users/123456789`.
5034
+ #
5035
+ # The user's email address or `me` can also be used as an alias to refer to
5036
+ # the caller. For example, `users/user@example.com` or `users/me`.
5037
+ #
5038
+ # @yield [response, operation] Access the result along with the RPC operation
5039
+ # @yieldparam response [::Google::Apps::Chat::V1::Availability]
5040
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
5041
+ #
5042
+ # @return [::Google::Apps::Chat::V1::Availability]
5043
+ #
5044
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
5045
+ #
5046
+ # @example Basic example
5047
+ # require "google/apps/chat/v1"
5048
+ #
5049
+ # # Create a client object. The client can be reused for multiple calls.
5050
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
5051
+ #
5052
+ # # Create a request. To set request fields, pass in keyword arguments.
5053
+ # request = Google::Apps::Chat::V1::MarkAsAwayRequest.new
5054
+ #
5055
+ # # Call the mark_as_away method.
5056
+ # result = client.mark_as_away request
5057
+ #
5058
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
5059
+ # p result
5060
+ #
5061
+ def mark_as_away request, options = nil
5062
+ raise ::ArgumentError, "request must be provided" if request.nil?
5063
+
5064
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::MarkAsAwayRequest
5065
+
5066
+ # Converts hash and nil to an options object
5067
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
5068
+
5069
+ # Customize the options with defaults
5070
+ metadata = @config.rpcs.mark_as_away.metadata.to_h
5071
+
5072
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
5073
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
5074
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
5075
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
5076
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
5077
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
5078
+
5079
+ header_params = {}
5080
+ if request.name
5081
+ header_params["name"] = request.name
5082
+ end
5083
+
5084
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
5085
+ metadata[:"x-goog-request-params"] ||= request_params_header
5086
+
5087
+ options.apply_defaults timeout: @config.rpcs.mark_as_away.timeout,
5088
+ metadata: metadata,
5089
+ retry_policy: @config.rpcs.mark_as_away.retry_policy
5090
+
5091
+ options.apply_defaults timeout: @config.timeout,
5092
+ metadata: @config.metadata,
5093
+ retry_policy: @config.retry_policy
5094
+
5095
+ @chat_service_stub.call_rpc :mark_as_away, request, options: options do |response, operation|
5096
+ yield response, operation if block_given?
5097
+ end
5098
+ rescue ::GRPC::BadStatus => e
5099
+ raise ::Google::Cloud::Error.from_error(e)
5100
+ end
5101
+
5102
+ ##
5103
+ # Marks user as `DO_NOT_DISTURB` in Google Chat.
5104
+ #
5105
+ # Sets a user's availability state to `DO_NOT_DISTURB` until a specified
5106
+ # expiration time.
5107
+ # When in `DO_NOT_DISTURB`, users typically won't receive notifications.
5108
+ #
5109
+ # This method only updates the authenticated user's availability.
5110
+ #
5111
+ # Requires [user
5112
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
5113
+ # with [authorization
5114
+ # scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
5115
+ #
5116
+ # - `https://www.googleapis.com/auth/chat.users.availability`
5117
+ #
5118
+ # @overload mark_as_do_not_disturb(request, options = nil)
5119
+ # Pass arguments to `mark_as_do_not_disturb` via a request object, either of type
5120
+ # {::Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest} or an equivalent Hash.
5121
+ #
5122
+ # @param request [::Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest, ::Hash]
5123
+ # A request object representing the call parameters. Required. To specify no
5124
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
5125
+ # @param options [::Gapic::CallOptions, ::Hash]
5126
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
5127
+ #
5128
+ # @overload mark_as_do_not_disturb(name: nil, expire_time: nil, ttl: nil)
5129
+ # Pass arguments to `mark_as_do_not_disturb` via keyword arguments. Note that at
5130
+ # least one keyword argument is required. To specify no parameters, or to keep all
5131
+ # the default parameter values, pass an empty Hash as a request object (see above).
5132
+ #
5133
+ # @param name [::String]
5134
+ # Required. The resource name of the availability to mark as Do Not Disturb.
5135
+ # Format: users/\\{user}/availability
5136
+ #
5137
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
5138
+ # API. For example, `users/123456789`.
5139
+ #
5140
+ # The user's email address or `me` can also be used as an alias to refer to
5141
+ # the caller. For example, `users/user@example.com` or `users/me`.
5142
+ # @param expire_time [::Google::Protobuf::Timestamp, ::Hash]
5143
+ # The absolute timestamp when the DND state expires.
5144
+ #
5145
+ # Note: The following parameters are mutually exclusive: `expire_time`, `ttl`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
5146
+ # @param ttl [::Google::Protobuf::Duration, ::Hash]
5147
+ # The duration from the current time until the DND state expires.
5148
+ #
5149
+ # Note: The following parameters are mutually exclusive: `ttl`, `expire_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
5150
+ #
5151
+ # @yield [response, operation] Access the result along with the RPC operation
5152
+ # @yieldparam response [::Google::Apps::Chat::V1::Availability]
5153
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
5154
+ #
5155
+ # @return [::Google::Apps::Chat::V1::Availability]
5156
+ #
5157
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
5158
+ #
5159
+ # @example Basic example
5160
+ # require "google/apps/chat/v1"
5161
+ #
5162
+ # # Create a client object. The client can be reused for multiple calls.
5163
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
5164
+ #
5165
+ # # Create a request. To set request fields, pass in keyword arguments.
5166
+ # request = Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest.new
5167
+ #
5168
+ # # Call the mark_as_do_not_disturb method.
5169
+ # result = client.mark_as_do_not_disturb request
5170
+ #
5171
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
5172
+ # p result
5173
+ #
5174
+ def mark_as_do_not_disturb request, options = nil
5175
+ raise ::ArgumentError, "request must be provided" if request.nil?
5176
+
5177
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest
5178
+
5179
+ # Converts hash and nil to an options object
5180
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
5181
+
5182
+ # Customize the options with defaults
5183
+ metadata = @config.rpcs.mark_as_do_not_disturb.metadata.to_h
5184
+
5185
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
5186
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
5187
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
5188
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
5189
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
5190
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
5191
+
5192
+ header_params = {}
5193
+ if request.name
5194
+ header_params["name"] = request.name
5195
+ end
5196
+
5197
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
5198
+ metadata[:"x-goog-request-params"] ||= request_params_header
5199
+
5200
+ options.apply_defaults timeout: @config.rpcs.mark_as_do_not_disturb.timeout,
5201
+ metadata: metadata,
5202
+ retry_policy: @config.rpcs.mark_as_do_not_disturb.retry_policy
5203
+
5204
+ options.apply_defaults timeout: @config.timeout,
5205
+ metadata: @config.metadata,
5206
+ retry_policy: @config.retry_policy
5207
+
5208
+ @chat_service_stub.call_rpc :mark_as_do_not_disturb, request, options: options do |response, operation|
5209
+ yield response, operation if block_given?
5210
+ end
5211
+ rescue ::GRPC::BadStatus => e
5212
+ raise ::Google::Cloud::Error.from_error(e)
5213
+ end
5214
+
5215
+ ##
5216
+ # Updates availability information for a human user. Only the `custom_status`
5217
+ # field can be updated through this method.
5218
+ #
5219
+ # This method only updates the authenticated user's availability.
5220
+ #
5221
+ # Requires [user
5222
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
5223
+ # with one of the following [authorization
5224
+ # scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
5225
+ #
5226
+ # - `https://www.googleapis.com/auth/chat.users.availability`
5227
+ #
5228
+ # @overload update_availability(request, options = nil)
5229
+ # Pass arguments to `update_availability` via a request object, either of type
5230
+ # {::Google::Apps::Chat::V1::UpdateAvailabilityRequest} or an equivalent Hash.
5231
+ #
5232
+ # @param request [::Google::Apps::Chat::V1::UpdateAvailabilityRequest, ::Hash]
5233
+ # A request object representing the call parameters. Required. To specify no
5234
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
5235
+ # @param options [::Gapic::CallOptions, ::Hash]
5236
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
5237
+ #
5238
+ # @overload update_availability(availability: nil, update_mask: nil)
5239
+ # Pass arguments to `update_availability` via keyword arguments. Note that at
5240
+ # least one keyword argument is required. To specify no parameters, or to keep all
5241
+ # the default parameter values, pass an empty Hash as a request object (see above).
5242
+ #
5243
+ # @param availability [::Google::Apps::Chat::V1::Availability, ::Hash]
5244
+ # Required. The availability to update.
5245
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
5246
+ # Required. The list of fields to update.
5247
+ # The only field that can be updated is `custom_status`.
5248
+ #
5249
+ # @yield [response, operation] Access the result along with the RPC operation
5250
+ # @yieldparam response [::Google::Apps::Chat::V1::Availability]
5251
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
5252
+ #
5253
+ # @return [::Google::Apps::Chat::V1::Availability]
5254
+ #
5255
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
5256
+ #
5257
+ # @example Basic example
5258
+ # require "google/apps/chat/v1"
5259
+ #
5260
+ # # Create a client object. The client can be reused for multiple calls.
5261
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
5262
+ #
5263
+ # # Create a request. To set request fields, pass in keyword arguments.
5264
+ # request = Google::Apps::Chat::V1::UpdateAvailabilityRequest.new
5265
+ #
5266
+ # # Call the update_availability method.
5267
+ # result = client.update_availability request
5268
+ #
5269
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
5270
+ # p result
5271
+ #
5272
+ def update_availability request, options = nil
5273
+ raise ::ArgumentError, "request must be provided" if request.nil?
5274
+
5275
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateAvailabilityRequest
5276
+
5277
+ # Converts hash and nil to an options object
5278
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
5279
+
5280
+ # Customize the options with defaults
5281
+ metadata = @config.rpcs.update_availability.metadata.to_h
5282
+
5283
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
5284
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
5285
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
5286
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
5287
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
5288
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
5289
+
5290
+ header_params = {}
5291
+ if request.availability&.name
5292
+ header_params["availability.name"] = request.availability.name
5293
+ end
5294
+
5295
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
5296
+ metadata[:"x-goog-request-params"] ||= request_params_header
5297
+
5298
+ options.apply_defaults timeout: @config.rpcs.update_availability.timeout,
5299
+ metadata: metadata,
5300
+ retry_policy: @config.rpcs.update_availability.retry_policy
5301
+
5302
+ options.apply_defaults timeout: @config.timeout,
5303
+ metadata: @config.metadata,
5304
+ retry_policy: @config.retry_policy
5305
+
5306
+ @chat_service_stub.call_rpc :update_availability, request, options: options do |response, operation|
5307
+ yield response, operation if block_given?
5308
+ end
5309
+ rescue ::GRPC::BadStatus => e
5310
+ raise ::Google::Cloud::Error.from_error(e)
5311
+ end
5312
+
4752
5313
  ##
4753
5314
  # Returns an event from a Google Chat space. The [event
4754
5315
  # payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload)
@@ -6401,6 +6962,31 @@ module Google
6401
6962
  #
6402
6963
  attr_reader :get_thread_read_state
6403
6964
  ##
6965
+ # RPC-specific configuration for `get_availability`
6966
+ # @return [::Gapic::Config::Method]
6967
+ #
6968
+ attr_reader :get_availability
6969
+ ##
6970
+ # RPC-specific configuration for `mark_as_active`
6971
+ # @return [::Gapic::Config::Method]
6972
+ #
6973
+ attr_reader :mark_as_active
6974
+ ##
6975
+ # RPC-specific configuration for `mark_as_away`
6976
+ # @return [::Gapic::Config::Method]
6977
+ #
6978
+ attr_reader :mark_as_away
6979
+ ##
6980
+ # RPC-specific configuration for `mark_as_do_not_disturb`
6981
+ # @return [::Gapic::Config::Method]
6982
+ #
6983
+ attr_reader :mark_as_do_not_disturb
6984
+ ##
6985
+ # RPC-specific configuration for `update_availability`
6986
+ # @return [::Gapic::Config::Method]
6987
+ #
6988
+ attr_reader :update_availability
6989
+ ##
6404
6990
  # RPC-specific configuration for `get_space_event`
6405
6991
  # @return [::Gapic::Config::Method]
6406
6992
  #
@@ -6522,6 +7108,16 @@ module Google
6522
7108
  @update_space_read_state = ::Gapic::Config::Method.new update_space_read_state_config
6523
7109
  get_thread_read_state_config = parent_rpcs.get_thread_read_state if parent_rpcs.respond_to? :get_thread_read_state
6524
7110
  @get_thread_read_state = ::Gapic::Config::Method.new get_thread_read_state_config
7111
+ get_availability_config = parent_rpcs.get_availability if parent_rpcs.respond_to? :get_availability
7112
+ @get_availability = ::Gapic::Config::Method.new get_availability_config
7113
+ mark_as_active_config = parent_rpcs.mark_as_active if parent_rpcs.respond_to? :mark_as_active
7114
+ @mark_as_active = ::Gapic::Config::Method.new mark_as_active_config
7115
+ mark_as_away_config = parent_rpcs.mark_as_away if parent_rpcs.respond_to? :mark_as_away
7116
+ @mark_as_away = ::Gapic::Config::Method.new mark_as_away_config
7117
+ mark_as_do_not_disturb_config = parent_rpcs.mark_as_do_not_disturb if parent_rpcs.respond_to? :mark_as_do_not_disturb
7118
+ @mark_as_do_not_disturb = ::Gapic::Config::Method.new mark_as_do_not_disturb_config
7119
+ update_availability_config = parent_rpcs.update_availability if parent_rpcs.respond_to? :update_availability
7120
+ @update_availability = ::Gapic::Config::Method.new update_availability_config
6525
7121
  get_space_event_config = parent_rpcs.get_space_event if parent_rpcs.respond_to? :get_space_event
6526
7122
  @get_space_event = ::Gapic::Config::Method.new get_space_event_config
6527
7123
  list_space_events_config = parent_rpcs.list_space_events if parent_rpcs.respond_to? :list_space_events
@@ -55,6 +55,8 @@ module Google
55
55
  "https://www.googleapis.com/auth/chat.spaces",
56
56
  "https://www.googleapis.com/auth/chat.spaces.create",
57
57
  "https://www.googleapis.com/auth/chat.spaces.readonly",
58
+ "https://www.googleapis.com/auth/chat.users.availability",
59
+ "https://www.googleapis.com/auth/chat.users.availability.readonly",
58
60
  "https://www.googleapis.com/auth/chat.users.readstate",
59
61
  "https://www.googleapis.com/auth/chat.users.readstate.readonly",
60
62
  "https://www.googleapis.com/auth/chat.users.sections",
@@ -43,6 +43,20 @@ module Google
43
43
  "spaces/#{space}/messages/#{message}/attachments/#{attachment}"
44
44
  end
45
45
 
46
+ ##
47
+ # Create a fully-qualified Availability resource string.
48
+ #
49
+ # The resource will be in the following format:
50
+ #
51
+ # `users/{user}/availability`
52
+ #
53
+ # @param user [String]
54
+ #
55
+ # @return [::String]
56
+ def availability_path user:
57
+ "users/#{user}/availability"
58
+ end
59
+
46
60
  ##
47
61
  # Create a fully-qualified CustomEmoji resource string.
48
62
  #