google-apps-chat-v1 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 877eaa8f938142f7f76400b54a2d444e7064e354b2388a24839961883c45fd38
4
- data.tar.gz: acc91917f940187c18df84e4fb35c5fd4cee8ddae1991ed9a42f7f4378ecd0d2
3
+ metadata.gz: 30299bb3cedf11bc28e17fed1d365308fea395089edd0126622b1c08bab7a818
4
+ data.tar.gz: 906891e727e014312545208d2834fa9c212992635a924e971d800fe488aed2ac
5
5
  SHA512:
6
- metadata.gz: 92038d4b5cdd579f9a8e8e7fe893b807702cea0953e2cc1e1cea0aa65e254e517eef398773ba03447af625a1d7a588f5ffa5e3445d0481739ec186a4ec8a00d8
7
- data.tar.gz: 7fd2e7b15f5be710d7af4baceb486b9fb14e90703856b2a736c8238b971d837574cf530656997a227667471faa466b01d6079858143dde512ae9bab451ad8696
6
+ metadata.gz: cd0e8bb14d79e1d22e9956bcac71a96e895a5cf4fe8b2eb4d39ed6b931a7bb4611ae40631f8bc63b75c4ebc6ce89cdaedde89c7d17d74fff5250751f8737ebb8
7
+ data.tar.gz: f548ae402b40405ae48b378c2e6f81dbcc780702cde3ce7bf3ea5779ff6bec3e9cc1a83dc9f8de8bff07dc9db32745e7ed5e9f7ceb6374bf95c5cd61b6fa39e7
@@ -201,6 +201,16 @@ module Google
201
201
  initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
202
202
  }
203
203
 
204
+ default_config.rpcs.get_space_event.timeout = 30.0
205
+ default_config.rpcs.get_space_event.retry_policy = {
206
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
207
+ }
208
+
209
+ default_config.rpcs.list_space_events.timeout = 30.0
210
+ default_config.rpcs.list_space_events.retry_policy = {
211
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
212
+ }
213
+
204
214
  default_config
205
215
  end
206
216
  yield @configure if block_given?
@@ -3402,6 +3412,280 @@ module Google
3402
3412
  raise ::Google::Cloud::Error.from_error(e)
3403
3413
  end
3404
3414
 
