All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.photos.library.v1.internal.InternalPhotosLibraryClient Maven / Gradle / Ivy

There is a newer version: 1.7.3
Show newest version
/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.photos.library.v1.internal;

import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.photos.library.v1.internal.stub.PhotosLibraryStub;
import com.google.photos.library.v1.internal.stub.PhotosLibraryStubSettings;
import com.google.photos.library.v1.proto.AddEnrichmentToAlbumRequest;
import com.google.photos.library.v1.proto.AddEnrichmentToAlbumResponse;
import com.google.photos.library.v1.proto.AlbumPosition;
import com.google.photos.library.v1.proto.BatchAddMediaItemsToAlbumRequest;
import com.google.photos.library.v1.proto.BatchAddMediaItemsToAlbumResponse;
import com.google.photos.library.v1.proto.BatchCreateMediaItemsRequest;
import com.google.photos.library.v1.proto.BatchCreateMediaItemsResponse;
import com.google.photos.library.v1.proto.BatchGetMediaItemsRequest;
import com.google.photos.library.v1.proto.BatchGetMediaItemsResponse;
import com.google.photos.library.v1.proto.BatchRemoveMediaItemsFromAlbumRequest;
import com.google.photos.library.v1.proto.BatchRemoveMediaItemsFromAlbumResponse;
import com.google.photos.library.v1.proto.CreateAlbumRequest;
import com.google.photos.library.v1.proto.Filters;
import com.google.photos.library.v1.proto.GetAlbumRequest;
import com.google.photos.library.v1.proto.GetMediaItemRequest;
import com.google.photos.library.v1.proto.GetSharedAlbumRequest;
import com.google.photos.library.v1.proto.JoinSharedAlbumRequest;
import com.google.photos.library.v1.proto.JoinSharedAlbumResponse;
import com.google.photos.library.v1.proto.LeaveSharedAlbumRequest;
import com.google.photos.library.v1.proto.LeaveSharedAlbumResponse;
import com.google.photos.library.v1.proto.ListAlbumsRequest;
import com.google.photos.library.v1.proto.ListAlbumsResponse;
import com.google.photos.library.v1.proto.ListMediaItemsRequest;
import com.google.photos.library.v1.proto.ListMediaItemsResponse;
import com.google.photos.library.v1.proto.ListSharedAlbumsRequest;
import com.google.photos.library.v1.proto.ListSharedAlbumsResponse;
import com.google.photos.library.v1.proto.NewEnrichmentItem;
import com.google.photos.library.v1.proto.NewMediaItem;
import com.google.photos.library.v1.proto.SearchMediaItemsRequest;
import com.google.photos.library.v1.proto.SearchMediaItemsResponse;
import com.google.photos.library.v1.proto.ShareAlbumRequest;
import com.google.photos.library.v1.proto.ShareAlbumResponse;
import com.google.photos.library.v1.proto.UnshareAlbumRequest;
import com.google.photos.library.v1.proto.UnshareAlbumResponse;
import com.google.photos.types.proto.Album;
import com.google.photos.types.proto.MediaItem;
import com.google.photos.types.proto.SharedAlbumOptions;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND SERVICE
/**
 * 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);
 * 
 * 
*/ @Generated("by gapic-generator") @BetaApi public class InternalPhotosLibraryClient implements BackgroundResource { private final InternalPhotosLibrarySettings settings; private final PhotosLibraryStub stub; /** Constructs an instance of InternalPhotosLibraryClient with default settings. */ public static final InternalPhotosLibraryClient create() throws IOException { return create(InternalPhotosLibrarySettings.newBuilder().build()); } /** * 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. */ public static final InternalPhotosLibraryClient create(InternalPhotosLibrarySettings settings) throws IOException { return new InternalPhotosLibraryClient(settings); } /** * Constructs an instance of InternalPhotosLibraryClient, using the given stub for making calls. * This is for advanced usage - prefer to use InternalPhotosLibrarySettings}. */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final InternalPhotosLibraryClient create(PhotosLibraryStub stub) { return new InternalPhotosLibraryClient(stub); } /** * 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. */ protected InternalPhotosLibraryClient(InternalPhotosLibrarySettings settings) throws IOException { this.settings = settings; this.stub = ((PhotosLibraryStubSettings) settings.getStubSettings()).createStub(); } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected InternalPhotosLibraryClient(PhotosLibraryStub stub) { this.settings = null; this.stub = stub; } public final InternalPhotosLibrarySettings getSettings() { return settings; } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public PhotosLibraryStub getStub() { return stub; } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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);
   * }
   * 
