Class: Google::Apis::PhotoslibraryV1::PhotosLibraryService

Inherits:
Core::BaseService show all
Defined in:
generated/google/apis/photoslibrary_v1/service.rb

Overview

Photos Library API

Manage photos, videos, and albums in Google Photos

Examples:

require 'google/apis/photoslibrary_v1'

Photoslibrary = Google::Apis::PhotoslibraryV1 # Alias the module
service = Photoslibrary::PhotosLibraryService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Core::Logging

#logger

Constructor Details

#initializePhotosLibraryService

Returns a new instance of PhotosLibraryService



45
46
47
48
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 45

def initialize
  super('https://photoslibrary.googleapis.com/', '')
  @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.



38
39
40
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 38

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.



43
44
45
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 43

def quota_user
  @quota_user
end

Instance Method Details

#add_enrichment_to_album(album_id, add_enrichment_to_album_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::AddEnrichmentToAlbumResponse

Adds an enrichment to a specified position in a defined album.

Parameters:

  • album_id (String)

    Identifier of the album where the enrichment will be added.

  • add_enrichment_to_album_request_object (Google::Apis::PhotoslibraryV1::AddEnrichmentToAlbumRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



71
72
73
74
75
76
77
78
79
80
81
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 71

def add_enrichment_to_album(album_id, add_enrichment_to_album_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/albums/{+albumId}:addEnrichment', options)
  command.request_representation = Google::Apis::PhotoslibraryV1::AddEnrichmentToAlbumRequest::Representation
  command.request_object = add_enrichment_to_album_request_object
  command.response_representation = Google::Apis::PhotoslibraryV1::AddEnrichmentToAlbumResponse::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::AddEnrichmentToAlbumResponse
  command.params['albumId'] = album_id unless album_id.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_create_media_items(batch_create_media_items_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::BatchCreateMediaItemsResponse

Creates one or more media items in a user's Google Photos library. If an album id is specified, the media item(s) are also added to the album. By default the media item(s) will be added to the end of the library or album. If an album id and position are both defined, then the media items will be added to the album at the specified position. If multiple media items are given, they will be inserted at the specified position.

Parameters:

  • batch_create_media_items_request_object (Google::Apis::PhotoslibraryV1::BatchCreateMediaItemsRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



244
245
246
247
248
249
250
251
252
253
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 244

def batch_create_media_items(batch_create_media_items_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/mediaItems:batchCreate', options)
  command.request_representation = Google::Apis::PhotoslibraryV1::BatchCreateMediaItemsRequest::Representation
  command.request_object = batch_create_media_items_request_object
  command.response_representation = Google::Apis::PhotoslibraryV1::BatchCreateMediaItemsResponse::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::BatchCreateMediaItemsResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_album(create_album_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::Album

Creates an album in a user's Google Photos library.

Parameters:

  • create_album_request_object (Google::Apis::PhotoslibraryV1::CreateAlbumRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



102
103
104
105
106
107
108
109
110
111
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 102

def create_album(create_album_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/albums', options)
  command.request_representation = Google::Apis::PhotoslibraryV1::CreateAlbumRequest::Representation
  command.request_object = create_album_request_object
  command.response_representation = Google::Apis::PhotoslibraryV1::Album::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::Album
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_album(album_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::Album

Returns the album specified by the given album id.

Parameters:

  • album_id (String)

    Identifier of the album to be requested.

  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



133
134
135
136
137
138
139
140
141
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 133

def get_album(album_id, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/albums/{+albumId}', options)
  command.response_representation = Google::Apis::PhotoslibraryV1::Album::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::Album
  command.params['albumId'] = album_id unless album_id.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_media_item(media_item_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::MediaItem

Returns the media item specified based on a given media item id.

Parameters:

  • media_item_id (String)

    Identifier of media item to be requested.

  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



275
276
277
278
279
280
281
282
283
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 275

def get_media_item(media_item_id, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/mediaItems/{+mediaItemId}', options)
  command.response_representation = Google::Apis::PhotoslibraryV1::MediaItem::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::MediaItem
  command.params['mediaItemId'] = media_item_id unless media_item_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#join_shared_album(join_shared_album_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::JoinSharedAlbumResponse

Joins a shared album on behalf of the Google Photos user.

Parameters:

  • join_shared_album_request_object (Google::Apis::PhotoslibraryV1::JoinSharedAlbumRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



341
342
343
344
345
346
347
348
349
350
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 341

def join_shared_album(join_shared_album_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/sharedAlbums:join', options)
  command.request_representation = Google::Apis::PhotoslibraryV1::JoinSharedAlbumRequest::Representation
  command.request_object = join_shared_album_request_object
  command.response_representation = Google::Apis::PhotoslibraryV1::JoinSharedAlbumResponse::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::JoinSharedAlbumResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_albums(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::ListAlbumsResponse

Lists all albums shown to a user in the 'Albums' tab of the Google Photos app.

Parameters:

  • page_size (Fixnum)

    Maximum number of albums to return in the response. The default number of albums to return at a time is 20. The maximum page size is 50.

  • page_token (String)

    A continuation token to get the next page of the results. Adding this to the request will return the rows after the pageToken. The pageToken should be the value returned in the nextPageToken parameter in the response to the listAlbums request.

  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



170
171
172
173
174
175
176
177
178
179
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 170

def list_albums(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/albums', options)
  command.response_representation = Google::Apis::PhotoslibraryV1::ListAlbumsResponse::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::ListAlbumsResponse
  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

#list_shared_albums(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::ListSharedAlbumsResponse

Lists all shared albums shown to a user in the 'Sharing' tab of the Google Photos app.

Parameters:

  • page_size (Fixnum)

    Maximum number of albums to return in the response. The default number of albums to return at a time is 20. The maximum page size is 50.

  • page_token (String)

    A continuation token to get the next page of the results. Adding this to the request will return the rows after the pageToken. The pageToken should be the value returned in the nextPageToken parameter in the response to the listSharedAlbums request.

  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



379
380
381
382
383
384
385
386
387
388
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 379

def list_shared_albums(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/sharedAlbums', options)
  command.response_representation = Google::Apis::PhotoslibraryV1::ListSharedAlbumsResponse::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::ListSharedAlbumsResponse
  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

#search_media_items(search_media_items_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::SearchMediaItemsResponse

Searches for media items in a user's Google Photos library. If no filters are set, then all media items in the user's library will be returned. If an album is set, all media items in the specified album will be returned. If filters are specified, anything that matches the filters from the user's library will be listed. If an album and filters are set, then this will result in an error.

Parameters:

  • search_media_items_request_object (Google::Apis::PhotoslibraryV1::SearchMediaItemsRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



311
312
313
314
315
316
317
318
319
320
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 311

def search_media_items(search_media_items_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/mediaItems:search', options)
  command.request_representation = Google::Apis::PhotoslibraryV1::SearchMediaItemsRequest::Representation
  command.request_object = search_media_items_request_object
  command.response_representation = Google::Apis::PhotoslibraryV1::SearchMediaItemsResponse::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::SearchMediaItemsResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#share_album(album_id, share_album_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PhotoslibraryV1::ShareAlbumResponse

Marks an album as 'shared' and accessible to other users. This action can only be performed on albums which were created by the developer via the API.

Parameters:

  • album_id (String)

    Identifier of the album to be shared. This album id must belong to an album created by the developer. .

  • share_album_request_object (Google::Apis::PhotoslibraryV1::ShareAlbumRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

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

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



206
207
208
209
210
211
212
213
214
215
216
# File 'generated/google/apis/photoslibrary_v1/service.rb', line 206

def share_album(album_id, share_album_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:post, 'v1/albums/{+albumId}:share', options)
  command.request_representation = Google::Apis::PhotoslibraryV1::ShareAlbumRequest::Representation
  command.request_object = share_album_request_object
  command.response_representation = Google::Apis::PhotoslibraryV1::ShareAlbumResponse::Representation
  command.response_class = Google::Apis::PhotoslibraryV1::ShareAlbumResponse
  command.params['albumId'] = album_id unless album_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end