Class: Google::Apis::KeepV1::KeepService

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

Overview

Google Keep API

The Google Keep API is used in an enterprise environment to manage Google Keep content and resolve issues identified by cloud security software.

Examples:

require 'google/apis/keep_v1'

Keep = Google::Apis::KeepV1 # Alias the module
service = Keep::KeepService.new

See Also:

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKeepService

Returns a new instance of KeepService.



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

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-keep_v1',
        client_version: Google::Apis::KeepV1::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/keep_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/keep_v1/service.rb', line 46

def quota_user
  @quota_user
end

Instance Method Details

#batch_create_permissions(parent, batch_create_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::KeepV1::BatchCreatePermissionsResponse

Creates one or more permissions on the note. Only permissions with the WRITER role may be created. If adding any permission fails, then the entire request fails and no changes are made.

Parameters:

  • parent (String)

    The parent resource shared by all Permissions being created. Format: notes/ note`` If this is set, the parent field in the CreatePermission messages must either be empty or match this field.

  • batch_create_permissions_request_object (Google::Apis::KeepV1::BatchCreatePermissionsRequest) (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



263
264
265
266
267
268
269
270
271
272
273
# File 'lib/google/apis/keep_v1/service.rb', line 263

def batch_create_permissions(parent, batch_create_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/permissions:batchCreate', options)
  command.request_representation = Google::Apis::KeepV1::BatchCreatePermissionsRequest::Representation
  command.request_object = batch_create_permissions_request_object
  command.response_representation = Google::Apis::KeepV1::BatchCreatePermissionsResponse::Representation
  command.response_class = Google::Apis::KeepV1::BatchCreatePermissionsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_delete_permissions(parent, batch_delete_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::KeepV1::Empty

Deletes one or more permissions on the note. The specified entities will immediately lose access. A permission with the OWNER role can't be removed. If removing a permission fails, then the entire request fails and no changes are made. Returns a 400 bad request error if a specified permission does not exist on the note.

Parameters:

  • parent (String)

    The parent resource shared by all permissions being deleted. Format: notes/ note`` If this is set, the parent of all of the permissions specified in the DeletePermissionRequest messages must match this field.

  • batch_delete_permissions_request_object (Google::Apis::KeepV1::BatchDeletePermissionsRequest) (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



302
303
304
305
306
307
308
309
310
311
312
# File 'lib/google/apis/keep_v1/service.rb', line 302

def batch_delete_permissions(parent, batch_delete_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/permissions:batchDelete', options)
  command.request_representation = Google::Apis::KeepV1::BatchDeletePermissionsRequest::Representation
  command.request_object = batch_delete_permissions_request_object
  command.response_representation = Google::Apis::KeepV1::Empty::Representation
  command.response_class = Google::Apis::KeepV1::Empty
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_note(note_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::KeepV1::Note

Creates a new note.

Parameters:

  • note_object (Google::Apis::KeepV1::Note) (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



118
119
120
121
122
123
124
125
126
127
# File 'lib/google/apis/keep_v1/service.rb', line 118

def create_note(note_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/notes', options)
  command.request_representation = Google::Apis::KeepV1::Note::Representation
  command.request_object = note_object
  command.response_representation = Google::Apis::KeepV1::Note::Representation
  command.response_class = Google::Apis::KeepV1::Note
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_note(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::KeepV1::Empty

Deletes a note. Caller must have the OWNER role on the note to delete. Deleting a note removes the resource immediately and cannot be undone. Any collaborators will lose access to the note.

Parameters:

  • name (String)

    Required. Name of the note to delete.

  • 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



151
152
153
154
155
156
157
158
159
# File 'lib/google/apis/keep_v1/service.rb', line 151

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

#download_medium(name, mime_type: nil, fields: nil, quota_user: nil, download_dest: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::KeepV1::Attachment

Gets an attachment. To download attachment media via REST requires the alt= media query parameter. Returns a 400 bad request error if attachment media is not available in the requested MIME type.

Parameters:

  • name (String)

    Required. The name of the attachment.

  • mime_type (String) (defaults to: nil)

    The IANA MIME type format requested. The requested MIME type must be one specified in the attachment.mime_type. Required when downloading attachment media and ignored otherwise.

  • 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.

  • download_dest (IO, String) (defaults to: nil)

    IO stream or filename to receive content download

  • 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



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/google/apis/keep_v1/service.rb', line 83

def download_medium(name, mime_type: nil, fields: nil, quota_user: nil, download_dest: nil, options: nil, &block)
  if download_dest.nil?
    command = make_simple_command(:get, 'v1/{+name}', options)
  else
    command = make_download_command(:get, 'v1/{+name}', options)
    command.download_dest = download_dest
  end
  command.response_representation = Google::Apis::KeepV1::Attachment::Representation
  command.response_class = Google::Apis::KeepV1::Attachment
  command.params['name'] = name unless name.nil?
  command.query['mimeType'] = mime_type unless mime_type.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_note(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::KeepV1::Note

Gets a note.

Parameters:

  • name (String)

    Required. Name of the 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



181
182
183
184
185
186
187
188
189
# File 'lib/google/apis/keep_v1/service.rb', line 181

def get_note(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::KeepV1::Note::Representation
  command.response_class = Google::Apis::KeepV1::Note
  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_notes(filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::KeepV1::ListNotesResponse

Lists notes. Every list call returns a page of results with page_size as the upper bound of returned items. A page_size of zero allows the server to choose the upper bound. The ListNotesResponse contains at most page_size entries. If there are more things left to list, it provides a next_page_token value. (Page tokens are opaque values.) To get the next page of results, copy the result's next_page_token into the next request's page_token. Repeat until the next_page_token returned with a page of results is empty. ListNotes return consistent results in the face of concurrent changes, or signals that it cannot with an ABORTED error.

Parameters:

  • filter (String) (defaults to: nil)

    Filter for list results. If no filter is supplied, the trashed filter is applied by default. Valid fields to filter by are: create_time, update_time , trash_time, and trashed. Filter syntax follows the Google AIP filtering spec.

  • page_size (Fixnum) (defaults to: nil)

    The maximum number of results to return.

  • page_token (String) (defaults to: nil)

    The previous page's next_page_token field.

  • 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



226
227
228
229
230
231
232
233
234
235
236
# File 'lib/google/apis/keep_v1/service.rb', line 226

def list_notes(filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/notes', options)
  command.response_representation = Google::Apis::KeepV1::ListNotesResponse::Representation
  command.response_class = Google::Apis::KeepV1::ListNotesResponse
  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