* * @param album The album to be created. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Album createAlbum(Album album) { CreateAlbumRequest request = CreateAlbumRequest.newBuilder().setAlbum(album).build(); return createAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates an album in a user's Google Photos library. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   Album album = Album.newBuilder().build();
   *   CreateAlbumRequest request = CreateAlbumRequest.newBuilder()
   *     .setAlbum(album)
   *     .build();
   *   Album response = internalPhotosLibraryClient.createAlbum(request);
   * }
   * 
* * @param 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 */ public final Album createAlbum(CreateAlbumRequest request) { return createAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates an album in a user's Google Photos library. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   Album album = Album.newBuilder().build();
   *   CreateAlbumRequest request = CreateAlbumRequest.newBuilder()
   *     .setAlbum(album)
   *     .build();
   *   ApiFuture<Album> future = internalPhotosLibraryClient.createAlbumCallable().futureCall(request);
   *   // Do something
   *   Album response = future.get();
   * }
   * 
*/ public final UnaryCallable createAlbumCallable() { return stub.createAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   List<NewMediaItem> newMediaItems = new ArrayList<>();
   *   AlbumPosition albumPosition = AlbumPosition.newBuilder().build();
   *   BatchCreateMediaItemsResponse response = internalPhotosLibraryClient.batchCreateMediaItems(albumId, newMediaItems, albumPosition);
   * }
   * 
