Class: Google::Apis::WorkspaceeventsV1::WorkspaceEventsService

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

Overview

Google Workspace Events API

The Google Workspace Events API lets you subscribe to events and manage change notifications across Google Workspace applications.

Examples:

require 'google/apis/workspaceevents_v1'

Workspaceevents = Google::Apis::WorkspaceeventsV1 # Alias the module
service = Workspaceevents::WorkspaceEventsService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://workspaceevents.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWorkspaceEventsService

Returns a new instance of WorkspaceEventsService.



48
49
50
51
52
53
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 48

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-workspaceevents_v1',
        client_version: Google::Apis::WorkspaceeventsV1::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



41
42
43
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 41

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



46
47
48
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 46

def quota_user
  @quota_user
end

Instance Method Details

#create_subscription(subscription_object = nil, validate_only: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WorkspaceeventsV1::Operation

Developer Preview: Creates a Google Workspace subscription. To learn how to use this method, see Create a Google Workspace subscription.

Parameters:

  • subscription_object (Google::Apis::WorkspaceeventsV1::Subscription) (defaults to: nil)
  • validate_only (Boolean) (defaults to: nil)

    Optional. If set to true, validates and previews the request, but doesn't create the subscription.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

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

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 111

def create_subscription(subscription_object = nil, validate_only: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/subscriptions', options)
  command.request_representation = Google::Apis::WorkspaceeventsV1::Subscription::Representation
  command.request_object = subscription_object
  command.response_representation = Google::Apis::WorkspaceeventsV1::Operation::Representation
  command.response_class = Google::Apis::WorkspaceeventsV1::Operation
  command.query['validateOnly'] = validate_only unless validate_only.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_subscription(name, allow_missing: nil, etag: nil, validate_only: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WorkspaceeventsV1::Operation

Developer Preview: Deletes a Google Workspace subscription. To learn how to use this method, see Delete a Google Workspace subscription.

Parameters:

  • name (String)

    Required. Resource name of the subscription to delete. Format: subscriptions/ subscription``

  • allow_missing (Boolean) (defaults to: nil)

    Optional. If set to true and the subscription isn't found, the request succeeds but doesn't delete the subscription.

  • etag (String) (defaults to: nil)

    Optional. Etag of the subscription. If present, it must match with the server' s etag. Otherwise, request fails with the status ABORTED.

  • validate_only (Boolean) (defaults to: nil)

    Optional. If set to true, validates and previews the request, but doesn't delete the subscription.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

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

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 156

def delete_subscription(name, allow_missing: nil, etag: nil, validate_only: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v1/{+name}', options)
  command.response_representation = Google::Apis::WorkspaceeventsV1::Operation::Representation
  command.response_class = Google::Apis::WorkspaceeventsV1::Operation
  command.params['name'] = name unless name.nil?
  command.query['allowMissing'] = allow_missing unless allow_missing.nil?
  command.query['etag'] = etag unless etag.nil?
  command.query['validateOnly'] = validate_only unless validate_only.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_operation(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WorkspaceeventsV1::Operation

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters:

  • name (String)

    The name of the operation resource.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

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

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



76
77
78
79
80
81
82
83
84
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 76

def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::WorkspaceeventsV1::Operation::Representation
  command.response_class = Google::Apis::WorkspaceeventsV1::Operation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_subscription(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WorkspaceeventsV1::Subscription

Developer Preview: Gets details about a Google Workspace subscription. To learn how to use this method, see Get details about a Google Workspace subscription.

Parameters:

  • name (String)

    Required. Resource name of the subscription. Format: subscriptions/ subscription``

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

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

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



193
194
195
196
197
198
199
200
201
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 193

def get_subscription(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::WorkspaceeventsV1::Subscription::Representation
  command.response_class = Google::Apis::WorkspaceeventsV1::Subscription
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_subscriptions(filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WorkspaceeventsV1::ListSubscriptionsResponse

Developer Preview: Lists Google Workspace subscriptions. To learn how to use this method, see List Google Workspace subscriptions.

Parameters:

  • filter (String) (defaults to: nil)

    Required. A query filter. You can filter subscriptions by event type ( event_types) and target resource (target_resource). You must specify at least one event type in your query. To filter for multiple event types, use the OR operator. To filter by both event type and target resource, use the AND operator and specify the full resource name, such as //chat.googleapis. com/spaces/space. For example, the following queries are valid: event_types:"google.workspace.chat.membership.v1.updated" OR event_types:" google.workspace.chat.message.v1.created" event_types:"google.workspace.chat. message.v1.created" AND target_resource="//chat.googleapis.com/spaces/space" ( event_types:"google.workspace.chat.membership.v1.updated" OR event_types:" google.workspace.chat.message.v1.created" ) AND target_resource="//chat. googleapis.com/spaces/space"`The server rejects invalid queries with an INVALID_ARGUMENT` error.

  • page_size (Fixnum) (defaults to: nil)

    Optional. The maximum number of subscriptions to return. The service might return fewer than this value. If unspecified or set to 0, up to 50 subscriptions are returned. The maximum value is 100. If you specify a value more than 100, the system only returns 100 subscriptions.

  • page_token (String) (defaults to: nil)

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

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

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

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



248
249
250
251
252
253
254
255
256
257
258
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 248

def list_subscriptions(filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/subscriptions', options)
  command.response_representation = Google::Apis::WorkspaceeventsV1::ListSubscriptionsResponse::Representation
  command.response_class = Google::Apis::WorkspaceeventsV1::ListSubscriptionsResponse
  command.query['filter'] = filter unless filter.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#patch_subscription(name, subscription_object = nil, update_mask: nil, validate_only: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WorkspaceeventsV1::Operation

Developer Preview: Updates or renews a Google Workspace subscription. To learn how to use this method, see Update or renew a Google Workspace subscription.

Parameters:

  • name (String)

    Identifier. Resource name of the subscription. Format: subscriptions/ subscription``

  • subscription_object (Google::Apis::WorkspaceeventsV1::Subscription) (defaults to: nil)
  • update_mask (String) (defaults to: nil)

    Optional. The field to update. If omitted, updates any fields included in the request. You can update one of the following fields in a subscription: * expire_time: The timestamp when the subscription expires. * ttl: The time- to-live (TTL) or duration of the subscription. * event_types: The list of event types to receive about the target resource. To fully replace the subscription (the equivalent of PUT), use *. Any omitted fields are updated with empty values.

  • validate_only (Boolean) (defaults to: nil)

    Optional. If set to true, validates and previews the request, but doesn't update the subscription.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

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

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 296

def patch_subscription(name, subscription_object = nil, update_mask: nil, validate_only: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v1/{+name}', options)
  command.request_representation = Google::Apis::WorkspaceeventsV1::Subscription::Representation
  command.request_object = subscription_object
  command.response_representation = Google::Apis::WorkspaceeventsV1::Operation::Representation
  command.response_class = Google::Apis::WorkspaceeventsV1::Operation
  command.params['name'] = name unless name.nil?
  command.query['updateMask'] = update_mask unless update_mask.nil?
  command.query['validateOnly'] = validate_only unless validate_only.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#reactivate_subscription(name, reactivate_subscription_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WorkspaceeventsV1::Operation

Developer Preview: Reactivates a suspended Google Workspace subscription. This method resets your subscription's State field to ACTIVE. Before you use this method, you must fix the error that suspended the subscription. This method will ignore or reject any subscription that isn't currently in a suspended state. To learn how to use this method, see Reactivate a Google Workspace subscription.

Parameters:

  • name (String)

    Required. Resource name of the subscription. Format: subscriptions/ subscription``

  • reactivate_subscription_request_object (Google::Apis::WorkspaceeventsV1::ReactivateSubscriptionRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

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

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

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

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



338
339
340
341
342
343
344
345
346
347
348
# File 'lib/google/apis/workspaceevents_v1/service.rb', line 338

def reactivate_subscription(name, reactivate_subscription_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:reactivate', options)
  command.request_representation = Google::Apis::WorkspaceeventsV1::ReactivateSubscriptionRequest::Representation
  command.request_object = reactivate_subscription_request_object
  command.response_representation = Google::Apis::WorkspaceeventsV1::Operation::Representation
  command.response_class = Google::Apis::WorkspaceeventsV1::Operation
  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