3415
+ ##
3416
+ # Returns an event from a Google Chat space. The [event
3417
+ # payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload)
3418
+ # contains the most recent version of the resource that changed. For example,
3419
+ # if you request an event about a new message but the message was later
3420
+ # updated, the server returns the updated `Message` resource in the event
3421
+ # payload.
3422
+ #
3423
+ # Requires [user
3424
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
3425
+ # To get an event, the authenticated user must be a member of the space.
3426
+ #
3427
+ # For an example, see [Get details about an
3428
+ # event from a Google Chat
3429
+ # space](https://developers.google.com/workspace/chat/get-space-event).
3430
+ #
3431
+ # @overload get_space_event(request, options = nil)
3432
+ # Pass arguments to `get_space_event` via a request object, either of type
3433
+ # {::Google::Apps::Chat::V1::GetSpaceEventRequest} or an equivalent Hash.
3434
+ #
3435
+ # @param request [::Google::Apps::Chat::V1::GetSpaceEventRequest, ::Hash]
3436
+ # A request object representing the call parameters. Required. To specify no
3437
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3438
+ # @param options [::Gapic::CallOptions, ::Hash]
3439
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3440
+ #
3441
+ # @overload get_space_event(name: nil)
3442
+ # Pass arguments to `get_space_event` via keyword arguments. Note that at
3443
+ # least one keyword argument is required. To specify no parameters, or to keep all
3444
+ # the default parameter values, pass an empty Hash as a request object (see above).
3445
+ #
3446
+ # @param name [::String]
3447
+ # Required. The resource name of the space event.
3448
+ #
3449
+ # Format: `spaces/{space}/spaceEvents/{spaceEvent}`
3450
+ #
3451
+ # @yield [response, operation] Access the result along with the RPC operation
3452
+ # @yieldparam response [::Google::Apps::Chat::V1::SpaceEvent]
3453
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3454
+ #
3455
+ # @return [::Google::Apps::Chat::V1::SpaceEvent]
3456
+ #
3457
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3458
+ #
3459
+ # @example Basic example
3460
+ # require "google/apps/chat/v1"
3461
+ #
3462
+ # # Create a client object. The client can be reused for multiple calls.
3463
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
3464
+ #
3465
+ # # Create a request. To set request fields, pass in keyword arguments.
3466
+ # request = Google::Apps::Chat::V1::GetSpaceEventRequest.new
3467
+ #
3468
+ # # Call the get_space_event method.
3469
+ # result = client.get_space_event request
3470
+ #
3471
+ # # The returned object is of type Google::Apps::Chat::V1::SpaceEvent.
3472
+ # p result
3473
+ #
3474
+ def get_space_event request, options = nil
3475
+ raise ::ArgumentError, "request must be provided" if request.nil?
3476
+
3477
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceEventRequest
3478
+
3479
+ # Converts hash and nil to an options object
3480
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3481
+
3482
+ # Customize the options with defaults
3483
+ metadata = @config.rpcs.get_space_event.metadata.to_h
3484
+
3485
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3486
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3487
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3488
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
3489
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3490
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3491
+
3492
+ header_params = {}
3493
+ if request.name
3494
+ header_params["name"] = request.name
3495
+ end
3496
+
3497
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3498
+ metadata[:"x-goog-request-params"] ||= request_params_header
3499
+
3500
+ options.apply_defaults timeout: @config.rpcs.get_space_event.timeout,
3501
+ metadata: metadata,
3502
+ retry_policy: @config.rpcs.get_space_event.retry_policy
3503
+
3504
+ options.apply_defaults timeout: @config.timeout,
3505
+ metadata: @config.metadata,
3506
+ retry_policy: @config.retry_policy
3507
+
3508
+ @chat_service_stub.call_rpc :get_space_event, request, options: options do |response, operation|
3509
+ yield response, operation if block_given?
3510
+ return response
3511
+ end
3512
+ rescue ::GRPC::BadStatus => e
3513
+ raise ::Google::Cloud::Error.from_error(e)
3514
+ end
3515
+
3516
+ ##
3517
+ # Lists events from a Google Chat space. For each event, the
3518
+ # [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload)
3519
+ # contains the most recent version of the Chat resource. For example, if you
3520
+ # list events about new space members, the server returns `Membership`
3521
+ # resources that contain the latest membership details. If new members were
3522
+ # removed during the requested period, the event payload contains an empty
3523
+ # `Membership` resource.
3524
+ #
3525
+ # Requires [user
3526
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
3527
+ # To list events, the authenticated user must be a member of the space.
3528
+ #
3529
+ # For an example, see [List events from a Google Chat
3530
+ # space](https://developers.google.com/workspace/chat/list-space-events).
3531
+ #
3532
+ # @overload list_space_events(request, options = nil)
3533
+ # Pass arguments to `list_space_events` via a request object, either of type
3534
+ # {::Google::Apps::Chat::V1::ListSpaceEventsRequest} or an equivalent Hash.
3535
+ #
3536
+ # @param request [::Google::Apps::Chat::V1::ListSpaceEventsRequest, ::Hash]
3537
+ # A request object representing the call parameters. Required. To specify no
3538
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3539
+ # @param options [::Gapic::CallOptions, ::Hash]
3540
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3541
+ #
3542
+ # @overload list_space_events(parent: nil, page_size: nil, page_token: nil, filter: nil)
3543
+ # Pass arguments to `list_space_events` via keyword arguments. Note that at
3544
+ # least one keyword argument is required. To specify no parameters, or to keep all
3545
+ # the default parameter values, pass an empty Hash as a request object (see above).
3546
+ #
3547
+ # @param parent [::String]
3548
+ # Required. Resource name of the [Google Chat
3549
+ # space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces)
3550
+ # where the events occurred.
3551
+ #
3552
+ # Format: `spaces/{space}`.
3553
+ # @param page_size [::Integer]
3554
+ # Optional. The maximum number of space events returned. The service might
3555
+ # return fewer than this value.
3556
+ #
3557
+ # Negative values return an `INVALID_ARGUMENT` error.
3558
+ # @param page_token [::String]
3559
+ # A page token, received from a previous list space events call. Provide this
3560
+ # to retrieve the subsequent page.
3561
+ #
3562
+ # When paginating, all other parameters provided to list space events must
3563
+ # match the call that provided the page token. Passing different values to
3564
+ # the other parameters might lead to unexpected results.
3565
+ # @param filter [::String]
3566
+ # Required. A query filter.
3567
+ #
3568
+ # You must specify at least one event type (`event_type`)
3569
+ # using the has `:` operator. To filter by multiple event types, use the `OR`
3570
+ # operator. Omit batch event types in your filter. The request automatically
3571
+ # returns any related batch events. For example, if you filter by new
3572
+ # reactions
3573
+ # (`google.workspace.chat.reaction.v1.created`), the server also returns
3574
+ # batch new reactions events
3575
+ # (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported
3576
+ # event types, see the [`SpaceEvents` reference
3577
+ # documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type).
3578
+ #
3579
+ # Optionally, you can also filter by start time (`start_time`) and
3580
+ # end time (`end_time`):
3581
+ #
3582
+ # * `start_time`: Exclusive timestamp from which to start listing space
3583
+ # events.
3584
+ # You can list events that occurred up to 28 days ago. If unspecified, lists
3585
+ # space events from the past 28 days.
3586
+ # * `end_time`: Inclusive timestamp until which space events are listed.
3587
+ # If unspecified, lists events up to the time of the request.
3588
+ #
3589
+ # To specify a start or end time, use the equals `=` operator and format in
3590
+ # [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both
3591
+ # `start_time` and `end_time`, use the `AND` operator.
3592
+ #
3593
+ # For example, the following queries are valid:
3594
+ #
3595
+ # ```
3596
+ # start_time="2023-08-23T19:20:33+00:00" AND
3597
+ # end_time="2023-08-23T19:21:54+00:00"
3598
+ # ```
3599
+ # ```
3600
+ # start_time="2023-08-23T19:20:33+00:00" AND
3601
+ # (event_types:"google.workspace.chat.space.v1.updated" OR
3602
+ # event_types:"google.workspace.chat.message.v1.created")
3603
+ # ```
3604
+ #
3605
+ # The following queries are invalid:
3606
+ #
3607
+ # ```
3608
+ # start_time="2023-08-23T19:20:33+00:00" OR
3609
+ # end_time="2023-08-23T19:21:54+00:00"
3610
+ # ```
3611
+ # ```
3612
+ # event_types:"google.workspace.chat.space.v1.updated" AND
3613
+ # event_types:"google.workspace.chat.message.v1.created"
3614
+ # ```
3615
+ #
3616
+ # Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
3617
+ # error.
3618
+ #
3619
+ # @yield [response, operation] Access the result along with the RPC operation
3620
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::SpaceEvent>]
3621
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3622
+ #
3623
+ # @return [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::SpaceEvent>]
3624
+ #
3625
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3626
+ #
3627
+ # @example Basic example
3628
+ # require "google/apps/chat/v1"
3629
+ #
3630
+ # # Create a client object. The client can be reused for multiple calls.
3631
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
3632
+ #
3633
+ # # Create a request. To set request fields, pass in keyword arguments.
3634
+ # request = Google::Apps::Chat::V1::ListSpaceEventsRequest.new
3635
+ #
3636
+ # # Call the list_space_events method.
3637
+ # result = client.list_space_events request
3638
+ #
3639
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
3640
+ # # over elements, and API calls will be issued to fetch pages as needed.
3641
+ # result.each do |item|
3642
+ # # Each element is of type ::Google::Apps::Chat::V1::SpaceEvent.
3643
+ # p item
3644
+ # end
3645
+ #
3646
+ def list_space_events request, options = nil
3647
+ raise ::ArgumentError, "request must be provided" if request.nil?
3648
+
3649
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListSpaceEventsRequest
3650
+
3651
+ # Converts hash and nil to an options object
3652
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3653
+
3654
+ # Customize the options with defaults
3655
+ metadata = @config.rpcs.list_space_events.metadata.to_h
3656
+
3657
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3658
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3659
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3660
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
3661
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3662
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3663
+
3664
+ header_params = {}
3665
+ if request.parent
3666
+ header_params["parent"] = request.parent
3667
+ end
3668
+
3669
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3670
+ metadata[:"x-goog-request-params"] ||= request_params_header
3671
+
3672
+ options.apply_defaults timeout: @config.rpcs.list_space_events.timeout,
3673
+ metadata: metadata,
3674
+ retry_policy: @config.rpcs.list_space_events.retry_policy
3675
+
3676
+ options.apply_defaults timeout: @config.timeout,
3677
+ metadata: @config.metadata,
3678
+ retry_policy: @config.retry_policy
3679
+
3680
+ @chat_service_stub.call_rpc :list_space_events, request, options: options do |response, operation|
3681
+ response = ::Gapic::PagedEnumerable.new @chat_service_stub, :list_space_events, request, response, operation, options
3682
+ yield response, operation if block_given?
3683
+ return response
3684
+ end
3685
+ rescue ::GRPC::BadStatus => e
3686
+ raise ::Google::Cloud::Error.from_error(e)
3687
+ end
3688
+
3405
3689
  ##