* * @param 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. * @param newMediaItems List of media items to be created. * @param 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 */ public final BatchCreateMediaItemsResponse batchCreateMediaItems( String albumId, List newMediaItems, AlbumPosition albumPosition) { BatchCreateMediaItemsRequest request = BatchCreateMediaItemsRequest.newBuilder() .setAlbumId(albumId) .addAllNewMediaItems(newMediaItems) .setAlbumPosition(albumPosition) .build(); return batchCreateMediaItems(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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()) {
   *   List<NewMediaItem> newMediaItems = new ArrayList<>();
   *   BatchCreateMediaItemsRequest request = BatchCreateMediaItemsRequest.newBuilder()
   *     .addAllNewMediaItems(newMediaItems)
   *     .build();
   *   BatchCreateMediaItemsResponse response = internalPhotosLibraryClient.batchCreateMediaItems(request);
   * }
   * 
* * @param 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 */ public final BatchCreateMediaItemsResponse batchCreateMediaItems( BatchCreateMediaItemsRequest request) { return batchCreateMediaItemsCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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()) {
   *   List<NewMediaItem> newMediaItems = new ArrayList<>();
   *   BatchCreateMediaItemsRequest request = BatchCreateMediaItemsRequest.newBuilder()
   *     .addAllNewMediaItems(newMediaItems)
   *     .build();
   *   ApiFuture<BatchCreateMediaItemsResponse> future = internalPhotosLibraryClient.batchCreateMediaItemsCallable().futureCall(request);
   *   // Do something
   *   BatchCreateMediaItemsResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable batchCreateMediaItemsCallable() { return stub.batchCreateMediaItemsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   List<String> mediaItemIds = new ArrayList<>();
   *   BatchAddMediaItemsToAlbumResponse response = internalPhotosLibraryClient.batchAddMediaItemsToAlbum(albumId, mediaItemIds);
   * }
   * 
* * @param albumId Identifier of the [Album][google.photos.types.Album] that the media items are * added to. * @param mediaItemIds 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 */ public final BatchAddMediaItemsToAlbumResponse batchAddMediaItemsToAlbum( String albumId, List mediaItemIds) { BatchAddMediaItemsToAlbumRequest request = BatchAddMediaItemsToAlbumRequest.newBuilder() .setAlbumId(albumId) .addAllMediaItemIds(mediaItemIds) .build(); return batchAddMediaItemsToAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   List<String> mediaItemIds = new ArrayList<>();
   *   BatchAddMediaItemsToAlbumRequest request = BatchAddMediaItemsToAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .addAllMediaItemIds(mediaItemIds)
   *     .build();
   *   BatchAddMediaItemsToAlbumResponse response = internalPhotosLibraryClient.batchAddMediaItemsToAlbum(request);
   * }
   * 
* * @param 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 */ public final BatchAddMediaItemsToAlbumResponse batchAddMediaItemsToAlbum( BatchAddMediaItemsToAlbumRequest request) { return batchAddMediaItemsToAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   List<String> mediaItemIds = new ArrayList<>();
   *   BatchAddMediaItemsToAlbumRequest request = BatchAddMediaItemsToAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .addAllMediaItemIds(mediaItemIds)
   *     .build();
   *   ApiFuture<BatchAddMediaItemsToAlbumResponse> future = internalPhotosLibraryClient.batchAddMediaItemsToAlbumCallable().futureCall(request);
   *   // Do something
   *   BatchAddMediaItemsToAlbumResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable batchAddMediaItemsToAlbumCallable() { return stub.batchAddMediaItemsToAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   for (MediaItem element : internalPhotosLibraryClient.searchMediaItems(albumId).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
* * @param 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 */ public final SearchMediaItemsPagedResponse searchMediaItems(String albumId) { SearchMediaItemsRequest request = SearchMediaItemsRequest.newBuilder().setAlbumId(albumId).build(); return searchMediaItems(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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);
   *   }
   * }
   * 
* * @param 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 */ public final SearchMediaItemsPagedResponse searchMediaItems(Filters filters) { SearchMediaItemsRequest request = SearchMediaItemsRequest.newBuilder().setFilters(filters).build(); return searchMediaItems(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   for (MediaItem element : internalPhotosLibraryClient.searchMediaItems(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
* * @param 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 */ public final SearchMediaItemsPagedResponse searchMediaItems(SearchMediaItemsRequest request) { return searchMediaItemsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   ApiFuture<SearchMediaItemsPagedResponse> future = internalPhotosLibraryClient.searchMediaItemsPagedCallable().futureCall(request);
   *   // Do something
   *   for (MediaItem element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
*/ public final UnaryCallable searchMediaItemsPagedCallable() { return stub.searchMediaItemsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   while (true) {
   *     SearchMediaItemsResponse response = internalPhotosLibraryClient.searchMediaItemsCallable().call(request);
   *     for (MediaItem element : response.getMediaItemsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * 
*/ public final UnaryCallable searchMediaItemsCallable() { return stub.searchMediaItemsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * List all media items from a user's Google Photos library. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   ListMediaItemsRequest request = ListMediaItemsRequest.newBuilder().build();
   *   for (MediaItem element : internalPhotosLibraryClient.listMediaItems(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
* * @param 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 */ public final ListMediaItemsPagedResponse listMediaItems(ListMediaItemsRequest request) { return listMediaItemsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * List all media items from a user's Google Photos library. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   ListMediaItemsRequest request = ListMediaItemsRequest.newBuilder().build();
   *   ApiFuture<ListMediaItemsPagedResponse> future = internalPhotosLibraryClient.listMediaItemsPagedCallable().futureCall(request);
   *   // Do something
   *   for (MediaItem element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
*/ public final UnaryCallable listMediaItemsPagedCallable() { return stub.listMediaItemsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * List all media items from a user's Google Photos library. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   ListMediaItemsRequest request = ListMediaItemsRequest.newBuilder().build();
   *   while (true) {
   *     ListMediaItemsResponse response = internalPhotosLibraryClient.listMediaItemsCallable().call(request);
   *     for (MediaItem element : response.getMediaItemsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * 
*/ public final UnaryCallable listMediaItemsCallable() { return stub.listMediaItemsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Returns the media item for the specified media item identifier. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String mediaItemId = "";
   *   MediaItem response = internalPhotosLibraryClient.getMediaItem(mediaItemId);
   * }
   * 
* * @param mediaItemId Identifier of the media item to be requested. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final MediaItem getMediaItem(String mediaItemId) { GetMediaItemRequest request = GetMediaItemRequest.newBuilder().setMediaItemId(mediaItemId).build(); return getMediaItem(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Returns the media item for the specified media item identifier. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String mediaItemId = "";
   *   GetMediaItemRequest request = GetMediaItemRequest.newBuilder()
   *     .setMediaItemId(mediaItemId)
   *     .build();
   *   MediaItem response = internalPhotosLibraryClient.getMediaItem(request);
   * }
   * 
* * @param 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 */ public final MediaItem getMediaItem(GetMediaItemRequest request) { return getMediaItemCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Returns the media item for the specified media item identifier. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String mediaItemId = "";
   *   GetMediaItemRequest request = GetMediaItemRequest.newBuilder()
   *     .setMediaItemId(mediaItemId)
   *     .build();
   *   ApiFuture<MediaItem> future = internalPhotosLibraryClient.getMediaItemCallable().futureCall(request);
   *   // Do something
   *   MediaItem response = future.get();
   * }
   * 
*/ public final UnaryCallable getMediaItemCallable() { return stub.getMediaItemCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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);
   * }
   * 
* * @param mediaItemIds 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 */ public final BatchGetMediaItemsResponse batchGetMediaItems(List mediaItemIds) { BatchGetMediaItemsRequest request = BatchGetMediaItemsRequest.newBuilder().addAllMediaItemIds(mediaItemIds).build(); return batchGetMediaItems(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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<>();
   *   BatchGetMediaItemsRequest request = BatchGetMediaItemsRequest.newBuilder()
   *     .addAllMediaItemIds(mediaItemIds)
   *     .build();
   *   BatchGetMediaItemsResponse response = internalPhotosLibraryClient.batchGetMediaItems(request);
   * }
   * 
* * @param 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 */ public final BatchGetMediaItemsResponse batchGetMediaItems(BatchGetMediaItemsRequest request) { return batchGetMediaItemsCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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<>();
   *   BatchGetMediaItemsRequest request = BatchGetMediaItemsRequest.newBuilder()
   *     .addAllMediaItemIds(mediaItemIds)
   *     .build();
   *   ApiFuture<BatchGetMediaItemsResponse> future = internalPhotosLibraryClient.batchGetMediaItemsCallable().futureCall(request);
   *   // Do something
   *   BatchGetMediaItemsResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable batchGetMediaItemsCallable() { return stub.batchGetMediaItemsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = false;
   *   for (Album element : internalPhotosLibraryClient.listAlbums(excludeNonAppCreatedData).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
* * @param 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 */ public final ListAlbumsPagedResponse listAlbums(boolean excludeNonAppCreatedData) { ListAlbumsRequest request = ListAlbumsRequest.newBuilder() .setExcludeNonAppCreatedData(excludeNonAppCreatedData) .build(); return listAlbums(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   for (Album element : internalPhotosLibraryClient.listAlbums(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
* * @param 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 */ public final ListAlbumsPagedResponse listAlbums(ListAlbumsRequest request) { return listAlbumsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   ApiFuture<ListAlbumsPagedResponse> future = internalPhotosLibraryClient.listAlbumsPagedCallable().futureCall(request);
   *   // Do something
   *   for (Album element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
*/ public final UnaryCallable listAlbumsPagedCallable() { return stub.listAlbumsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   while (true) {
   *     ListAlbumsResponse response = internalPhotosLibraryClient.listAlbumsCallable().call(request);
   *     for (Album element : response.getAlbumsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * 
*/ public final UnaryCallable listAlbumsCallable() { return stub.listAlbumsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   Album response = internalPhotosLibraryClient.getAlbum(albumId);
   * }
   * 
* * @param albumId Identifier of the album to be requested. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Album getAlbum(String albumId) { GetAlbumRequest request = GetAlbumRequest.newBuilder().setAlbumId(albumId).build(); return getAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   GetAlbumRequest request = GetAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .build();
   *   Album response = internalPhotosLibraryClient.getAlbum(request);
   * }
   * 
* * @param 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 */ public final Album getAlbum(GetAlbumRequest request) { return getAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   GetAlbumRequest request = GetAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .build();
   *   ApiFuture<Album> future = internalPhotosLibraryClient.getAlbumCallable().futureCall(request);
   *   // Do something
   *   Album response = future.get();
   * }
   * 
*/ public final UnaryCallable getAlbumCallable() { return stub.getAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Returns the album based on the specified `shareToken`. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String shareToken = "";
   *   Album response = internalPhotosLibraryClient.getSharedAlbum(shareToken);
   * }
   * 
* * @param shareToken Share token of the album to be requested. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Album getSharedAlbum(String shareToken) { GetSharedAlbumRequest request = GetSharedAlbumRequest.newBuilder().setShareToken(shareToken).build(); return getSharedAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Returns the album based on the specified `shareToken`. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String shareToken = "";
   *   GetSharedAlbumRequest request = GetSharedAlbumRequest.newBuilder()
   *     .setShareToken(shareToken)
   *     .build();
   *   Album response = internalPhotosLibraryClient.getSharedAlbum(request);
   * }
   * 
* * @param 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 */ public final Album getSharedAlbum(GetSharedAlbumRequest request) { return getSharedAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Returns the album based on the specified `shareToken`. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String shareToken = "";
   *   GetSharedAlbumRequest request = GetSharedAlbumRequest.newBuilder()
   *     .setShareToken(shareToken)
   *     .build();
   *   ApiFuture<Album> future = internalPhotosLibraryClient.getSharedAlbumCallable().futureCall(request);
   *   // Do something
   *   Album response = future.get();
   * }
   * 
*/ public final UnaryCallable getSharedAlbumCallable() { return stub.getSharedAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Adds an enrichment at a specified position in a defined album. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String albumId = "";
   *   NewEnrichmentItem newEnrichmentItem = NewEnrichmentItem.newBuilder().build();
   *   AlbumPosition albumPosition = AlbumPosition.newBuilder().build();
   *   AddEnrichmentToAlbumResponse response = internalPhotosLibraryClient.addEnrichmentToAlbum(albumId, newEnrichmentItem, albumPosition);
   * }
   * 
* * @param albumId Identifier of the album where the enrichment is to be added. * @param newEnrichmentItem The enrichment to be added. * @param albumPosition The position in the album where the enrichment is to be inserted. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AddEnrichmentToAlbumResponse addEnrichmentToAlbum( String albumId, NewEnrichmentItem newEnrichmentItem, AlbumPosition albumPosition) { AddEnrichmentToAlbumRequest request = AddEnrichmentToAlbumRequest.newBuilder() .setAlbumId(albumId) .setNewEnrichmentItem(newEnrichmentItem) .setAlbumPosition(albumPosition) .build(); return addEnrichmentToAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Adds an enrichment at a specified position in a defined album. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String albumId = "";
   *   NewEnrichmentItem newEnrichmentItem = NewEnrichmentItem.newBuilder().build();
   *   AlbumPosition albumPosition = AlbumPosition.newBuilder().build();
   *   AddEnrichmentToAlbumRequest request = AddEnrichmentToAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .setNewEnrichmentItem(newEnrichmentItem)
   *     .setAlbumPosition(albumPosition)
   *     .build();
   *   AddEnrichmentToAlbumResponse response = internalPhotosLibraryClient.addEnrichmentToAlbum(request);
   * }
   * 
* * @param 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 */ public final AddEnrichmentToAlbumResponse addEnrichmentToAlbum( AddEnrichmentToAlbumRequest request) { return addEnrichmentToAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Adds an enrichment at a specified position in a defined album. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String albumId = "";
   *   NewEnrichmentItem newEnrichmentItem = NewEnrichmentItem.newBuilder().build();
   *   AlbumPosition albumPosition = AlbumPosition.newBuilder().build();
   *   AddEnrichmentToAlbumRequest request = AddEnrichmentToAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .setNewEnrichmentItem(newEnrichmentItem)
   *     .setAlbumPosition(albumPosition)
   *     .build();
   *   ApiFuture<AddEnrichmentToAlbumResponse> future = internalPhotosLibraryClient.addEnrichmentToAlbumCallable().futureCall(request);
   *   // Do something
   *   AddEnrichmentToAlbumResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable addEnrichmentToAlbumCallable() { return stub.addEnrichmentToAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Joins a shared album on behalf of the Google Photos user. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String shareToken = "";
   *   JoinSharedAlbumResponse response = internalPhotosLibraryClient.joinSharedAlbum(shareToken);
   * }
   * 
* * @param shareToken Token to join the shared album on behalf of the user. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final JoinSharedAlbumResponse joinSharedAlbum(String shareToken) { JoinSharedAlbumRequest request = JoinSharedAlbumRequest.newBuilder().setShareToken(shareToken).build(); return joinSharedAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Joins a shared album on behalf of the Google Photos user. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String shareToken = "";
   *   JoinSharedAlbumRequest request = JoinSharedAlbumRequest.newBuilder()
   *     .setShareToken(shareToken)
   *     .build();
   *   JoinSharedAlbumResponse response = internalPhotosLibraryClient.joinSharedAlbum(request);
   * }
   * 
* * @param 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 */ public final JoinSharedAlbumResponse joinSharedAlbum(JoinSharedAlbumRequest request) { return joinSharedAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Joins a shared album on behalf of the Google Photos user. * *

Sample code: * *


   * try (InternalPhotosLibraryClient internalPhotosLibraryClient = InternalPhotosLibraryClient.create()) {
   *   String shareToken = "";
   *   JoinSharedAlbumRequest request = JoinSharedAlbumRequest.newBuilder()
   *     .setShareToken(shareToken)
   *     .build();
   *   ApiFuture<JoinSharedAlbumResponse> future = internalPhotosLibraryClient.joinSharedAlbumCallable().futureCall(request);
   *   // Do something
   *   JoinSharedAlbumResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable joinSharedAlbumCallable() { return stub.joinSharedAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   LeaveSharedAlbumResponse response = internalPhotosLibraryClient.leaveSharedAlbum(shareToken);
   * }
   * 
* * @param shareToken Token to leave the shared album on behalf of the user. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final LeaveSharedAlbumResponse leaveSharedAlbum(String shareToken) { LeaveSharedAlbumRequest request = LeaveSharedAlbumRequest.newBuilder().setShareToken(shareToken).build(); return leaveSharedAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   LeaveSharedAlbumRequest request = LeaveSharedAlbumRequest.newBuilder()
   *     .setShareToken(shareToken)
   *     .build();
   *   LeaveSharedAlbumResponse response = internalPhotosLibraryClient.leaveSharedAlbum(request);
   * }
   * 
* * @param 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 */ public final LeaveSharedAlbumResponse leaveSharedAlbum(LeaveSharedAlbumRequest request) { return leaveSharedAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   LeaveSharedAlbumRequest request = LeaveSharedAlbumRequest.newBuilder()
   *     .setShareToken(shareToken)
   *     .build();
   *   ApiFuture<LeaveSharedAlbumResponse> future = internalPhotosLibraryClient.leaveSharedAlbumCallable().futureCall(request);
   *   // Do something
   *   LeaveSharedAlbumResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable leaveSharedAlbumCallable() { return stub.leaveSharedAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   SharedAlbumOptions sharedAlbumOptions = SharedAlbumOptions.newBuilder().build();
   *   ShareAlbumResponse response = internalPhotosLibraryClient.shareAlbum(albumId, sharedAlbumOptions);
   * }
   * 
* * @param albumId Identifier of the album to be shared. This `albumId` must belong to an album * created by the developer. * @param 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 */ public final ShareAlbumResponse shareAlbum( String albumId, SharedAlbumOptions sharedAlbumOptions) { ShareAlbumRequest request = ShareAlbumRequest.newBuilder() .setAlbumId(albumId) .setSharedAlbumOptions(sharedAlbumOptions) .build(); return shareAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   ShareAlbumRequest request = ShareAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .build();
   *   ShareAlbumResponse response = internalPhotosLibraryClient.shareAlbum(request);
   * }
   * 
* * @param 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 */ public final ShareAlbumResponse shareAlbum(ShareAlbumRequest request) { return shareAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   ShareAlbumRequest request = ShareAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .build();
   *   ApiFuture<ShareAlbumResponse> future = internalPhotosLibraryClient.shareAlbumCallable().futureCall(request);
   *   // Do something
   *   ShareAlbumResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable shareAlbumCallable() { return stub.shareAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = false;
   *   for (Album element : internalPhotosLibraryClient.listSharedAlbums(excludeNonAppCreatedData).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
* * @param 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 */ public final ListSharedAlbumsPagedResponse listSharedAlbums(boolean excludeNonAppCreatedData) { ListSharedAlbumsRequest request = ListSharedAlbumsRequest.newBuilder() .setExcludeNonAppCreatedData(excludeNonAppCreatedData) .build(); return listSharedAlbums(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   for (Album element : internalPhotosLibraryClient.listSharedAlbums(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
* * @param 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 */ public final ListSharedAlbumsPagedResponse listSharedAlbums(ListSharedAlbumsRequest request) { return listSharedAlbumsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   ApiFuture<ListSharedAlbumsPagedResponse> future = internalPhotosLibraryClient.listSharedAlbumsPagedCallable().futureCall(request);
   *   // Do something
   *   for (Album element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * 
*/ public final UnaryCallable listSharedAlbumsPagedCallable() { return stub.listSharedAlbumsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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().build();
   *   while (true) {
   *     ListSharedAlbumsResponse response = internalPhotosLibraryClient.listSharedAlbumsCallable().call(request);
   *     for (Album element : response.getSharedAlbumsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * 
*/ public final UnaryCallable listSharedAlbumsCallable() { return stub.listSharedAlbumsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   UnshareAlbumResponse response = internalPhotosLibraryClient.unshareAlbum(albumId);
   * }
   * 
* * @param albumId 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 */ public final UnshareAlbumResponse unshareAlbum(String albumId) { UnshareAlbumRequest request = UnshareAlbumRequest.newBuilder().setAlbumId(albumId).build(); return unshareAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   UnshareAlbumRequest request = UnshareAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .build();
   *   UnshareAlbumResponse response = internalPhotosLibraryClient.unshareAlbum(request);
   * }
   * 
* * @param 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 */ public final UnshareAlbumResponse unshareAlbum(UnshareAlbumRequest request) { return unshareAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   UnshareAlbumRequest request = UnshareAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .build();
   *   ApiFuture<UnshareAlbumResponse> future = internalPhotosLibraryClient.unshareAlbumCallable().futureCall(request);
   *   // Do something
   *   UnshareAlbumResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable unshareAlbumCallable() { return stub.unshareAlbumCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   List<String> mediaItemIds = new ArrayList<>();
   *   BatchRemoveMediaItemsFromAlbumResponse response = internalPhotosLibraryClient.batchRemoveMediaItemsFromAlbum(albumId, mediaItemIds);
   * }
   * 
* * @param albumId Identifier of the [Album][google.photos.types.Album] that the media items are to * be removed from. * @param mediaItemIds 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 */ public final BatchRemoveMediaItemsFromAlbumResponse batchRemoveMediaItemsFromAlbum( String albumId, List mediaItemIds) { BatchRemoveMediaItemsFromAlbumRequest request = BatchRemoveMediaItemsFromAlbumRequest.newBuilder() .setAlbumId(albumId) .addAllMediaItemIds(mediaItemIds) .build(); return batchRemoveMediaItemsFromAlbum(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   List<String> mediaItemIds = new ArrayList<>();
   *   BatchRemoveMediaItemsFromAlbumRequest request = BatchRemoveMediaItemsFromAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .addAllMediaItemIds(mediaItemIds)
   *     .build();
   *   BatchRemoveMediaItemsFromAlbumResponse response = internalPhotosLibraryClient.batchRemoveMediaItemsFromAlbum(request);
   * }
   * 
* * @param 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 */ public final BatchRemoveMediaItemsFromAlbumResponse batchRemoveMediaItemsFromAlbum( BatchRemoveMediaItemsFromAlbumRequest request) { return batchRemoveMediaItemsFromAlbumCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** * 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 = "";
   *   List<String> mediaItemIds = new ArrayList<>();
   *   BatchRemoveMediaItemsFromAlbumRequest request = BatchRemoveMediaItemsFromAlbumRequest.newBuilder()
   *     .setAlbumId(albumId)
   *     .addAllMediaItemIds(mediaItemIds)
   *     .build();
   *   ApiFuture<BatchRemoveMediaItemsFromAlbumResponse> future = internalPhotosLibraryClient.batchRemoveMediaItemsFromAlbumCallable().futureCall(request);
   *   // Do something
   *   BatchRemoveMediaItemsFromAlbumResponse response = future.get();
   * }
   * 
*/ public final UnaryCallable< BatchRemoveMediaItemsFromAlbumRequest, BatchRemoveMediaItemsFromAlbumResponse> batchRemoveMediaItemsFromAlbumCallable() { return stub.batchRemoveMediaItemsFromAlbumCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class SearchMediaItemsPagedResponse extends AbstractPagedListResponse< SearchMediaItemsRequest, SearchMediaItemsResponse, MediaItem, SearchMediaItemsPage, SearchMediaItemsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = SearchMediaItemsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, new ApiFunction() { @Override public SearchMediaItemsPagedResponse apply(SearchMediaItemsPage input) { return new SearchMediaItemsPagedResponse(input); } }, MoreExecutors.directExecutor()); } private SearchMediaItemsPagedResponse(SearchMediaItemsPage page) { super(page, SearchMediaItemsFixedSizeCollection.createEmptyCollection()); } } public static class SearchMediaItemsPage extends AbstractPage< SearchMediaItemsRequest, SearchMediaItemsResponse, MediaItem, SearchMediaItemsPage> { private SearchMediaItemsPage( PageContext context, SearchMediaItemsResponse response) { super(context, response); } private static SearchMediaItemsPage createEmptyPage() { return new SearchMediaItemsPage(null, null); } @Override protected SearchMediaItemsPage createPage( PageContext context, SearchMediaItemsResponse response) { return new SearchMediaItemsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class SearchMediaItemsFixedSizeCollection extends AbstractFixedSizeCollection< SearchMediaItemsRequest, SearchMediaItemsResponse, MediaItem, SearchMediaItemsPage, SearchMediaItemsFixedSizeCollection> { private SearchMediaItemsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static SearchMediaItemsFixedSizeCollection createEmptyCollection() { return new SearchMediaItemsFixedSizeCollection(null, 0); } @Override protected SearchMediaItemsFixedSizeCollection createCollection( List pages, int collectionSize) { return new SearchMediaItemsFixedSizeCollection(pages, collectionSize); } } public static class ListMediaItemsPagedResponse extends AbstractPagedListResponse< ListMediaItemsRequest, ListMediaItemsResponse, MediaItem, ListMediaItemsPage, ListMediaItemsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListMediaItemsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, new ApiFunction() { @Override public ListMediaItemsPagedResponse apply(ListMediaItemsPage input) { return new ListMediaItemsPagedResponse(input); } }, MoreExecutors.directExecutor()); } private ListMediaItemsPagedResponse(ListMediaItemsPage page) { super(page, ListMediaItemsFixedSizeCollection.createEmptyCollection()); } } public static class ListMediaItemsPage extends AbstractPage< ListMediaItemsRequest, ListMediaItemsResponse, MediaItem, ListMediaItemsPage> { private ListMediaItemsPage( PageContext context, ListMediaItemsResponse response) { super(context, response); } private static ListMediaItemsPage createEmptyPage() { return new ListMediaItemsPage(null, null); } @Override protected ListMediaItemsPage createPage( PageContext context, ListMediaItemsResponse response) { return new ListMediaItemsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListMediaItemsFixedSizeCollection extends AbstractFixedSizeCollection< ListMediaItemsRequest, ListMediaItemsResponse, MediaItem, ListMediaItemsPage, ListMediaItemsFixedSizeCollection> { private ListMediaItemsFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListMediaItemsFixedSizeCollection createEmptyCollection() { return new ListMediaItemsFixedSizeCollection(null, 0); } @Override protected ListMediaItemsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListMediaItemsFixedSizeCollection(pages, collectionSize); } } public static class ListAlbumsPagedResponse extends AbstractPagedListResponse< ListAlbumsRequest, ListAlbumsResponse, Album, ListAlbumsPage, ListAlbumsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListAlbumsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, new ApiFunction() { @Override public ListAlbumsPagedResponse apply(ListAlbumsPage input) { return new ListAlbumsPagedResponse(input); } }, MoreExecutors.directExecutor()); } private ListAlbumsPagedResponse(ListAlbumsPage page) { super(page, ListAlbumsFixedSizeCollection.createEmptyCollection()); } } public static class ListAlbumsPage extends AbstractPage { private ListAlbumsPage( PageContext context, ListAlbumsResponse response) { super(context, response); } private static ListAlbumsPage createEmptyPage() { return new ListAlbumsPage(null, null); } @Override protected ListAlbumsPage createPage( PageContext context, ListAlbumsResponse response) { return new ListAlbumsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListAlbumsFixedSizeCollection extends AbstractFixedSizeCollection< ListAlbumsRequest, ListAlbumsResponse, Album, ListAlbumsPage, ListAlbumsFixedSizeCollection> { private ListAlbumsFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListAlbumsFixedSizeCollection createEmptyCollection() { return new ListAlbumsFixedSizeCollection(null, 0); } @Override protected ListAlbumsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListAlbumsFixedSizeCollection(pages, collectionSize); } } public static class ListSharedAlbumsPagedResponse extends AbstractPagedListResponse< ListSharedAlbumsRequest, ListSharedAlbumsResponse, Album, ListSharedAlbumsPage, ListSharedAlbumsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListSharedAlbumsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, new ApiFunction() { @Override public ListSharedAlbumsPagedResponse apply(ListSharedAlbumsPage input) { return new ListSharedAlbumsPagedResponse(input); } }, MoreExecutors.directExecutor()); } private ListSharedAlbumsPagedResponse(ListSharedAlbumsPage page) { super(page, ListSharedAlbumsFixedSizeCollection.createEmptyCollection()); } } public static class ListSharedAlbumsPage extends AbstractPage< ListSharedAlbumsRequest, ListSharedAlbumsResponse, Album, ListSharedAlbumsPage> { private ListSharedAlbumsPage( PageContext context, ListSharedAlbumsResponse response) { super(context, response); } private static ListSharedAlbumsPage createEmptyPage() { return new ListSharedAlbumsPage(null, null); } @Override protected ListSharedAlbumsPage createPage( PageContext context, ListSharedAlbumsResponse response) { return new ListSharedAlbumsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListSharedAlbumsFixedSizeCollection extends AbstractFixedSizeCollection< ListSharedAlbumsRequest, ListSharedAlbumsResponse, Album, ListSharedAlbumsPage, ListSharedAlbumsFixedSizeCollection> { private ListSharedAlbumsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListSharedAlbumsFixedSizeCollection createEmptyCollection() { return new ListSharedAlbumsFixedSizeCollection(null, 0); } @Override protected ListSharedAlbumsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListSharedAlbumsFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy