google-apps-chat-v1 0.24.0 → 0.26.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.
@@ -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
  #
@@ -233,6 +233,31 @@ module Google
233
233
  initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
234
234
  }
235
235
 
236
+ default_config.rpcs.get_availability.timeout = 30.0
237
+ default_config.rpcs.get_availability.retry_policy = {
238
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
239
+ }
240
+
241
+ default_config.rpcs.mark_as_active.timeout = 30.0
242
+ default_config.rpcs.mark_as_active.retry_policy = {
243
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
244
+ }
245
+
246
+ default_config.rpcs.mark_as_away.timeout = 30.0
247
+ default_config.rpcs.mark_as_away.retry_policy = {
248
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
249
+ }
250
+
251
+ default_config.rpcs.mark_as_do_not_disturb.timeout = 30.0
252
+ default_config.rpcs.mark_as_do_not_disturb.retry_policy = {
253
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
254
+ }
255
+
256
+ default_config.rpcs.update_availability.timeout = 30.0
257
+ default_config.rpcs.update_availability.retry_policy = {
258
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
259
+ }
260
+
236
261
  default_config.rpcs.get_space_event.timeout = 30.0
237
262
  default_config.rpcs.get_space_event.retry_policy = {
238
263
  initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
@@ -2515,6 +2540,24 @@ module Google
2515
2540
  # users](https://developers.google.com/workspace/chat/space-target-audience).
2516
2541
  # `access_settings.audience` is not supported with `useAdminAccess`.
2517
2542
  #
2543
+ # `access_settings.access_permission_settings`: Updates the [access
2544
+ # permission
2545
+ # settings](https://support.google.com/chat/answer/11971020) of who can
2546
+ # discover and join the space where `spaceType` field is `SPACE`. Principals
2547
+ # allowed to join the space must also be allowed to discover it. To update
2548
+ # access permission settings for a space, the authenticating user must be a
2549
+ # space manager or assistant manager and omit all other field masks in the
2550
+ # request. You can't update this field if the space is in [import
2551
+ # mode](https://developers.google.com/workspace/chat/import-data-overview).
2552
+ # To learn more, see [Make a space discoverable to specific
2553
+ # users](https://developers.google.com/workspace/chat/space-target-audience).
2554
+ # `access_settings.access_permission_settings` is not supported with
2555
+ # `useAdminAccess`.
2556
+ # The supported field masks include:
2557
+ #
2558
+ # - `access_settings.access_permission_settings.discoverSpaceSetting`
2559
+ # - `access_settings.access_permission_settings.joinSpaceSetting`
2560
+ #
2518
2561
  # `permission_settings`: Supports changing the
2519
2562
  # [permission settings](https://support.google.com/chat/answer/13340792)
2520
2563
  # of a space.
@@ -4582,6 +4625,507 @@ module Google
4582
4625
  raise ::Google::Cloud::Error.from_error(e)
4583
4626
  end
4584
4627
 
4628
+ ##
4629
+ # Returns availability information for a human user in Google Chat. For
4630
+ # example, this can be used to check if a user is online or away, or to
4631
+ # retrieve their custom status message.
4632
+ #
4633
+ # This method only retrieves the authenticated user's availability.
4634
+ #
4635
+ # Requires [user
4636
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
4637
+ # with one of the following [authorization
4638
+ # scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
4639
+ #
4640
+ # - `https://www.googleapis.com/auth/chat.users.availability.readonly`
4641
+ # - `https://www.googleapis.com/auth/chat.users.availability`
4642
+ #
4643
+ # @overload get_availability(request, options = nil)
4644
+ # Pass arguments to `get_availability` via a request object, either of type
4645
+ # {::Google::Apps::Chat::V1::GetAvailabilityRequest} or an equivalent Hash.
4646
+ #
4647
+ # @param request [::Google::Apps::Chat::V1::GetAvailabilityRequest, ::Hash]
4648
+ # A request object representing the call parameters. Required. To specify no
4649
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
4650
+ # @param options [::Gapic::CallOptions, ::Hash]
4651
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
4652
+ #
4653
+ # @overload get_availability(name: nil)
4654
+ # Pass arguments to `get_availability` via keyword arguments. Note that at
4655
+ # least one keyword argument is required. To specify no parameters, or to keep all
4656
+ # the default parameter values, pass an empty Hash as a request object (see above).
4657
+ #
4658
+ # @param name [::String]
4659
+ # Required. The resource name of the availability to retrieve.
4660
+ #
4661
+ # Format: users/\\{user}/availability
4662
+ #
4663
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
4664
+ # API. For example, `users/123456789`.
4665
+ #
4666
+ # The user's email address or `me` can also be used as an alias to refer to
4667
+ # the caller. For example, `users/user@example.com` or `users/me`.
4668
+ # @yield [result, operation] Access the result along with the TransportOperation object
4669
+ # @yieldparam result [::Google::Apps::Chat::V1::Availability]
4670
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
4671
+ #
4672
+ # @return [::Google::Apps::Chat::V1::Availability]
4673
+ #
4674
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
4675
+ #
4676
+ # @example Basic example
4677
+ # require "google/apps/chat/v1"
4678
+ #
4679
+ # # Create a client object. The client can be reused for multiple calls.
4680
+ # client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
4681
+ #
4682
+ # # Create a request. To set request fields, pass in keyword arguments.
4683
+ # request = Google::Apps::Chat::V1::GetAvailabilityRequest.new
4684
+ #
4685
+ # # Call the get_availability method.
4686
+ # result = client.get_availability request
4687
+ #
4688
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
4689
+ # p result
4690
+ #
4691
+ def get_availability request, options = nil
4692
+ raise ::ArgumentError, "request must be provided" if request.nil?
4693
+
4694
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetAvailabilityRequest
4695
+
4696
+ # Converts hash and nil to an options object
4697
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4698
+
4699
+ # Customize the options with defaults
4700
+ call_metadata = @config.rpcs.get_availability.metadata.to_h
4701
+
4702
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4703
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4704
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
4705
+ gapic_version: ::Google::Apps::Chat::V1::VERSION,
4706
+ transports_version_send: [:rest]
4707
+
4708
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4709
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4710
+
4711
+ options.apply_defaults timeout: @config.rpcs.get_availability.timeout,
4712
+ metadata: call_metadata,
4713
+ retry_policy: @config.rpcs.get_availability.retry_policy
4714
+
4715
+ options.apply_defaults timeout: @config.timeout,
4716
+ metadata: @config.metadata,
4717
+ retry_policy: @config.retry_policy
4718
+
4719
+ @chat_service_stub.get_availability request, options do |result, operation|
4720
+ yield result, operation if block_given?
4721
+ end
4722
+ rescue ::Gapic::Rest::Error => e
4723
+ raise ::Google::Cloud::Error.from_error(e)
4724
+ end
4725
+
4726
+ ##
4727
+ # Marks user as `ACTIVE` in Google Chat.
4728
+ #
4729
+ # Sets the user's availability state to `ACTIVE`. The `ACTIVE` state
4730
+ # lasts until the specified expiration, at which point the user's state
4731
+ # becomes `AWAY`. Note that if the user is actively using Chat, the `ACTIVE`
4732
+ # state duration may extend beyond the provided expiration.
4733
+ #
4734
+ # This method only updates the authenticated user's availability.
4735
+ #
4736
+ # Requires [user
4737
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
4738
+ # with [authorization
4739
+ # scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
4740
+ #
4741
+ # - `https://www.googleapis.com/auth/chat.users.availability`
4742
+ #
4743
+ # @overload mark_as_active(request, options = nil)
4744
+ # Pass arguments to `mark_as_active` via a request object, either of type
4745
+ # {::Google::Apps::Chat::V1::MarkAsActiveRequest} or an equivalent Hash.
4746
+ #
4747
+ # @param request [::Google::Apps::Chat::V1::MarkAsActiveRequest, ::Hash]
4748
+ # A request object representing the call parameters. Required. To specify no
4749
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
4750
+ # @param options [::Gapic::CallOptions, ::Hash]
4751
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
4752
+ #
4753
+ # @overload mark_as_active(name: nil, expire_time: nil, ttl: nil)
4754
+ # Pass arguments to `mark_as_active` via keyword arguments. Note that at
4755
+ # least one keyword argument is required. To specify no parameters, or to keep all
4756
+ # the default parameter values, pass an empty Hash as a request object (see above).
4757
+ #
4758
+ # @param name [::String]
4759
+ # Required. The resource name of the availability to mark as active.
4760
+ # Format: users/\\{user}/availability
4761
+ #
4762
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
4763
+ # API. For example, `users/123456789`.
4764
+ #
4765
+ # The user's email address or `me` can also be used as an alias to refer to
4766
+ # the caller. For example, `users/user@example.com` or `users/me`.
4767
+ # @param expire_time [::Google::Protobuf::Timestamp, ::Hash]
4768
+ # The absolute timestamp when the ACTIVE state expires.
4769
+ #
4770
+ # 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.
4771
+ # @param ttl [::Google::Protobuf::Duration, ::Hash]
4772
+ # The duration from the current time until the ACTIVE state expires.
4773
+ # Using a short TTL can effectively reset the user's state to be based
4774
+ # on activity after this brief duration.
4775
+ #
4776
+ # 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.
4777
+ # @yield [result, operation] Access the result along with the TransportOperation object
4778
+ # @yieldparam result [::Google::Apps::Chat::V1::Availability]
4779
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
4780
+ #
4781
+ # @return [::Google::Apps::Chat::V1::Availability]
4782
+ #
4783
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
4784
+ #
4785
+ # @example Basic example
4786
+ # require "google/apps/chat/v1"
4787
+ #
4788
+ # # Create a client object. The client can be reused for multiple calls.
4789
+ # client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
4790
+ #
4791
+ # # Create a request. To set request fields, pass in keyword arguments.
4792
+ # request = Google::Apps::Chat::V1::MarkAsActiveRequest.new
4793
+ #
4794
+ # # Call the mark_as_active method.
4795
+ # result = client.mark_as_active request
4796
+ #
4797
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
4798
+ # p result
4799
+ #
4800
+ def mark_as_active request, options = nil
4801
+ raise ::ArgumentError, "request must be provided" if request.nil?
4802
+
4803
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::MarkAsActiveRequest
4804
+
4805
+ # Converts hash and nil to an options object
4806
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4807
+
4808
+ # Customize the options with defaults
4809
+ call_metadata = @config.rpcs.mark_as_active.metadata.to_h
4810
+
4811
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4812
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4813
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
4814
+ gapic_version: ::Google::Apps::Chat::V1::VERSION,
4815
+ transports_version_send: [:rest]
4816
+
4817
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4818
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4819
+
4820
+ options.apply_defaults timeout: @config.rpcs.mark_as_active.timeout,
4821
+ metadata: call_metadata,
4822
+ retry_policy: @config.rpcs.mark_as_active.retry_policy
4823
+
4824
+ options.apply_defaults timeout: @config.timeout,
4825
+ metadata: @config.metadata,
4826
+ retry_policy: @config.retry_policy
4827
+
4828
+ @chat_service_stub.mark_as_active request, options do |result, operation|
4829
+ yield result, operation if block_given?
4830
+ end
4831
+ rescue ::Gapic::Rest::Error => e
4832
+ raise ::Google::Cloud::Error.from_error(e)
4833
+ end
4834
+
4835
+ ##
4836
+ # Marks user as `AWAY` in Google Chat.
4837
+ #
4838
+ # Sets the user's state to away and is not affected by the user's
4839
+ # activity.
4840
+ #
4841
+ # This method only updates the authenticated user's availability.
4842
+ #
4843
+ # Requires [user
4844
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
4845
+ # with [authorization
4846
+ # scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
4847
+ #
4848
+ # - `https://www.googleapis.com/auth/chat.users.availability`
4849
+ #
4850
+ # @overload mark_as_away(request, options = nil)
4851
+ # Pass arguments to `mark_as_away` via a request object, either of type
4852
+ # {::Google::Apps::Chat::V1::MarkAsAwayRequest} or an equivalent Hash.
4853
+ #
4854
+ # @param request [::Google::Apps::Chat::V1::MarkAsAwayRequest, ::Hash]
4855
+ # A request object representing the call parameters. Required. To specify no
4856
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
4857
+ # @param options [::Gapic::CallOptions, ::Hash]
4858
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
4859
+ #
4860
+ # @overload mark_as_away(name: nil)
4861
+ # Pass arguments to `mark_as_away` via keyword arguments. Note that at
4862
+ # least one keyword argument is required. To specify no parameters, or to keep all
4863
+ # the default parameter values, pass an empty Hash as a request object (see above).
4864
+ #
4865
+ # @param name [::String]
4866
+ # Required. The resource name of the availability to mark as away.
4867
+ # Format: users/\\{user}/availability
4868
+ #
4869
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
4870
+ # API. For example, `users/123456789`.
4871
+ #
4872
+ # The user's email address or `me` can also be used as an alias to refer to
4873
+ # the caller. For example, `users/user@example.com` or `users/me`.
4874
+ # @yield [result, operation] Access the result along with the TransportOperation object
4875
+ # @yieldparam result [::Google::Apps::Chat::V1::Availability]
4876
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
4877
+ #
4878
+ # @return [::Google::Apps::Chat::V1::Availability]
4879
+ #
4880
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
4881
+ #
4882
+ # @example Basic example
4883
+ # require "google/apps/chat/v1"
4884
+ #
4885
+ # # Create a client object. The client can be reused for multiple calls.
4886
+ # client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
4887
+ #
4888
+ # # Create a request. To set request fields, pass in keyword arguments.
4889
+ # request = Google::Apps::Chat::V1::MarkAsAwayRequest.new
4890
+ #
4891
+ # # Call the mark_as_away method.
4892
+ # result = client.mark_as_away request
4893
+ #
4894
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
4895
+ # p result
4896
+ #
4897
+ def mark_as_away request, options = nil
4898
+ raise ::ArgumentError, "request must be provided" if request.nil?
4899
+
4900
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::MarkAsAwayRequest
4901
+
4902
+ # Converts hash and nil to an options object
4903
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4904
+
4905
+ # Customize the options with defaults
4906
+ call_metadata = @config.rpcs.mark_as_away.metadata.to_h
4907
+
4908
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4909
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4910
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
4911
+ gapic_version: ::Google::Apps::Chat::V1::VERSION,
4912
+ transports_version_send: [:rest]
4913
+
4914
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4915
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4916
+
4917
+ options.apply_defaults timeout: @config.rpcs.mark_as_away.timeout,
4918
+ metadata: call_metadata,
4919
+ retry_policy: @config.rpcs.mark_as_away.retry_policy
4920
+
4921
+ options.apply_defaults timeout: @config.timeout,
4922
+ metadata: @config.metadata,
4923
+ retry_policy: @config.retry_policy
4924
+
4925
+ @chat_service_stub.mark_as_away request, options do |result, operation|
4926
+ yield result, operation if block_given?
4927
+ end
4928
+ rescue ::Gapic::Rest::Error => e
4929
+ raise ::Google::Cloud::Error.from_error(e)
4930
+ end
4931
+
4932
+ ##
4933
+ # Marks user as `DO_NOT_DISTURB` in Google Chat.
4934
+ #
4935
+ # Sets a user's availability state to `DO_NOT_DISTURB` until a specified
4936
+ # expiration time.
4937
+ # When in `DO_NOT_DISTURB`, users typically won't receive notifications.
4938
+ #
4939
+ # This method only updates the authenticated user's availability.
4940
+ #
4941
+ # Requires [user
4942
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
4943
+ # with [authorization
4944
+ # scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
4945
+ #
4946
+ # - `https://www.googleapis.com/auth/chat.users.availability`
4947
+ #
4948
+ # @overload mark_as_do_not_disturb(request, options = nil)
4949
+ # Pass arguments to `mark_as_do_not_disturb` via a request object, either of type
4950
+ # {::Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest} or an equivalent Hash.
4951
+ #
4952
+ # @param request [::Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest, ::Hash]
4953
+ # A request object representing the call parameters. Required. To specify no
4954
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
4955
+ # @param options [::Gapic::CallOptions, ::Hash]
4956
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
4957
+ #
4958
+ # @overload mark_as_do_not_disturb(name: nil, expire_time: nil, ttl: nil)
4959
+ # Pass arguments to `mark_as_do_not_disturb` via keyword arguments. Note that at
4960
+ # least one keyword argument is required. To specify no parameters, or to keep all
4961
+ # the default parameter values, pass an empty Hash as a request object (see above).
4962
+ #
4963
+ # @param name [::String]
4964
+ # Required. The resource name of the availability to mark as Do Not Disturb.
4965
+ # Format: users/\\{user}/availability
4966
+ #
4967
+ # `{user}` is the id for the Person in the People API or Admin SDK directory
4968
+ # API. For example, `users/123456789`.
4969
+ #
4970
+ # The user's email address or `me` can also be used as an alias to refer to
4971
+ # the caller. For example, `users/user@example.com` or `users/me`.
4972
+ # @param expire_time [::Google::Protobuf::Timestamp, ::Hash]
4973
+ # The absolute timestamp when the DND state expires.
4974
+ #
4975
+ # 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.
4976
+ # @param ttl [::Google::Protobuf::Duration, ::Hash]
4977
+ # The duration from the current time until the DND state expires.
4978
+ #
4979
+ # 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.
4980
+ # @yield [result, operation] Access the result along with the TransportOperation object
4981
+ # @yieldparam result [::Google::Apps::Chat::V1::Availability]
4982
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
4983
+ #
4984
+ # @return [::Google::Apps::Chat::V1::Availability]
4985
+ #
4986
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
4987
+ #
4988
+ # @example Basic example
4989
+ # require "google/apps/chat/v1"
4990
+ #
4991
+ # # Create a client object. The client can be reused for multiple calls.
4992
+ # client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
4993
+ #
4994
+ # # Create a request. To set request fields, pass in keyword arguments.
4995
+ # request = Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest.new
4996
+ #
4997
+ # # Call the mark_as_do_not_disturb method.
4998
+ # result = client.mark_as_do_not_disturb request
4999
+ #
5000
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
5001
+ # p result
5002
+ #
5003
+ def mark_as_do_not_disturb request, options = nil
5004
+ raise ::ArgumentError, "request must be provided" if request.nil?
5005
+
5006
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::MarkAsDoNotDisturbRequest
5007
+
5008
+ # Converts hash and nil to an options object
5009
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
5010
+
5011
+ # Customize the options with defaults
5012
+ call_metadata = @config.rpcs.mark_as_do_not_disturb.metadata.to_h
5013
+
5014
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
5015
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
5016
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
5017
+ gapic_version: ::Google::Apps::Chat::V1::VERSION,
5018
+ transports_version_send: [:rest]
5019
+
5020
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
5021
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
5022
+
5023
+ options.apply_defaults timeout: @config.rpcs.mark_as_do_not_disturb.timeout,
5024
+ metadata: call_metadata,
5025
+ retry_policy: @config.rpcs.mark_as_do_not_disturb.retry_policy
5026
+
5027
+ options.apply_defaults timeout: @config.timeout,
5028
+ metadata: @config.metadata,
5029
+ retry_policy: @config.retry_policy
5030
+
5031
+ @chat_service_stub.mark_as_do_not_disturb request, options do |result, operation|
5032
+ yield result, operation if block_given?
5033
+ end
5034
+ rescue ::Gapic::Rest::Error => e
5035
+ raise ::Google::Cloud::Error.from_error(e)
5036
+ end
5037
+
5038
+ ##
5039
+ # Updates availability information for a human user. Only the `custom_status`
5040
+ # field can be updated through this method.
5041
+ #
5042
+ # This method only updates the authenticated user's availability.
5043
+ #
5044
+ # Requires [user
5045
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
5046
+ # with one of the following [authorization
5047
+ # scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
5048
+ #
5049
+ # - `https://www.googleapis.com/auth/chat.users.availability`
5050
+ #
5051
+ # @overload update_availability(request, options = nil)
5052
+ # Pass arguments to `update_availability` via a request object, either of type
5053
+ # {::Google::Apps::Chat::V1::UpdateAvailabilityRequest} or an equivalent Hash.
5054
+ #
5055
+ # @param request [::Google::Apps::Chat::V1::UpdateAvailabilityRequest, ::Hash]
5056
+ # A request object representing the call parameters. Required. To specify no
5057
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
5058
+ # @param options [::Gapic::CallOptions, ::Hash]
5059
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
5060
+ #
5061
+ # @overload update_availability(availability: nil, update_mask: nil)
5062
+ # Pass arguments to `update_availability` via keyword arguments. Note that at
5063
+ # least one keyword argument is required. To specify no parameters, or to keep all
5064
+ # the default parameter values, pass an empty Hash as a request object (see above).
5065
+ #
5066
+ # @param availability [::Google::Apps::Chat::V1::Availability, ::Hash]
5067
+ # Required. The availability to update.
5068
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
5069
+ # Required. The list of fields to update.
5070
+ # The only field that can be updated is `custom_status`.
5071
+ # @yield [result, operation] Access the result along with the TransportOperation object
5072
+ # @yieldparam result [::Google::Apps::Chat::V1::Availability]
5073
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
5074
+ #
5075
+ # @return [::Google::Apps::Chat::V1::Availability]
5076
+ #
5077
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
5078
+ #
5079
+ # @example Basic example
5080
+ # require "google/apps/chat/v1"
5081
+ #
5082
+ # # Create a client object. The client can be reused for multiple calls.
5083
+ # client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
5084
+ #
5085
+ # # Create a request. To set request fields, pass in keyword arguments.
5086
+ # request = Google::Apps::Chat::V1::UpdateAvailabilityRequest.new
5087
+ #
5088
+ # # Call the update_availability method.
5089
+ # result = client.update_availability request
5090
+ #
5091
+ # # The returned object is of type Google::Apps::Chat::V1::Availability.
5092
+ # p result
5093
+ #
5094
+ def update_availability request, options = nil
5095
+ raise ::ArgumentError, "request must be provided" if request.nil?
5096
+
5097
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateAvailabilityRequest
5098
+
5099
+ # Converts hash and nil to an options object
5100
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
5101
+
5102
+ # Customize the options with defaults
5103
+ call_metadata = @config.rpcs.update_availability.metadata.to_h
5104
+
5105
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
5106
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
5107
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
5108
+ gapic_version: ::Google::Apps::Chat::V1::VERSION,
5109
+ transports_version_send: [:rest]
5110
+
5111
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
5112
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
5113
+
5114
+ options.apply_defaults timeout: @config.rpcs.update_availability.timeout,
5115
+ metadata: call_metadata,
5116
+ retry_policy: @config.rpcs.update_availability.retry_policy
5117
+
5118
+ options.apply_defaults timeout: @config.timeout,
5119
+ metadata: @config.metadata,
5120
+ retry_policy: @config.retry_policy
5121
+
5122
+ @chat_service_stub.update_availability request, options do |result, operation|
5123
+ yield result, operation if block_given?
5124
+ end
5125
+ rescue ::Gapic::Rest::Error => e
5126
+ raise ::Google::Cloud::Error.from_error(e)
5127
+ end
5128
+
4585
5129
  ##
4586
5130
  # Returns an event from a Google Chat space. The [event
4587
5131
  # payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload)
@@ -6120,6 +6664,31 @@ module Google
6120
6664
  #
6121
6665
  attr_reader :get_thread_read_state
6122
6666
  ##
6667
+ # RPC-specific configuration for `get_availability`
6668
+ # @return [::Gapic::Config::Method]
6669
+ #
6670
+ attr_reader :get_availability
6671
+ ##
6672
+ # RPC-specific configuration for `mark_as_active`
6673
+ # @return [::Gapic::Config::Method]
6674
+ #
6675
+ attr_reader :mark_as_active
6676
+ ##
6677
+ # RPC-specific configuration for `mark_as_away`
6678
+ # @return [::Gapic::Config::Method]
6679
+ #
6680
+ attr_reader :mark_as_away
6681
+ ##
6682
+ # RPC-specific configuration for `mark_as_do_not_disturb`
6683
+ # @return [::Gapic::Config::Method]
6684
+ #
6685
+ attr_reader :mark_as_do_not_disturb
6686
+ ##
6687
+ # RPC-specific configuration for `update_availability`
6688
+ # @return [::Gapic::Config::Method]
6689
+ #
6690
+ attr_reader :update_availability
6691
+ ##
6123
6692
  # RPC-specific configuration for `get_space_event`
6124
6693
  # @return [::Gapic::Config::Method]
6125
6694
  #
@@ -6241,6 +6810,16 @@ module Google
6241
6810
  @update_space_read_state = ::Gapic::Config::Method.new update_space_read_state_config
6242
6811
  get_thread_read_state_config = parent_rpcs.get_thread_read_state if parent_rpcs.respond_to? :get_thread_read_state
6243
6812
  @get_thread_read_state = ::Gapic::Config::Method.new get_thread_read_state_config
6813
+ get_availability_config = parent_rpcs.get_availability if parent_rpcs.respond_to? :get_availability
6814
+ @get_availability = ::Gapic::Config::Method.new get_availability_config
6815
+ mark_as_active_config = parent_rpcs.mark_as_active if parent_rpcs.respond_to? :mark_as_active
6816
+ @mark_as_active = ::Gapic::Config::Method.new mark_as_active_config
6817
+ mark_as_away_config = parent_rpcs.mark_as_away if parent_rpcs.respond_to? :mark_as_away
6818
+ @mark_as_away = ::Gapic::Config::Method.new mark_as_away_config
6819
+ mark_as_do_not_disturb_config = parent_rpcs.mark_as_do_not_disturb if parent_rpcs.respond_to? :mark_as_do_not_disturb
6820
+ @mark_as_do_not_disturb = ::Gapic::Config::Method.new mark_as_do_not_disturb_config
6821
+ update_availability_config = parent_rpcs.update_availability if parent_rpcs.respond_to? :update_availability
6822
+ @update_availability = ::Gapic::Config::Method.new update_availability_config
6244
6823
  get_space_event_config = parent_rpcs.get_space_event if parent_rpcs.respond_to? :get_space_event
6245
6824
  @get_space_event = ::Gapic::Config::Method.new get_space_event_config
6246
6825
  list_space_events_config = parent_rpcs.list_space_events if parent_rpcs.respond_to? :list_space_events