3406
3690
  # Configuration class for the ChatService API.
3407
3691
  #
@@ -3685,6 +3969,16 @@ module Google
3685
3969
  # @return [::Gapic::Config::Method]
3686
3970
  #
3687
3971
  attr_reader :get_thread_read_state
3972
+ ##
3973
+ # RPC-specific configuration for `get_space_event`
3974
+ # @return [::Gapic::Config::Method]
3975
+ #
3976
+ attr_reader :get_space_event
3977
+ ##
3978
+ # RPC-specific configuration for `list_space_events`
3979
+ # @return [::Gapic::Config::Method]
3980
+ #
3981
+ attr_reader :list_space_events
3688
3982
 
3689
3983
  # @private
3690
3984
  def initialize parent_rpcs = nil
@@ -3740,6 +4034,10 @@ module Google
3740
4034
  @update_space_read_state = ::Gapic::Config::Method.new update_space_read_state_config
3741
4035
  get_thread_read_state_config = parent_rpcs.get_thread_read_state if parent_rpcs.respond_to? :get_thread_read_state
3742
4036
  @get_thread_read_state = ::Gapic::Config::Method.new get_thread_read_state_config
4037
+ get_space_event_config = parent_rpcs.get_space_event if parent_rpcs.respond_to? :get_space_event
4038
+ @get_space_event = ::Gapic::Config::Method.new get_space_event_config
4039
+ list_space_events_config = parent_rpcs.list_space_events if parent_rpcs.respond_to? :list_space_events
4040
+ @list_space_events = ::Gapic::Config::Method.new list_space_events_config
3743
4041
 
3744
4042
  yield self if block_given?
3745
4043
  end
@@ -129,6 +129,23 @@ module Google
129
129
  "spaces/#{space}"
130
130
  end
131
131
 
132
+ ##
133
+ # Create a fully-qualified SpaceEvent resource string.
134
+ #
135
+ # The resource will be in the following format:
136
+ #
137
+ # `spaces/{space}/spaceEvents/{space_event}`
138
+ #
139
+ # @param space [String]
140
+ # @param space_event [String]
141
+ #
142
+ # @return [::String]
143
+ def space_event_path space:, space_event:
144
+ raise ::ArgumentError, "space cannot contain /" if space.to_s.include? "/"
145
+
146
+ "spaces/#{space}/spaceEvents/#{space_event}"
147
+ end
148
+
132
149
  ##
133
150
  # Create a fully-qualified SpaceReadState resource string.
134
151
  #