Class InternalPhotosLibraryClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, java.lang.AutoCloseable
    Direct Known Subclasses:
    PhotosLibraryClient

    @Generated("by gapic-generator-java")
    public class InternalPhotosLibraryClient
    extends java.lang.Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Service which allows developers to perform the following actions on behalf of the user: - upload media items directly to their Google Photos library - create albums - add media items (including album enrichments) to albums - list and download content from their Google Photos library - filter results by media type, date range or content category - create, join, and access shared albums

    This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

    
     try (InternalPhotosLibraryClient internalPhotosLibraryClient =
         InternalPhotosLibraryClient.create()) {
       Album album = Album.newBuilder().build();
       Album response = internalPhotosLibraryClient.createAlbum(album);
     }
     

    Note: close() needs to be called on the InternalPhotosLibraryClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

    The surface of this class includes several types of Java methods for each of the API's methods:

    1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
    2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
    3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

    See the individual methods for example code.

    Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

    This class can be customized by passing in a custom instance of InternalPhotosLibrarySettings to create(). For example:

    To customize credentials:

    
     InternalPhotosLibrarySettings internalPhotosLibrarySettings =
         InternalPhotosLibrarySettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     InternalPhotosLibraryClient internalPhotosLibraryClient =
         InternalPhotosLibraryClient.create(internalPhotosLibrarySettings);
     

    To customize the endpoint:

    
     InternalPhotosLibrarySettings internalPhotosLibrarySettings =
         InternalPhotosLibrarySettings.newBuilder().setEndpoint(myEndpoint).build();
     InternalPhotosLibraryClient internalPhotosLibraryClient =
         InternalPhotosLibraryClient.create(internalPhotosLibrarySettings);
     

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    • Constructor Detail

      • InternalPhotosLibraryClient

        protected InternalPhotosLibraryClient​(InternalPhotosLibrarySettings settings)
                                       throws java.io.IOException
        Constructs an instance of InternalPhotosLibraryClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
        Throws:
        java.io.IOException
      • InternalPhotosLibraryClient

        @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
        protected InternalPhotosLibraryClient​(PhotosLibraryStub stub)
    • Method Detail

      • create

        public static final InternalPhotosLibraryClient create()
                                                        throws java.io.IOException
        Constructs an instance of InternalPhotosLibraryClient with default settings.
        Throws:
        java.io.IOException
      • create

        public static final InternalPhotosLibraryClient create​(InternalPhotosLibrarySettings settings)
                                                        throws java.io.IOException
        Constructs an instance of InternalPhotosLibraryClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
        Throws:
        java.io.IOException
      • create

        @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
        public static final InternalPhotosLibraryClient create​(PhotosLibraryStub stub)
        Constructs an instance of InternalPhotosLibraryClient, using the given stub for making calls. This is for advanced usage - prefer using create(InternalPhotosLibrarySettings).
      • getStub

        @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
        public PhotosLibraryStub getStub()
      • createAlbum

        public final Album createAlbum​(Album album)
        Creates an album in a user's Google Photos library.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           Album album = Album.newBuilder().build();
           Album response = internalPhotosLibraryClient.createAlbum(album);
         }
         
        Parameters:
        album - Required. The album to be created.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createAlbum

        public final Album createAlbum​(CreateAlbumRequest request)
        Creates an album in a user's Google Photos library.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           CreateAlbumRequest request =
               CreateAlbumRequest.newBuilder().setAlbum(Album.newBuilder().build()).build();
           Album response = internalPhotosLibraryClient.createAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateAlbumRequest,​Album> createAlbumCallable()
        Creates an album in a user's Google Photos library.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           CreateAlbumRequest request =
               CreateAlbumRequest.newBuilder().setAlbum(Album.newBuilder().build()).build();
           ApiFuture<Album> future =
               internalPhotosLibraryClient.createAlbumCallable().futureCall(request);
           // Do something.
           Album response = future.get();
         }
         
      • batchCreateMediaItems

        public final BatchCreateMediaItemsResponse batchCreateMediaItems​(java.lang.String albumId,
                                                                         java.util.List<NewMediaItem> newMediaItems,
                                                                         AlbumPosition albumPosition)
        Creates one or more media items in a user's Google Photos library.

        This is the second step for creating a media item. For details regarding Step 1, uploading the raw bytes to a Google Server, see <a href="/photos/library/guides/upload-media">Uploading media</a>.

        This call adds the media item to the library. If an album `id` is specified, the call adds the media item to the album too. Each album can contain up to 20,000 media items. By default, the media item will be added to the end of the library or album.

        If an album `id` and position are both defined, the media item is added to the album at the specified position.

        If the call contains multiple media items, they're added at the specified position. If you are creating a media item in a shared album where you are not the owner, you are not allowed to position the media item. Doing so will result in a `BAD REQUEST` error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           List<NewMediaItem> newMediaItems = new ArrayList<>();
           AlbumPosition albumPosition = AlbumPosition.newBuilder().build();
           BatchCreateMediaItemsResponse response =
               internalPhotosLibraryClient.batchCreateMediaItems(albumId, newMediaItems, albumPosition);
         }
         
        Parameters:
        albumId - Identifier of the album where the media items are added. The media items are also added to the user's library. This is an optional field.
        newMediaItems - Required. List of media items to be created.
        albumPosition - Position in the album where the media items are added. If not specified, the media items are added to the end of the album (as per the default value, that is, `LAST_IN_ALBUM`). The request fails if this field is set and the `albumId` is not specified. The request will also fail if you set the field and are not the owner of the shared album.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchCreateMediaItems

        public final BatchCreateMediaItemsResponse batchCreateMediaItems​(BatchCreateMediaItemsRequest request)
        Creates one or more media items in a user's Google Photos library.

        This is the second step for creating a media item. For details regarding Step 1, uploading the raw bytes to a Google Server, see <a href="/photos/library/guides/upload-media">Uploading media</a>.

        This call adds the media item to the library. If an album `id` is specified, the call adds the media item to the album too. Each album can contain up to 20,000 media items. By default, the media item will be added to the end of the library or album.

        If an album `id` and position are both defined, the media item is added to the album at the specified position.

        If the call contains multiple media items, they're added at the specified position. If you are creating a media item in a shared album where you are not the owner, you are not allowed to position the media item. Doing so will result in a `BAD REQUEST` error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchCreateMediaItemsRequest request =
               BatchCreateMediaItemsRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .addAllNewMediaItems(new ArrayList<NewMediaItem>())
                   .setAlbumPosition(AlbumPosition.newBuilder().build())
                   .build();
           BatchCreateMediaItemsResponse response =
               internalPhotosLibraryClient.batchCreateMediaItems(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchCreateMediaItemsCallable

        public final com.google.api.gax.rpc.UnaryCallable<BatchCreateMediaItemsRequest,​BatchCreateMediaItemsResponse> batchCreateMediaItemsCallable()
        Creates one or more media items in a user's Google Photos library.

        This is the second step for creating a media item. For details regarding Step 1, uploading the raw bytes to a Google Server, see <a href="/photos/library/guides/upload-media">Uploading media</a>.

        This call adds the media item to the library. If an album `id` is specified, the call adds the media item to the album too. Each album can contain up to 20,000 media items. By default, the media item will be added to the end of the library or album.

        If an album `id` and position are both defined, the media item is added to the album at the specified position.

        If the call contains multiple media items, they're added at the specified position. If you are creating a media item in a shared album where you are not the owner, you are not allowed to position the media item. Doing so will result in a `BAD REQUEST` error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchCreateMediaItemsRequest request =
               BatchCreateMediaItemsRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .addAllNewMediaItems(new ArrayList<NewMediaItem>())
                   .setAlbumPosition(AlbumPosition.newBuilder().build())
                   .build();
           ApiFuture<BatchCreateMediaItemsResponse> future =
               internalPhotosLibraryClient.batchCreateMediaItemsCallable().futureCall(request);
           // Do something.
           BatchCreateMediaItemsResponse response = future.get();
         }
         
      • batchAddMediaItemsToAlbum

        public final BatchAddMediaItemsToAlbumResponse batchAddMediaItemsToAlbum​(java.lang.String albumId,
                                                                                 java.util.List<java.lang.String> mediaItemIds)
        Adds one or more media items in a user's Google Photos library to an album. The media items and albums must have been created by the developer via the API.

        Media items are added to the end of the album. If multiple media items are given, they are added in the order specified in this call.

        Each album can contain up to 20,000 media items.

        Only media items that are in the user's library can be added to an album. For albums that are shared, the album must either be owned by the user or the user must have joined the album as a collaborator.

        Partial success is not supported. The entire request will fail if an invalid media item or album is specified.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           List<String> mediaItemIds = new ArrayList<>();
           BatchAddMediaItemsToAlbumResponse response =
               internalPhotosLibraryClient.batchAddMediaItemsToAlbum(albumId, mediaItemIds);
         }
         
        Parameters:
        albumId - Required. Identifier of the [Album][google.photos.types.Album] that the media items are added to.
        mediaItemIds - Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to be added. The maximum number of media items that can be added in one call is 50.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchAddMediaItemsToAlbum

        public final BatchAddMediaItemsToAlbumResponse batchAddMediaItemsToAlbum​(BatchAddMediaItemsToAlbumRequest request)
        Adds one or more media items in a user's Google Photos library to an album. The media items and albums must have been created by the developer via the API.

        Media items are added to the end of the album. If multiple media items are given, they are added in the order specified in this call.

        Each album can contain up to 20,000 media items.

        Only media items that are in the user's library can be added to an album. For albums that are shared, the album must either be owned by the user or the user must have joined the album as a collaborator.

        Partial success is not supported. The entire request will fail if an invalid media item or album is specified.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchAddMediaItemsToAlbumRequest request =
               BatchAddMediaItemsToAlbumRequest.newBuilder()
                   .addAllMediaItemIds(new ArrayList<String>())
                   .setAlbumId("albumId-920410134")
                   .build();
           BatchAddMediaItemsToAlbumResponse response =
               internalPhotosLibraryClient.batchAddMediaItemsToAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchAddMediaItemsToAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<BatchAddMediaItemsToAlbumRequest,​BatchAddMediaItemsToAlbumResponse> batchAddMediaItemsToAlbumCallable()
        Adds one or more media items in a user's Google Photos library to an album. The media items and albums must have been created by the developer via the API.

        Media items are added to the end of the album. If multiple media items are given, they are added in the order specified in this call.

        Each album can contain up to 20,000 media items.

        Only media items that are in the user's library can be added to an album. For albums that are shared, the album must either be owned by the user or the user must have joined the album as a collaborator.

        Partial success is not supported. The entire request will fail if an invalid media item or album is specified.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchAddMediaItemsToAlbumRequest request =
               BatchAddMediaItemsToAlbumRequest.newBuilder()
                   .addAllMediaItemIds(new ArrayList<String>())
                   .setAlbumId("albumId-920410134")
                   .build();
           ApiFuture<BatchAddMediaItemsToAlbumResponse> future =
               internalPhotosLibraryClient.batchAddMediaItemsToAlbumCallable().futureCall(request);
           // Do something.
           BatchAddMediaItemsToAlbumResponse response = future.get();
         }
         
      • searchMediaItems

        public final InternalPhotosLibraryClient.SearchMediaItemsPagedResponse searchMediaItems​(Filters filters)
        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 are returned. If an album is set, all media items in the specified album are returned. If filters are specified, media items that match the filters from the user's library are listed. If you set both the album and the filters, the request results in an error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           Filters filters = Filters.newBuilder().build();
           for (MediaItem element : internalPhotosLibraryClient.searchMediaItems(filters).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        filters - Filters to apply to the request. Can't be set in conjunction with an `albumId`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • searchMediaItems

        public final InternalPhotosLibraryClient.SearchMediaItemsPagedResponse searchMediaItems​(java.lang.String albumId)
        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 are returned. If an album is set, all media items in the specified album are returned. If filters are specified, media items that match the filters from the user's library are listed. If you set both the album and the filters, the request results in an error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           for (MediaItem element : internalPhotosLibraryClient.searchMediaItems(albumId).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        albumId - Identifier of an album. If populated, lists all media items in specified album. Can't set in conjunction with any filters.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • searchMediaItems

        public final InternalPhotosLibraryClient.SearchMediaItemsPagedResponse searchMediaItems​(Filters filters,
                                                                                                java.lang.String orderBy)
        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 are returned. If an album is set, all media items in the specified album are returned. If filters are specified, media items that match the filters from the user's library are listed. If you set both the album and the filters, the request results in an error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           Filters filters = Filters.newBuilder().build();
           String orderBy = "orderBy-1207110587";
           for (MediaItem element :
               internalPhotosLibraryClient.searchMediaItems(filters, orderBy).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        filters - Filters to apply to the request. Can't be set in conjunction with an `albumId`.
        orderBy - An optional field to specify the sort order of the search results. The `orderBy` field only works when a [dateFilter][google.photos.library.v1.DateFilter] is used. When this field is not specified, results are displayed newest first, oldest last by their [creationTime][google.photos.types.MediaMetadata.creation_time]. Providing `MediaMetadata.creation_time` displays search results in the opposite order, oldest first then newest last. To display results newest first then oldest last, include the `desc` argument as follows: `MediaMetadata.creation_time desc`.

        The only additional filters that can be used with this parameter are [includeArchivedMedia][google.photos.library.v1.Filters.include_archived_media] and [excludeNonAppCreatedData][google.photos.library.v1.Filters.exclude_non_app_created_data]. No other filters are supported.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • searchMediaItems

        public final InternalPhotosLibraryClient.SearchMediaItemsPagedResponse searchMediaItems​(SearchMediaItemsRequest request)
        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 are returned. If an album is set, all media items in the specified album are returned. If filters are specified, media items that match the filters from the user's library are listed. If you set both the album and the filters, the request results in an error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           SearchMediaItemsRequest request =
               SearchMediaItemsRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilters(Filters.newBuilder().build())
                   .setOrderBy("orderBy-1207110587")
                   .build();
           for (MediaItem element : internalPhotosLibraryClient.searchMediaItems(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • searchMediaItemsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<SearchMediaItemsRequest,​InternalPhotosLibraryClient.SearchMediaItemsPagedResponse> searchMediaItemsPagedCallable()
        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 are returned. If an album is set, all media items in the specified album are returned. If filters are specified, media items that match the filters from the user's library are listed. If you set both the album and the filters, the request results in an error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           SearchMediaItemsRequest request =
               SearchMediaItemsRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilters(Filters.newBuilder().build())
                   .setOrderBy("orderBy-1207110587")
                   .build();
           ApiFuture<MediaItem> future =
               internalPhotosLibraryClient.searchMediaItemsPagedCallable().futureCall(request);
           // Do something.
           for (MediaItem element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • searchMediaItemsCallable

        public final com.google.api.gax.rpc.UnaryCallable<SearchMediaItemsRequest,​SearchMediaItemsResponse> searchMediaItemsCallable()
        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 are returned. If an album is set, all media items in the specified album are returned. If filters are specified, media items that match the filters from the user's library are listed. If you set both the album and the filters, the request results in an error.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           SearchMediaItemsRequest request =
               SearchMediaItemsRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilters(Filters.newBuilder().build())
                   .setOrderBy("orderBy-1207110587")
                   .build();
           while (true) {
             SearchMediaItemsResponse response =
                 internalPhotosLibraryClient.searchMediaItemsCallable().call(request);
             for (MediaItem element : response.getResponsesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • listMediaItems

        public final InternalPhotosLibraryClient.ListMediaItemsPagedResponse listMediaItems​(ListMediaItemsRequest request)
        List all media items from a user's Google Photos library.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListMediaItemsRequest request =
               ListMediaItemsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (MediaItem element : internalPhotosLibraryClient.listMediaItems(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listMediaItemsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListMediaItemsRequest,​InternalPhotosLibraryClient.ListMediaItemsPagedResponse> listMediaItemsPagedCallable()
        List all media items from a user's Google Photos library.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListMediaItemsRequest request =
               ListMediaItemsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<MediaItem> future =
               internalPhotosLibraryClient.listMediaItemsPagedCallable().futureCall(request);
           // Do something.
           for (MediaItem element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listMediaItemsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListMediaItemsRequest,​ListMediaItemsResponse> listMediaItemsCallable()
        List all media items from a user's Google Photos library.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListMediaItemsRequest request =
               ListMediaItemsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListMediaItemsResponse response =
                 internalPhotosLibraryClient.listMediaItemsCallable().call(request);
             for (MediaItem element : response.getResponsesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getMediaItem

        public final MediaItem getMediaItem​(java.lang.String mediaItemId)
        Returns the media item for the specified media item identifier.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String mediaItemId = "mediaItemId-623842158";
           MediaItem response = internalPhotosLibraryClient.getMediaItem(mediaItemId);
         }
         
        Parameters:
        mediaItemId - Required. Identifier of the media item to be requested.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getMediaItem

        public final MediaItem getMediaItem​(GetMediaItemRequest request)
        Returns the media item for the specified media item identifier.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           GetMediaItemRequest request =
               GetMediaItemRequest.newBuilder().setMediaItemId("mediaItemId-623842158").build();
           MediaItem response = internalPhotosLibraryClient.getMediaItem(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getMediaItemCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetMediaItemRequest,​MediaItem> getMediaItemCallable()
        Returns the media item for the specified media item identifier.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           GetMediaItemRequest request =
               GetMediaItemRequest.newBuilder().setMediaItemId("mediaItemId-623842158").build();
           ApiFuture<MediaItem> future =
               internalPhotosLibraryClient.getMediaItemCallable().futureCall(request);
           // Do something.
           MediaItem response = future.get();
         }
         
      • batchGetMediaItems

        public final BatchGetMediaItemsResponse batchGetMediaItems​(java.util.List<java.lang.String> mediaItemIds)
        Returns the list of media items for the specified media item identifiers. Items are returned in the same order as the supplied identifiers.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           List<String> mediaItemIds = new ArrayList<>();
           BatchGetMediaItemsResponse response =
               internalPhotosLibraryClient.batchGetMediaItems(mediaItemIds);
         }
         
        Parameters:
        mediaItemIds - Required. Identifiers of the media items to be requested. Must not contain repeated identifiers and cannot be empty. The maximum number of media items that can be retrieved in one call is 50.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchGetMediaItems

        public final BatchGetMediaItemsResponse batchGetMediaItems​(BatchGetMediaItemsRequest request)
        Returns the list of media items for the specified media item identifiers. Items are returned in the same order as the supplied identifiers.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchGetMediaItemsRequest request =
               BatchGetMediaItemsRequest.newBuilder()
                   .addAllMediaItemIds(new ArrayList<String>())
                   .build();
           BatchGetMediaItemsResponse response = internalPhotosLibraryClient.batchGetMediaItems(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchGetMediaItemsCallable

        public final com.google.api.gax.rpc.UnaryCallable<BatchGetMediaItemsRequest,​BatchGetMediaItemsResponse> batchGetMediaItemsCallable()
        Returns the list of media items for the specified media item identifiers. Items are returned in the same order as the supplied identifiers.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchGetMediaItemsRequest request =
               BatchGetMediaItemsRequest.newBuilder()
                   .addAllMediaItemIds(new ArrayList<String>())
                   .build();
           ApiFuture<BatchGetMediaItemsResponse> future =
               internalPhotosLibraryClient.batchGetMediaItemsCallable().futureCall(request);
           // Do something.
           BatchGetMediaItemsResponse response = future.get();
         }
         
      • listAlbums

        public final InternalPhotosLibraryClient.ListAlbumsPagedResponse listAlbums​(boolean excludeNonAppCreatedData)
        Lists all albums shown to a user in the Albums tab of the Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           boolean excludeNonAppCreatedData = true;
           for (Album element :
               internalPhotosLibraryClient.listAlbums(excludeNonAppCreatedData).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        excludeNonAppCreatedData - If set, the results exclude media items that were not created by this app. Defaults to false (all albums are returned). This field is ignored if the photoslibrary.readonly.appcreateddata scope is used.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listAlbums

        public final InternalPhotosLibraryClient.ListAlbumsPagedResponse listAlbums​(ListAlbumsRequest request)
        Lists all albums shown to a user in the Albums tab of the Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListAlbumsRequest request =
               ListAlbumsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setExcludeNonAppCreatedData(true)
                   .build();
           for (Album element : internalPhotosLibraryClient.listAlbums(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listAlbumsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListAlbumsRequest,​InternalPhotosLibraryClient.ListAlbumsPagedResponse> listAlbumsPagedCallable()
        Lists all albums shown to a user in the Albums tab of the Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListAlbumsRequest request =
               ListAlbumsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setExcludeNonAppCreatedData(true)
                   .build();
           ApiFuture<Album> future =
               internalPhotosLibraryClient.listAlbumsPagedCallable().futureCall(request);
           // Do something.
           for (Album element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listAlbumsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListAlbumsRequest,​ListAlbumsResponse> listAlbumsCallable()
        Lists all albums shown to a user in the Albums tab of the Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListAlbumsRequest request =
               ListAlbumsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setExcludeNonAppCreatedData(true)
                   .build();
           while (true) {
             ListAlbumsResponse response =
                 internalPhotosLibraryClient.listAlbumsCallable().call(request);
             for (Album element : response.getResponsesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getAlbum

        public final Album getAlbum​(java.lang.String albumId)
        Returns the album based on the specified `albumId`. The `albumId` must be the ID of an album owned by the user or a shared album that the user has joined.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           Album response = internalPhotosLibraryClient.getAlbum(albumId);
         }
         
        Parameters:
        albumId - Required. Identifier of the album to be requested.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAlbum

        public final Album getAlbum​(GetAlbumRequest request)
        Returns the album based on the specified `albumId`. The `albumId` must be the ID of an album owned by the user or a shared album that the user has joined.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           GetAlbumRequest request =
               GetAlbumRequest.newBuilder().setAlbumId("albumId-920410134").build();
           Album response = internalPhotosLibraryClient.getAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetAlbumRequest,​Album> getAlbumCallable()
        Returns the album based on the specified `albumId`. The `albumId` must be the ID of an album owned by the user or a shared album that the user has joined.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           GetAlbumRequest request =
               GetAlbumRequest.newBuilder().setAlbumId("albumId-920410134").build();
           ApiFuture<Album> future = internalPhotosLibraryClient.getAlbumCallable().futureCall(request);
           // Do something.
           Album response = future.get();
         }
         
      • getSharedAlbum

        public final Album getSharedAlbum​(java.lang.String shareToken)
        Returns the album based on the specified `shareToken`.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String shareToken = "shareToken-1798271654";
           Album response = internalPhotosLibraryClient.getSharedAlbum(shareToken);
         }
         
        Parameters:
        shareToken - Required. Share token of the album to be requested.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getSharedAlbum

        public final Album getSharedAlbum​(GetSharedAlbumRequest request)
        Returns the album based on the specified `shareToken`.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           GetSharedAlbumRequest request =
               GetSharedAlbumRequest.newBuilder().setShareToken("shareToken-1798271654").build();
           Album response = internalPhotosLibraryClient.getSharedAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getSharedAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetSharedAlbumRequest,​Album> getSharedAlbumCallable()
        Returns the album based on the specified `shareToken`.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           GetSharedAlbumRequest request =
               GetSharedAlbumRequest.newBuilder().setShareToken("shareToken-1798271654").build();
           ApiFuture<Album> future =
               internalPhotosLibraryClient.getSharedAlbumCallable().futureCall(request);
           // Do something.
           Album response = future.get();
         }
         
      • addEnrichmentToAlbum

        public final AddEnrichmentToAlbumResponse addEnrichmentToAlbum​(java.lang.String albumId,
                                                                       NewEnrichmentItem newEnrichmentItem,
                                                                       AlbumPosition albumPosition)
        Adds an enrichment at a specified position in a defined album.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           NewEnrichmentItem newEnrichmentItem = NewEnrichmentItem.newBuilder().build();
           AlbumPosition albumPosition = AlbumPosition.newBuilder().build();
           AddEnrichmentToAlbumResponse response =
               internalPhotosLibraryClient.addEnrichmentToAlbum(
                   albumId, newEnrichmentItem, albumPosition);
         }
         
        Parameters:
        albumId - Required. Identifier of the album where the enrichment is to be added.
        newEnrichmentItem - Required. The enrichment to be added.
        albumPosition - Required. The position in the album where the enrichment is to be inserted.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addEnrichmentToAlbum

        public final AddEnrichmentToAlbumResponse addEnrichmentToAlbum​(AddEnrichmentToAlbumRequest request)
        Adds an enrichment at a specified position in a defined album.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           AddEnrichmentToAlbumRequest request =
               AddEnrichmentToAlbumRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .setNewEnrichmentItem(NewEnrichmentItem.newBuilder().build())
                   .setAlbumPosition(AlbumPosition.newBuilder().build())
                   .build();
           AddEnrichmentToAlbumResponse response =
               internalPhotosLibraryClient.addEnrichmentToAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addEnrichmentToAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<AddEnrichmentToAlbumRequest,​AddEnrichmentToAlbumResponse> addEnrichmentToAlbumCallable()
        Adds an enrichment at a specified position in a defined album.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           AddEnrichmentToAlbumRequest request =
               AddEnrichmentToAlbumRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .setNewEnrichmentItem(NewEnrichmentItem.newBuilder().build())
                   .setAlbumPosition(AlbumPosition.newBuilder().build())
                   .build();
           ApiFuture<AddEnrichmentToAlbumResponse> future =
               internalPhotosLibraryClient.addEnrichmentToAlbumCallable().futureCall(request);
           // Do something.
           AddEnrichmentToAlbumResponse response = future.get();
         }
         
      • joinSharedAlbum

        public final JoinSharedAlbumResponse joinSharedAlbum​(java.lang.String shareToken)
        Joins a shared album on behalf of the Google Photos user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String shareToken = "shareToken-1798271654";
           JoinSharedAlbumResponse response = internalPhotosLibraryClient.joinSharedAlbum(shareToken);
         }
         
        Parameters:
        shareToken - Required. Token to join the shared album on behalf of the user.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • joinSharedAlbum

        public final JoinSharedAlbumResponse joinSharedAlbum​(JoinSharedAlbumRequest request)
        Joins a shared album on behalf of the Google Photos user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           JoinSharedAlbumRequest request =
               JoinSharedAlbumRequest.newBuilder().setShareToken("shareToken-1798271654").build();
           JoinSharedAlbumResponse response = internalPhotosLibraryClient.joinSharedAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • joinSharedAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<JoinSharedAlbumRequest,​JoinSharedAlbumResponse> joinSharedAlbumCallable()
        Joins a shared album on behalf of the Google Photos user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           JoinSharedAlbumRequest request =
               JoinSharedAlbumRequest.newBuilder().setShareToken("shareToken-1798271654").build();
           ApiFuture<JoinSharedAlbumResponse> future =
               internalPhotosLibraryClient.joinSharedAlbumCallable().futureCall(request);
           // Do something.
           JoinSharedAlbumResponse response = future.get();
         }
         
      • leaveSharedAlbum

        public final LeaveSharedAlbumResponse leaveSharedAlbum​(java.lang.String shareToken)
        Leaves a previously-joined shared album on behalf of the Google Photos user. The user must not own this album.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String shareToken = "shareToken-1798271654";
           LeaveSharedAlbumResponse response = internalPhotosLibraryClient.leaveSharedAlbum(shareToken);
         }
         
        Parameters:
        shareToken - Required. Token to leave the shared album on behalf of the user.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • leaveSharedAlbum

        public final LeaveSharedAlbumResponse leaveSharedAlbum​(LeaveSharedAlbumRequest request)
        Leaves a previously-joined shared album on behalf of the Google Photos user. The user must not own this album.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           LeaveSharedAlbumRequest request =
               LeaveSharedAlbumRequest.newBuilder().setShareToken("shareToken-1798271654").build();
           LeaveSharedAlbumResponse response = internalPhotosLibraryClient.leaveSharedAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • leaveSharedAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<LeaveSharedAlbumRequest,​LeaveSharedAlbumResponse> leaveSharedAlbumCallable()
        Leaves a previously-joined shared album on behalf of the Google Photos user. The user must not own this album.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           LeaveSharedAlbumRequest request =
               LeaveSharedAlbumRequest.newBuilder().setShareToken("shareToken-1798271654").build();
           ApiFuture<LeaveSharedAlbumResponse> future =
               internalPhotosLibraryClient.leaveSharedAlbumCallable().futureCall(request);
           // Do something.
           LeaveSharedAlbumResponse response = future.get();
         }
         
      • shareAlbum

        public final ShareAlbumResponse shareAlbum​(java.lang.String albumId,
                                                   SharedAlbumOptions sharedAlbumOptions)
        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.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           SharedAlbumOptions sharedAlbumOptions = SharedAlbumOptions.newBuilder().build();
           ShareAlbumResponse response =
               internalPhotosLibraryClient.shareAlbum(albumId, sharedAlbumOptions);
         }
         
        Parameters:
        albumId - Required. Identifier of the album to be shared. This `albumId` must belong to an album created by the developer.
        sharedAlbumOptions - Options to be set when converting the album to a shared album.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • shareAlbum

        public final ShareAlbumResponse shareAlbum​(ShareAlbumRequest request)
        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.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ShareAlbumRequest request =
               ShareAlbumRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .setSharedAlbumOptions(SharedAlbumOptions.newBuilder().build())
                   .build();
           ShareAlbumResponse response = internalPhotosLibraryClient.shareAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • shareAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<ShareAlbumRequest,​ShareAlbumResponse> shareAlbumCallable()
        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.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ShareAlbumRequest request =
               ShareAlbumRequest.newBuilder()
                   .setAlbumId("albumId-920410134")
                   .setSharedAlbumOptions(SharedAlbumOptions.newBuilder().build())
                   .build();
           ApiFuture<ShareAlbumResponse> future =
               internalPhotosLibraryClient.shareAlbumCallable().futureCall(request);
           // Do something.
           ShareAlbumResponse response = future.get();
         }
         
      • listSharedAlbums

        public final InternalPhotosLibraryClient.ListSharedAlbumsPagedResponse listSharedAlbums​(boolean excludeNonAppCreatedData)
        Lists all shared albums available in the Sharing tab of the user's Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           boolean excludeNonAppCreatedData = true;
           for (Album element :
               internalPhotosLibraryClient.listSharedAlbums(excludeNonAppCreatedData).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        excludeNonAppCreatedData - If set, the results exclude media items that were not created by this app. Defaults to false (all albums are returned). This field is ignored if the photoslibrary.readonly.appcreateddata scope is used.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listSharedAlbums

        public final InternalPhotosLibraryClient.ListSharedAlbumsPagedResponse listSharedAlbums​(ListSharedAlbumsRequest request)
        Lists all shared albums available in the Sharing tab of the user's Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListSharedAlbumsRequest request =
               ListSharedAlbumsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setExcludeNonAppCreatedData(true)
                   .build();
           for (Album element : internalPhotosLibraryClient.listSharedAlbums(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listSharedAlbumsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListSharedAlbumsRequest,​InternalPhotosLibraryClient.ListSharedAlbumsPagedResponse> listSharedAlbumsPagedCallable()
        Lists all shared albums available in the Sharing tab of the user's Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListSharedAlbumsRequest request =
               ListSharedAlbumsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setExcludeNonAppCreatedData(true)
                   .build();
           ApiFuture<Album> future =
               internalPhotosLibraryClient.listSharedAlbumsPagedCallable().futureCall(request);
           // Do something.
           for (Album element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listSharedAlbumsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListSharedAlbumsRequest,​ListSharedAlbumsResponse> listSharedAlbumsCallable()
        Lists all shared albums available in the Sharing tab of the user's Google Photos app.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           ListSharedAlbumsRequest request =
               ListSharedAlbumsRequest.newBuilder()
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setExcludeNonAppCreatedData(true)
                   .build();
           while (true) {
             ListSharedAlbumsResponse response =
                 internalPhotosLibraryClient.listSharedAlbumsCallable().call(request);
             for (Album element : response.getResponsesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • unshareAlbum

        public final UnshareAlbumResponse unshareAlbum​(java.lang.String albumId)
        Marks a previously shared album as private. This means that the album is no longer shared and all the non-owners will lose access to the album. All non-owner content will be removed from the album. If a non-owner has previously added the album to their library, they will retain all photos in their library. This action can only be performed on albums which were created by the developer via the API.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           UnshareAlbumResponse response = internalPhotosLibraryClient.unshareAlbum(albumId);
         }
         
        Parameters:
        albumId - Required. Identifier of the album to be unshared. This album id must belong to an album created by the developer.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • unshareAlbum

        public final UnshareAlbumResponse unshareAlbum​(UnshareAlbumRequest request)
        Marks a previously shared album as private. This means that the album is no longer shared and all the non-owners will lose access to the album. All non-owner content will be removed from the album. If a non-owner has previously added the album to their library, they will retain all photos in their library. This action can only be performed on albums which were created by the developer via the API.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           UnshareAlbumRequest request =
               UnshareAlbumRequest.newBuilder().setAlbumId("albumId-920410134").build();
           UnshareAlbumResponse response = internalPhotosLibraryClient.unshareAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • unshareAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<UnshareAlbumRequest,​UnshareAlbumResponse> unshareAlbumCallable()
        Marks a previously shared album as private. This means that the album is no longer shared and all the non-owners will lose access to the album. All non-owner content will be removed from the album. If a non-owner has previously added the album to their library, they will retain all photos in their library. This action can only be performed on albums which were created by the developer via the API.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           UnshareAlbumRequest request =
               UnshareAlbumRequest.newBuilder().setAlbumId("albumId-920410134").build();
           ApiFuture<UnshareAlbumResponse> future =
               internalPhotosLibraryClient.unshareAlbumCallable().futureCall(request);
           // Do something.
           UnshareAlbumResponse response = future.get();
         }
         
      • batchRemoveMediaItemsFromAlbum

        public final BatchRemoveMediaItemsFromAlbumResponse batchRemoveMediaItemsFromAlbum​(java.lang.String albumId,
                                                                                           java.util.List<java.lang.String> mediaItemIds)
        Removes one or more media items from a specified album. The media items and the album must have been created by the developer via the API.

        For albums that are shared, this action is only supported for media items that were added to the album by this user, or for all media items if the album was created by this user.

        Partial success is not supported. The entire request will fail and no action will be performed on the album if an invalid media item or album is specified.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           String albumId = "albumId-920410134";
           List<String> mediaItemIds = new ArrayList<>();
           BatchRemoveMediaItemsFromAlbumResponse response =
               internalPhotosLibraryClient.batchRemoveMediaItemsFromAlbum(albumId, mediaItemIds);
         }
         
        Parameters:
        albumId - Required. Identifier of the [Album][google.photos.types.Album] that the media items are to be removed from.
        mediaItemIds - Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to be removed.

        Must not contain repeated identifiers and cannot be empty. The maximum number of media items that can be removed in one call is 50.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchRemoveMediaItemsFromAlbum

        public final BatchRemoveMediaItemsFromAlbumResponse batchRemoveMediaItemsFromAlbum​(BatchRemoveMediaItemsFromAlbumRequest request)
        Removes one or more media items from a specified album. The media items and the album must have been created by the developer via the API.

        For albums that are shared, this action is only supported for media items that were added to the album by this user, or for all media items if the album was created by this user.

        Partial success is not supported. The entire request will fail and no action will be performed on the album if an invalid media item or album is specified.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchRemoveMediaItemsFromAlbumRequest request =
               BatchRemoveMediaItemsFromAlbumRequest.newBuilder()
                   .addAllMediaItemIds(new ArrayList<String>())
                   .setAlbumId("albumId-920410134")
                   .build();
           BatchRemoveMediaItemsFromAlbumResponse response =
               internalPhotosLibraryClient.batchRemoveMediaItemsFromAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchRemoveMediaItemsFromAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<BatchRemoveMediaItemsFromAlbumRequest,​BatchRemoveMediaItemsFromAlbumResponse> batchRemoveMediaItemsFromAlbumCallable()
        Removes one or more media items from a specified album. The media items and the album must have been created by the developer via the API.

        For albums that are shared, this action is only supported for media items that were added to the album by this user, or for all media items if the album was created by this user.

        Partial success is not supported. The entire request will fail and no action will be performed on the album if an invalid media item or album is specified.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           BatchRemoveMediaItemsFromAlbumRequest request =
               BatchRemoveMediaItemsFromAlbumRequest.newBuilder()
                   .addAllMediaItemIds(new ArrayList<String>())
                   .setAlbumId("albumId-920410134")
                   .build();
           ApiFuture<BatchRemoveMediaItemsFromAlbumResponse> future =
               internalPhotosLibraryClient.batchRemoveMediaItemsFromAlbumCallable().futureCall(request);
           // Do something.
           BatchRemoveMediaItemsFromAlbumResponse response = future.get();
         }
         
      • updateAlbum

        public final Album updateAlbum​(Album album)
        Update the album with the specified `id`. Only the `id`, `title` and `cover_photo_media_item_id` fields of the album are read. The album must have been created by the developer via the API and must be owned by the user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           Album album = Album.newBuilder().build();
           Album response = internalPhotosLibraryClient.updateAlbum(album);
         }
         
        Parameters:
        album - Required. The [Album][google.photos.types.Album] to update.

        The album?s `id` field is used to identify the album to be updated. The album?s `title` field is used to set the new album title. The album?s `cover_photo_media_item_id` field is used to set the new album cover photo.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateAlbum

        public final Album updateAlbum​(Album album,
                                       com.google.protobuf.FieldMask updateMask)
        Update the album with the specified `id`. Only the `id`, `title` and `cover_photo_media_item_id` fields of the album are read. The album must have been created by the developer via the API and must be owned by the user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           Album album = Album.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           Album response = internalPhotosLibraryClient.updateAlbum(album, updateMask);
         }
         
        Parameters:
        album - Required. The [Album][google.photos.types.Album] to update.

        The album?s `id` field is used to identify the album to be updated. The album?s `title` field is used to set the new album title. The album?s `cover_photo_media_item_id` field is used to set the new album cover photo.

        updateMask - Required. Indicate what fields in the provided album to update. The only valid values are `title` and `cover_photo_media_item_id`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateAlbum

        public final Album updateAlbum​(UpdateAlbumRequest request)
        Update the album with the specified `id`. Only the `id`, `title` and `cover_photo_media_item_id` fields of the album are read. The album must have been created by the developer via the API and must be owned by the user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           UpdateAlbumRequest request =
               UpdateAlbumRequest.newBuilder()
                   .setAlbum(Album.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Album response = internalPhotosLibraryClient.updateAlbum(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateAlbumCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateAlbumRequest,​Album> updateAlbumCallable()
        Update the album with the specified `id`. Only the `id`, `title` and `cover_photo_media_item_id` fields of the album are read. The album must have been created by the developer via the API and must be owned by the user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           UpdateAlbumRequest request =
               UpdateAlbumRequest.newBuilder()
                   .setAlbum(Album.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Album> future =
               internalPhotosLibraryClient.updateAlbumCallable().futureCall(request);
           // Do something.
           Album response = future.get();
         }
         
      • updateMediaItem

        public final MediaItem updateMediaItem​(MediaItem mediaItem,
                                               com.google.protobuf.FieldMask updateMask)
        Update the media item with the specified `id`. Only the `id` and `description` fields of the media item are read. The media item must have been created by the developer via the API and must be owned by the user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           MediaItem mediaItem = MediaItem.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           MediaItem response = internalPhotosLibraryClient.updateMediaItem(mediaItem, updateMask);
         }
         
        Parameters:
        mediaItem - Required. The [MediaItem][google.photos.types.MediaItem] to update.

        The media item's `id` field is used to identify the media item to be updated. The media item's `description` field is used to set the new media item description.

        updateMask - Required. Indicate what fields in the provided media item to update. The only valid value is `description`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateMediaItem

        public final MediaItem updateMediaItem​(UpdateMediaItemRequest request)
        Update the media item with the specified `id`. Only the `id` and `description` fields of the media item are read. The media item must have been created by the developer via the API and must be owned by the user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           UpdateMediaItemRequest request =
               UpdateMediaItemRequest.newBuilder()
                   .setMediaItem(MediaItem.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           MediaItem response = internalPhotosLibraryClient.updateMediaItem(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateMediaItemCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateMediaItemRequest,​MediaItem> updateMediaItemCallable()
        Update the media item with the specified `id`. Only the `id` and `description` fields of the media item are read. The media item must have been created by the developer via the API and must be owned by the user.

        Sample code:

        
         try (InternalPhotosLibraryClient internalPhotosLibraryClient =
             InternalPhotosLibraryClient.create()) {
           UpdateMediaItemRequest request =
               UpdateMediaItemRequest.newBuilder()
                   .setMediaItem(MediaItem.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<MediaItem> future =
               internalPhotosLibraryClient.updateMediaItemCallable().futureCall(request);
           // Do something.
           MediaItem response = future.get();
         }
         
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource
      • awaitTermination

        public boolean awaitTermination​(long duration,
                                        java.util.concurrent.TimeUnit unit)
                                 throws java.lang.InterruptedException
        Specified by:
        awaitTermination in interface com.google.api.gax.core.BackgroundResource
        Throws:
        java.lang.InterruptedException