├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── photoslibraryapi ├── build.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── google │ │ └── photos │ │ ├── library │ │ └── v1 │ │ │ ├── PhotosLibraryClient.java │ │ │ ├── PhotosLibrarySettings.java │ │ │ ├── internal │ │ │ ├── InternalPhotosLibraryClient.java │ │ │ ├── InternalPhotosLibrarySettings.java │ │ │ ├── gapic_metadata.json │ │ │ ├── package-info.java │ │ │ └── stub │ │ │ │ ├── GrpcPhotosLibraryCallableFactory.java │ │ │ │ ├── GrpcPhotosLibraryStub.java │ │ │ │ ├── PhotosLibraryStub.java │ │ │ │ └── PhotosLibraryStubSettings.java │ │ │ ├── proto │ │ │ ├── AddEnrichmentToAlbumRequest.java │ │ │ ├── AddEnrichmentToAlbumRequestOrBuilder.java │ │ │ ├── AddEnrichmentToAlbumResponse.java │ │ │ ├── AddEnrichmentToAlbumResponseOrBuilder.java │ │ │ ├── AlbumPosition.java │ │ │ ├── AlbumPositionOrBuilder.java │ │ │ ├── BatchAddMediaItemsToAlbumRequest.java │ │ │ ├── BatchAddMediaItemsToAlbumRequestOrBuilder.java │ │ │ ├── BatchAddMediaItemsToAlbumResponse.java │ │ │ ├── BatchAddMediaItemsToAlbumResponseOrBuilder.java │ │ │ ├── BatchCreateMediaItemsRequest.java │ │ │ ├── BatchCreateMediaItemsRequestOrBuilder.java │ │ │ ├── BatchCreateMediaItemsResponse.java │ │ │ ├── BatchCreateMediaItemsResponseOrBuilder.java │ │ │ ├── BatchGetMediaItemsRequest.java │ │ │ ├── BatchGetMediaItemsRequestOrBuilder.java │ │ │ ├── BatchGetMediaItemsResponse.java │ │ │ ├── BatchGetMediaItemsResponseOrBuilder.java │ │ │ ├── BatchRemoveMediaItemsFromAlbumRequest.java │ │ │ ├── BatchRemoveMediaItemsFromAlbumRequestOrBuilder.java │ │ │ ├── BatchRemoveMediaItemsFromAlbumResponse.java │ │ │ ├── BatchRemoveMediaItemsFromAlbumResponseOrBuilder.java │ │ │ ├── ContentCategory.java │ │ │ ├── ContentFilter.java │ │ │ ├── ContentFilterOrBuilder.java │ │ │ ├── CreateAlbumRequest.java │ │ │ ├── CreateAlbumRequestOrBuilder.java │ │ │ ├── DateFilter.java │ │ │ ├── DateFilterOrBuilder.java │ │ │ ├── EnrichmentItem.java │ │ │ ├── EnrichmentItemOrBuilder.java │ │ │ ├── FeatureFilter.java │ │ │ ├── FeatureFilterOrBuilder.java │ │ │ ├── Filters.java │ │ │ ├── FiltersOrBuilder.java │ │ │ ├── GetAlbumRequest.java │ │ │ ├── GetAlbumRequestOrBuilder.java │ │ │ ├── GetMediaItemRequest.java │ │ │ ├── GetMediaItemRequestOrBuilder.java │ │ │ ├── GetSharedAlbumRequest.java │ │ │ ├── GetSharedAlbumRequestOrBuilder.java │ │ │ ├── JoinSharedAlbumRequest.java │ │ │ ├── JoinSharedAlbumRequestOrBuilder.java │ │ │ ├── JoinSharedAlbumResponse.java │ │ │ ├── JoinSharedAlbumResponseOrBuilder.java │ │ │ ├── LeaveSharedAlbumRequest.java │ │ │ ├── LeaveSharedAlbumRequestOrBuilder.java │ │ │ ├── LeaveSharedAlbumResponse.java │ │ │ ├── LeaveSharedAlbumResponseOrBuilder.java │ │ │ ├── LibraryServiceProto.java │ │ │ ├── ListAlbumsRequest.java │ │ │ ├── ListAlbumsRequestOrBuilder.java │ │ │ ├── ListAlbumsResponse.java │ │ │ ├── ListAlbumsResponseOrBuilder.java │ │ │ ├── ListMediaItemsRequest.java │ │ │ ├── ListMediaItemsRequestOrBuilder.java │ │ │ ├── ListMediaItemsResponse.java │ │ │ ├── ListMediaItemsResponseOrBuilder.java │ │ │ ├── ListSharedAlbumsRequest.java │ │ │ ├── ListSharedAlbumsRequestOrBuilder.java │ │ │ ├── ListSharedAlbumsResponse.java │ │ │ ├── ListSharedAlbumsResponseOrBuilder.java │ │ │ ├── Location.java │ │ │ ├── LocationEnrichment.java │ │ │ ├── LocationEnrichmentOrBuilder.java │ │ │ ├── LocationOrBuilder.java │ │ │ ├── MapEnrichment.java │ │ │ ├── MapEnrichmentOrBuilder.java │ │ │ ├── MediaItemResult.java │ │ │ ├── MediaItemResultOrBuilder.java │ │ │ ├── MediaTypeFilter.java │ │ │ ├── MediaTypeFilterOrBuilder.java │ │ │ ├── NewEnrichmentItem.java │ │ │ ├── NewEnrichmentItemOrBuilder.java │ │ │ ├── NewMediaItem.java │ │ │ ├── NewMediaItemOrBuilder.java │ │ │ ├── NewMediaItemResult.java │ │ │ ├── NewMediaItemResultOrBuilder.java │ │ │ ├── PhotosLibraryGrpc.java │ │ │ ├── SearchMediaItemsRequest.java │ │ │ ├── SearchMediaItemsRequestOrBuilder.java │ │ │ ├── SearchMediaItemsResponse.java │ │ │ ├── SearchMediaItemsResponseOrBuilder.java │ │ │ ├── ShareAlbumRequest.java │ │ │ ├── ShareAlbumRequestOrBuilder.java │ │ │ ├── ShareAlbumResponse.java │ │ │ ├── ShareAlbumResponseOrBuilder.java │ │ │ ├── SimpleMediaItem.java │ │ │ ├── SimpleMediaItemOrBuilder.java │ │ │ ├── TextEnrichment.java │ │ │ ├── TextEnrichmentOrBuilder.java │ │ │ ├── UnshareAlbumRequest.java │ │ │ ├── UnshareAlbumRequestOrBuilder.java │ │ │ ├── UnshareAlbumResponse.java │ │ │ ├── UnshareAlbumResponseOrBuilder.java │ │ │ ├── UpdateAlbumRequest.java │ │ │ ├── UpdateAlbumRequestOrBuilder.java │ │ │ ├── UpdateMediaItemRequest.java │ │ │ └── UpdateMediaItemRequestOrBuilder.java │ │ │ ├── upload │ │ │ ├── ExceptionStrings.java │ │ │ ├── NestedUploadRetryCallable.java │ │ │ ├── PhotosLibraryUploadCallable.java │ │ │ ├── PhotosLibraryUploadExceptionMappingFn.java │ │ │ ├── PhotosLibraryUploadStub.java │ │ │ ├── PhotosLibraryUploadStubImpl.java │ │ │ ├── PhotosLibraryUploadUnaryCallable.java │ │ │ ├── UploadApiException.java │ │ │ ├── UploadMediaItemRequest.java │ │ │ ├── UploadMediaItemResponse.java │ │ │ └── UploadRetryCallable.java │ │ │ └── util │ │ │ ├── AlbumPositionFactory.java │ │ │ ├── NewEnrichmentItemFactory.java │ │ │ ├── NewMediaItemFactory.java │ │ │ └── OrderBy.java │ │ └── types │ │ └── proto │ │ ├── Album.java │ │ ├── AlbumOrBuilder.java │ │ ├── AlbumProto.java │ │ ├── ContributorInfo.java │ │ ├── ContributorInfoOrBuilder.java │ │ ├── DateRange.java │ │ ├── DateRangeOrBuilder.java │ │ ├── DateRangeProto.java │ │ ├── MediaItem.java │ │ ├── MediaItemOrBuilder.java │ │ ├── MediaItemProto.java │ │ ├── MediaMetadata.java │ │ ├── MediaMetadataOrBuilder.java │ │ ├── Photo.java │ │ ├── PhotoOrBuilder.java │ │ ├── ShareInfo.java │ │ ├── ShareInfoOrBuilder.java │ │ ├── SharedAlbumOptions.java │ │ ├── SharedAlbumOptionsOrBuilder.java │ │ ├── Video.java │ │ ├── VideoOrBuilder.java │ │ └── VideoProcessingStatus.java │ └── test │ └── java │ └── com │ └── google │ └── photos │ └── library │ └── v1 │ ├── PhotosLibraryClientTest.java │ ├── internal │ ├── InternalPhotosLibraryClientTest.java │ ├── MockPhotosLibrary.java │ └── MockPhotosLibraryImpl.java │ └── upload │ ├── PhotosLibraryUploadCallableTest.java │ └── UploadRetryCallableTest.java ├── sample ├── README.md ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── google │ │ └── photos │ │ └── library │ │ └── sample │ │ ├── Resources.java │ │ ├── components │ │ ├── AbstractCreateAlbumToolPanel.java │ │ ├── AlbumPreviewPanel.java │ │ ├── AppPanel.java │ │ ├── ConnectToPhotosButton.java │ │ ├── CreateAlbumToolPanel.java │ │ ├── CustomButton.java │ │ ├── DatePickerPanel.java │ │ ├── LoadMoreButton.java │ │ ├── OrderByPanel.java │ │ ├── PlainCreateAlbumToolPanel.java │ │ ├── SearchToolPanel.java │ │ ├── ShareAlbumToolPanel.java │ │ ├── ShareAndJoinAlbumToolPanel.java │ │ ├── ShareableAlbumToolPanel.java │ │ ├── ToolPanel.java │ │ └── UploadToAlbumToolPanel.java │ │ ├── demos │ │ ├── AlbumDemo.java │ │ ├── FilterDemo.java │ │ ├── ShareDemo.java │ │ ├── UploadDemo.java │ │ └── upload │ │ │ ├── UploadDemoHelper.java │ │ │ ├── Uploader.java │ │ │ └── tasks │ │ │ ├── ByteUploadTask.java │ │ │ └── ItemCreationTask.java │ │ ├── factories │ │ └── PhotosLibraryClientFactory.java │ │ ├── helpers │ │ ├── ErrorHelper.java │ │ └── UIHelper.java │ │ ├── suppliers │ │ ├── AlbumsSupplier.java │ │ ├── ListAlbumsSupplier.java │ │ ├── ListSharedAlbumsSupplier.java │ │ └── SearchMediaItemSupplier.java │ │ └── views │ │ ├── AbstractCustomView.java │ │ ├── AlbumListView.java │ │ ├── ConnectToPhotosView.java │ │ ├── LoadingView.java │ │ ├── PhotoListView.java │ │ ├── PhotoView.java │ │ └── SearchMediaItemView.java │ └── resources │ └── assets │ ├── album.png │ ├── back.png │ ├── filter.png │ ├── google_photos.png │ └── share.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Intellij IDEA metadata 2 | .idea 3 | *.iml 4 | 5 | # Gradle and build directories 6 | .gradle 7 | build/ 8 | out/ 9 | 10 | # Ignore Gradle GUI config 11 | gradle-app.setting 12 | 13 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 14 | !gradle-wrapper.jar 15 | 16 | # Cache of project 17 | .gradletasknamecache 18 | 19 | # .DS_Store 20 | .DS_Store 21 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution; 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult 22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 23 | information on using pull requests. 24 | 25 | ## Community Guidelines 26 | 27 | This project follows [Google's Open Source Community 28 | Guidelines](https://opensource.google.com/conduct/). 29 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | buildscript { 18 | 19 | repositories { 20 | maven { 21 | url 'https://plugins.gradle.org/m2/' 22 | } 23 | } 24 | dependencies { 25 | classpath 'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8' 26 | } 27 | } 28 | 29 | subprojects { 30 | apply plugin: 'java' 31 | apply plugin: 'com.github.sherter.google-java-format' 32 | 33 | repositories { 34 | mavenCentral() 35 | mavenLocal() 36 | } 37 | 38 | tasks.googleJavaFormat { 39 | exclude 'bin/**' 40 | exclude 'build/**' 41 | } 42 | tasks.verifyGoogleJavaFormat { 43 | exclude 'bin/**' 44 | exclude 'build/**' 45 | } 46 | test.dependsOn verifyGoogleJavaFormat 47 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | sonatypeUsername= 2 | sonatypePassword= -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/java-photoslibrary/fe3e366c2264774d78f6ae684c5842803ca2c02b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | 88 | @rem Execute Gradle 89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 90 | 91 | :end 92 | @rem End local scope for the variables with windows NT shell 93 | if "%ERRORLEVEL%"=="0" goto mainEnd 94 | 95 | :fail 96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 97 | rem the _cmd.exe /c_ return code! 98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 99 | exit /b 1 100 | 101 | :mainEnd 102 | if "%OS%"=="Windows_NT" endlocal 103 | 104 | :omega 105 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/internal/gapic_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "1.0", 3 | "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", 4 | "language": "java", 5 | "protoPackage": "google.photos.library.v1", 6 | "libraryPackage": "com.google.photos.library.v1.internal", 7 | "services": { 8 | "PhotosLibrary": { 9 | "clients": { 10 | "grpc": { 11 | "libraryClient": "InternalPhotosLibraryClient", 12 | "rpcs": { 13 | "AddEnrichmentToAlbum": { 14 | "methods": ["addEnrichmentToAlbum", "addEnrichmentToAlbum", "addEnrichmentToAlbumCallable"] 15 | }, 16 | "BatchAddMediaItemsToAlbum": { 17 | "methods": ["batchAddMediaItemsToAlbum", "batchAddMediaItemsToAlbum", "batchAddMediaItemsToAlbumCallable"] 18 | }, 19 | "BatchCreateMediaItems": { 20 | "methods": ["batchCreateMediaItems", "batchCreateMediaItems", "batchCreateMediaItemsCallable"] 21 | }, 22 | "BatchGetMediaItems": { 23 | "methods": ["batchGetMediaItems", "batchGetMediaItems", "batchGetMediaItemsCallable"] 24 | }, 25 | "BatchRemoveMediaItemsFromAlbum": { 26 | "methods": ["batchRemoveMediaItemsFromAlbum", "batchRemoveMediaItemsFromAlbum", "batchRemoveMediaItemsFromAlbumCallable"] 27 | }, 28 | "CreateAlbum": { 29 | "methods": ["createAlbum", "createAlbum", "createAlbumCallable"] 30 | }, 31 | "GetAlbum": { 32 | "methods": ["getAlbum", "getAlbum", "getAlbumCallable"] 33 | }, 34 | "GetMediaItem": { 35 | "methods": ["getMediaItem", "getMediaItem", "getMediaItemCallable"] 36 | }, 37 | "GetSharedAlbum": { 38 | "methods": ["getSharedAlbum", "getSharedAlbum", "getSharedAlbumCallable"] 39 | }, 40 | "JoinSharedAlbum": { 41 | "methods": ["joinSharedAlbum", "joinSharedAlbum", "joinSharedAlbumCallable"] 42 | }, 43 | "LeaveSharedAlbum": { 44 | "methods": ["leaveSharedAlbum", "leaveSharedAlbum", "leaveSharedAlbumCallable"] 45 | }, 46 | "ListAlbums": { 47 | "methods": ["listAlbums", "listAlbums", "listAlbumsPagedCallable", "listAlbumsCallable"] 48 | }, 49 | "ListMediaItems": { 50 | "methods": ["listMediaItems", "listMediaItemsPagedCallable", "listMediaItemsCallable"] 51 | }, 52 | "ListSharedAlbums": { 53 | "methods": ["listSharedAlbums", "listSharedAlbums", "listSharedAlbumsPagedCallable", "listSharedAlbumsCallable"] 54 | }, 55 | "SearchMediaItems": { 56 | "methods": ["searchMediaItems", "searchMediaItems", "searchMediaItems", "searchMediaItems", "searchMediaItemsPagedCallable", "searchMediaItemsCallable"] 57 | }, 58 | "ShareAlbum": { 59 | "methods": ["shareAlbum", "shareAlbum", "shareAlbumCallable"] 60 | }, 61 | "UnshareAlbum": { 62 | "methods": ["unshareAlbum", "unshareAlbum", "unshareAlbumCallable"] 63 | }, 64 | "UpdateAlbum": { 65 | "methods": ["updateAlbum", "updateAlbum", "updateAlbum", "updateAlbumCallable"] 66 | }, 67 | "UpdateMediaItem": { 68 | "methods": ["updateMediaItem", "updateMediaItem", "updateMediaItemCallable"] 69 | } 70 | } 71 | } 72 | } 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * The interfaces provided are listed below, along with usage samples. 19 | * 20 | *

======================= InternalPhotosLibraryClient ======================= 21 | * 22 | *

Service Description: Service which allows developers to perform the following actions on 23 | * behalf of the user: - upload media items directly to their Google Photos library - create albums 24 | * - add media items (including album enrichments) to albums - list and download content from their 25 | * Google Photos library - filter results by media type, date range or content category - create, 26 | * join, and access shared albums 27 | * 28 | *

Sample for InternalPhotosLibraryClient: 29 | * 30 | *

{@code
31 |  * // This snippet has been automatically generated and should be regarded as a code template only.
32 |  * // It will require modifications to work:
33 |  * // - It may require correct/in-range values for request initialization.
34 |  * // - It may require specifying regional endpoints when creating the service client as shown in
35 |  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
36 |  * try (InternalPhotosLibraryClient internalPhotosLibraryClient =
37 |  *     InternalPhotosLibraryClient.create()) {
38 |  *   Album album = Album.newBuilder().build();
39 |  *   Album response = internalPhotosLibraryClient.createAlbum(album);
40 |  * }
41 |  * }
42 | */ 43 | @Generated("by gapic-generator-java") 44 | package com.google.photos.library.v1.internal; 45 | 46 | import javax.annotation.Generated; 47 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/AddEnrichmentToAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface AddEnrichmentToAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.AddEnrichmentToAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * Required. Identifier of the album where the enrichment is to be added.
 16 |    * 
17 | * 18 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 19 | * 20 | * @return The albumId. 21 | */ 22 | java.lang.String getAlbumId(); 23 | /** 24 | * 25 | * 26 | *
 27 |    * Required. Identifier of the album where the enrichment is to be added.
 28 |    * 
29 | * 30 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 31 | * 32 | * @return The bytes for albumId. 33 | */ 34 | com.google.protobuf.ByteString getAlbumIdBytes(); 35 | 36 | /** 37 | * 38 | * 39 | *
 40 |    * Required. The enrichment to be added.
 41 |    * 
42 | * 43 | * 44 | * .google.photos.library.v1.NewEnrichmentItem new_enrichment_item = 2 [(.google.api.field_behavior) = REQUIRED]; 45 | * 46 | * 47 | * @return Whether the newEnrichmentItem field is set. 48 | */ 49 | boolean hasNewEnrichmentItem(); 50 | /** 51 | * 52 | * 53 | *
 54 |    * Required. The enrichment to be added.
 55 |    * 
56 | * 57 | * 58 | * .google.photos.library.v1.NewEnrichmentItem new_enrichment_item = 2 [(.google.api.field_behavior) = REQUIRED]; 59 | * 60 | * 61 | * @return The newEnrichmentItem. 62 | */ 63 | com.google.photos.library.v1.proto.NewEnrichmentItem getNewEnrichmentItem(); 64 | /** 65 | * 66 | * 67 | *
 68 |    * Required. The enrichment to be added.
 69 |    * 
70 | * 71 | * 72 | * .google.photos.library.v1.NewEnrichmentItem new_enrichment_item = 2 [(.google.api.field_behavior) = REQUIRED]; 73 | * 74 | */ 75 | com.google.photos.library.v1.proto.NewEnrichmentItemOrBuilder getNewEnrichmentItemOrBuilder(); 76 | 77 | /** 78 | * 79 | * 80 | *
 81 |    * Required. The position in the album where the enrichment is to be inserted.
 82 |    * 
83 | * 84 | * 85 | * .google.photos.library.v1.AlbumPosition album_position = 3 [(.google.api.field_behavior) = REQUIRED]; 86 | * 87 | * 88 | * @return Whether the albumPosition field is set. 89 | */ 90 | boolean hasAlbumPosition(); 91 | /** 92 | * 93 | * 94 | *
 95 |    * Required. The position in the album where the enrichment is to be inserted.
 96 |    * 
97 | * 98 | * 99 | * .google.photos.library.v1.AlbumPosition album_position = 3 [(.google.api.field_behavior) = REQUIRED]; 100 | * 101 | * 102 | * @return The albumPosition. 103 | */ 104 | com.google.photos.library.v1.proto.AlbumPosition getAlbumPosition(); 105 | /** 106 | * 107 | * 108 | *
109 |    * Required. The position in the album where the enrichment is to be inserted.
110 |    * 
111 | * 112 | * 113 | * .google.photos.library.v1.AlbumPosition album_position = 3 [(.google.api.field_behavior) = REQUIRED]; 114 | * 115 | */ 116 | com.google.photos.library.v1.proto.AlbumPositionOrBuilder getAlbumPositionOrBuilder(); 117 | } 118 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/AddEnrichmentToAlbumResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface AddEnrichmentToAlbumResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.AddEnrichmentToAlbumResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. Enrichment which was added.
16 |    * 
17 | * 18 | * .google.photos.library.v1.EnrichmentItem enrichment_item = 1; 19 | * 20 | * @return Whether the enrichmentItem field is set. 21 | */ 22 | boolean hasEnrichmentItem(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Output only. Enrichment which was added.
28 |    * 
29 | * 30 | * .google.photos.library.v1.EnrichmentItem enrichment_item = 1; 31 | * 32 | * @return The enrichmentItem. 33 | */ 34 | com.google.photos.library.v1.proto.EnrichmentItem getEnrichmentItem(); 35 | /** 36 | * 37 | * 38 | *
39 |    * Output only. Enrichment which was added.
40 |    * 
41 | * 42 | * .google.photos.library.v1.EnrichmentItem enrichment_item = 1; 43 | */ 44 | com.google.photos.library.v1.proto.EnrichmentItemOrBuilder getEnrichmentItemOrBuilder(); 45 | } 46 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/AlbumPositionOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface AlbumPositionOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.AlbumPosition) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * Type of position, for a media or enrichment item.
 16 |    * 
17 | * 18 | * .google.photos.library.v1.AlbumPosition.PositionType position = 1; 19 | * 20 | * @return The enum numeric value on the wire for position. 21 | */ 22 | int getPositionValue(); 23 | /** 24 | * 25 | * 26 | *
 27 |    * Type of position, for a media or enrichment item.
 28 |    * 
29 | * 30 | * .google.photos.library.v1.AlbumPosition.PositionType position = 1; 31 | * 32 | * @return The position. 33 | */ 34 | com.google.photos.library.v1.proto.AlbumPosition.PositionType getPosition(); 35 | 36 | /** 37 | * 38 | * 39 | *
 40 |    * The media item to which the position is relative to.
 41 |    * Only used when position type is AFTER_MEDIA_ITEM.
 42 |    * 
43 | * 44 | * string relative_media_item_id = 2; 45 | * 46 | * @return Whether the relativeMediaItemId field is set. 47 | */ 48 | boolean hasRelativeMediaItemId(); 49 | /** 50 | * 51 | * 52 | *
 53 |    * The media item to which the position is relative to.
 54 |    * Only used when position type is AFTER_MEDIA_ITEM.
 55 |    * 
56 | * 57 | * string relative_media_item_id = 2; 58 | * 59 | * @return The relativeMediaItemId. 60 | */ 61 | java.lang.String getRelativeMediaItemId(); 62 | /** 63 | * 64 | * 65 | *
 66 |    * The media item to which the position is relative to.
 67 |    * Only used when position type is AFTER_MEDIA_ITEM.
 68 |    * 
69 | * 70 | * string relative_media_item_id = 2; 71 | * 72 | * @return The bytes for relativeMediaItemId. 73 | */ 74 | com.google.protobuf.ByteString getRelativeMediaItemIdBytes(); 75 | 76 | /** 77 | * 78 | * 79 | *
 80 |    * The enrichment item to which the position is relative to.
 81 |    * Only used when position type is AFTER_ENRICHMENT_ITEM.
 82 |    * 
83 | * 84 | * string relative_enrichment_item_id = 3; 85 | * 86 | * @return Whether the relativeEnrichmentItemId field is set. 87 | */ 88 | boolean hasRelativeEnrichmentItemId(); 89 | /** 90 | * 91 | * 92 | *
 93 |    * The enrichment item to which the position is relative to.
 94 |    * Only used when position type is AFTER_ENRICHMENT_ITEM.
 95 |    * 
96 | * 97 | * string relative_enrichment_item_id = 3; 98 | * 99 | * @return The relativeEnrichmentItemId. 100 | */ 101 | java.lang.String getRelativeEnrichmentItemId(); 102 | /** 103 | * 104 | * 105 | *
106 |    * The enrichment item to which the position is relative to.
107 |    * Only used when position type is AFTER_ENRICHMENT_ITEM.
108 |    * 
109 | * 110 | * string relative_enrichment_item_id = 3; 111 | * 112 | * @return The bytes for relativeEnrichmentItemId. 113 | */ 114 | com.google.protobuf.ByteString getRelativeEnrichmentItemIdBytes(); 115 | 116 | public com.google.photos.library.v1.proto.AlbumPosition.RelativeItemCase getRelativeItemCase(); 117 | } 118 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/BatchAddMediaItemsToAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface BatchAddMediaItemsToAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.BatchAddMediaItemsToAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
16 |    * be added. The maximum number of media items that can be added in one call
17 |    * is 50.
18 |    * 
19 | * 20 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 21 | * 22 | * @return A list containing the mediaItemIds. 23 | */ 24 | java.util.List getMediaItemIdsList(); 25 | /** 26 | * 27 | * 28 | *
29 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
30 |    * be added. The maximum number of media items that can be added in one call
31 |    * is 50.
32 |    * 
33 | * 34 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 35 | * 36 | * @return The count of mediaItemIds. 37 | */ 38 | int getMediaItemIdsCount(); 39 | /** 40 | * 41 | * 42 | *
43 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
44 |    * be added. The maximum number of media items that can be added in one call
45 |    * is 50.
46 |    * 
47 | * 48 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 49 | * 50 | * @param index The index of the element to return. 51 | * @return The mediaItemIds at the given index. 52 | */ 53 | java.lang.String getMediaItemIds(int index); 54 | /** 55 | * 56 | * 57 | *
58 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
59 |    * be added. The maximum number of media items that can be added in one call
60 |    * is 50.
61 |    * 
62 | * 63 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 64 | * 65 | * @param index The index of the value to return. 66 | * @return The bytes of the mediaItemIds at the given index. 67 | */ 68 | com.google.protobuf.ByteString getMediaItemIdsBytes(int index); 69 | 70 | /** 71 | * 72 | * 73 | *
74 |    * Required. Identifier of the [Album][google.photos.types.Album] that the
75 |    * media items are added to.
76 |    * 
77 | * 78 | * string album_id = 2 [(.google.api.field_behavior) = REQUIRED]; 79 | * 80 | * @return The albumId. 81 | */ 82 | java.lang.String getAlbumId(); 83 | /** 84 | * 85 | * 86 | *
87 |    * Required. Identifier of the [Album][google.photos.types.Album] that the
88 |    * media items are added to.
89 |    * 
90 | * 91 | * string album_id = 2 [(.google.api.field_behavior) = REQUIRED]; 92 | * 93 | * @return The bytes for albumId. 94 | */ 95 | com.google.protobuf.ByteString getAlbumIdBytes(); 96 | } 97 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/BatchAddMediaItemsToAlbumResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface BatchAddMediaItemsToAlbumResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.BatchAddMediaItemsToAlbumResponse) 9 | com.google.protobuf.MessageOrBuilder {} 10 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/BatchCreateMediaItemsResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface BatchCreateMediaItemsResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.BatchCreateMediaItemsResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. List of media items created.
16 |    * 
17 | * 18 | * repeated .google.photos.library.v1.NewMediaItemResult new_media_item_results = 1; 19 | */ 20 | java.util.List 21 | getNewMediaItemResultsList(); 22 | /** 23 | * 24 | * 25 | *
26 |    * Output only. List of media items created.
27 |    * 
28 | * 29 | * repeated .google.photos.library.v1.NewMediaItemResult new_media_item_results = 1; 30 | */ 31 | com.google.photos.library.v1.proto.NewMediaItemResult getNewMediaItemResults(int index); 32 | /** 33 | * 34 | * 35 | *
36 |    * Output only. List of media items created.
37 |    * 
38 | * 39 | * repeated .google.photos.library.v1.NewMediaItemResult new_media_item_results = 1; 40 | */ 41 | int getNewMediaItemResultsCount(); 42 | /** 43 | * 44 | * 45 | *
46 |    * Output only. List of media items created.
47 |    * 
48 | * 49 | * repeated .google.photos.library.v1.NewMediaItemResult new_media_item_results = 1; 50 | */ 51 | java.util.List 52 | getNewMediaItemResultsOrBuilderList(); 53 | /** 54 | * 55 | * 56 | *
57 |    * Output only. List of media items created.
58 |    * 
59 | * 60 | * repeated .google.photos.library.v1.NewMediaItemResult new_media_item_results = 1; 61 | */ 62 | com.google.photos.library.v1.proto.NewMediaItemResultOrBuilder getNewMediaItemResultsOrBuilder( 63 | int index); 64 | } 65 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/BatchGetMediaItemsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface BatchGetMediaItemsRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.BatchGetMediaItemsRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Identifiers of the media items to be requested.
16 |    * Must not contain repeated identifiers and cannot be empty. The maximum
17 |    * number of media items that can be retrieved in one call is 50.
18 |    * 
19 | * 20 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 21 | * 22 | * @return A list containing the mediaItemIds. 23 | */ 24 | java.util.List getMediaItemIdsList(); 25 | /** 26 | * 27 | * 28 | *
29 |    * Required. Identifiers of the media items to be requested.
30 |    * Must not contain repeated identifiers and cannot be empty. The maximum
31 |    * number of media items that can be retrieved in one call is 50.
32 |    * 
33 | * 34 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 35 | * 36 | * @return The count of mediaItemIds. 37 | */ 38 | int getMediaItemIdsCount(); 39 | /** 40 | * 41 | * 42 | *
43 |    * Required. Identifiers of the media items to be requested.
44 |    * Must not contain repeated identifiers and cannot be empty. The maximum
45 |    * number of media items that can be retrieved in one call is 50.
46 |    * 
47 | * 48 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 49 | * 50 | * @param index The index of the element to return. 51 | * @return The mediaItemIds at the given index. 52 | */ 53 | java.lang.String getMediaItemIds(int index); 54 | /** 55 | * 56 | * 57 | *
58 |    * Required. Identifiers of the media items to be requested.
59 |    * Must not contain repeated identifiers and cannot be empty. The maximum
60 |    * number of media items that can be retrieved in one call is 50.
61 |    * 
62 | * 63 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 64 | * 65 | * @param index The index of the value to return. 66 | * @return The bytes of the mediaItemIds at the given index. 67 | */ 68 | com.google.protobuf.ByteString getMediaItemIdsBytes(int index); 69 | } 70 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/BatchGetMediaItemsResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface BatchGetMediaItemsResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.BatchGetMediaItemsResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. List of media items retrieved.
16 |    * Note that even if the call to BatchGetMediaItems succeeds, there may have
17 |    * been failures for some media items in the batch. These failures are
18 |    * indicated in each
19 |    * [MediaItemResult.status][google.photos.library.v1.MediaItemResult.status].
20 |    * 
21 | * 22 | * repeated .google.photos.library.v1.MediaItemResult media_item_results = 1; 23 | */ 24 | java.util.List getMediaItemResultsList(); 25 | /** 26 | * 27 | * 28 | *
29 |    * Output only. List of media items retrieved.
30 |    * Note that even if the call to BatchGetMediaItems succeeds, there may have
31 |    * been failures for some media items in the batch. These failures are
32 |    * indicated in each
33 |    * [MediaItemResult.status][google.photos.library.v1.MediaItemResult.status].
34 |    * 
35 | * 36 | * repeated .google.photos.library.v1.MediaItemResult media_item_results = 1; 37 | */ 38 | com.google.photos.library.v1.proto.MediaItemResult getMediaItemResults(int index); 39 | /** 40 | * 41 | * 42 | *
43 |    * Output only. List of media items retrieved.
44 |    * Note that even if the call to BatchGetMediaItems succeeds, there may have
45 |    * been failures for some media items in the batch. These failures are
46 |    * indicated in each
47 |    * [MediaItemResult.status][google.photos.library.v1.MediaItemResult.status].
48 |    * 
49 | * 50 | * repeated .google.photos.library.v1.MediaItemResult media_item_results = 1; 51 | */ 52 | int getMediaItemResultsCount(); 53 | /** 54 | * 55 | * 56 | *
57 |    * Output only. List of media items retrieved.
58 |    * Note that even if the call to BatchGetMediaItems succeeds, there may have
59 |    * been failures for some media items in the batch. These failures are
60 |    * indicated in each
61 |    * [MediaItemResult.status][google.photos.library.v1.MediaItemResult.status].
62 |    * 
63 | * 64 | * repeated .google.photos.library.v1.MediaItemResult media_item_results = 1; 65 | */ 66 | java.util.List 67 | getMediaItemResultsOrBuilderList(); 68 | /** 69 | * 70 | * 71 | *
72 |    * Output only. List of media items retrieved.
73 |    * Note that even if the call to BatchGetMediaItems succeeds, there may have
74 |    * been failures for some media items in the batch. These failures are
75 |    * indicated in each
76 |    * [MediaItemResult.status][google.photos.library.v1.MediaItemResult.status].
77 |    * 
78 | * 79 | * repeated .google.photos.library.v1.MediaItemResult media_item_results = 1; 80 | */ 81 | com.google.photos.library.v1.proto.MediaItemResultOrBuilder getMediaItemResultsOrBuilder( 82 | int index); 83 | } 84 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/BatchRemoveMediaItemsFromAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface BatchRemoveMediaItemsFromAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.BatchRemoveMediaItemsFromAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
 16 |    * be removed.
 17 |    * Must not contain repeated identifiers and cannot be empty. The maximum
 18 |    * number of media items that can be removed in one call is 50.
 19 |    * 
20 | * 21 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 22 | * 23 | * @return A list containing the mediaItemIds. 24 | */ 25 | java.util.List getMediaItemIdsList(); 26 | /** 27 | * 28 | * 29 | *
 30 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
 31 |    * be removed.
 32 |    * Must not contain repeated identifiers and cannot be empty. The maximum
 33 |    * number of media items that can be removed in one call is 50.
 34 |    * 
35 | * 36 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 37 | * 38 | * @return The count of mediaItemIds. 39 | */ 40 | int getMediaItemIdsCount(); 41 | /** 42 | * 43 | * 44 | *
 45 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
 46 |    * be removed.
 47 |    * Must not contain repeated identifiers and cannot be empty. The maximum
 48 |    * number of media items that can be removed in one call is 50.
 49 |    * 
50 | * 51 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 52 | * 53 | * @param index The index of the element to return. 54 | * @return The mediaItemIds at the given index. 55 | */ 56 | java.lang.String getMediaItemIds(int index); 57 | /** 58 | * 59 | * 60 | *
 61 |    * Required. Identifiers of the [MediaItem][google.photos.types.MediaItem]s to
 62 |    * be removed.
 63 |    * Must not contain repeated identifiers and cannot be empty. The maximum
 64 |    * number of media items that can be removed in one call is 50.
 65 |    * 
66 | * 67 | * repeated string media_item_ids = 1 [(.google.api.field_behavior) = REQUIRED]; 68 | * 69 | * @param index The index of the value to return. 70 | * @return The bytes of the mediaItemIds at the given index. 71 | */ 72 | com.google.protobuf.ByteString getMediaItemIdsBytes(int index); 73 | 74 | /** 75 | * 76 | * 77 | *
 78 |    * Required. Identifier of the [Album][google.photos.types.Album] that the
 79 |    * media items are to be removed from.
 80 |    * 
81 | * 82 | * string album_id = 2 [(.google.api.field_behavior) = REQUIRED]; 83 | * 84 | * @return The albumId. 85 | */ 86 | java.lang.String getAlbumId(); 87 | /** 88 | * 89 | * 90 | *
 91 |    * Required. Identifier of the [Album][google.photos.types.Album] that the
 92 |    * media items are to be removed from.
 93 |    * 
94 | * 95 | * string album_id = 2 [(.google.api.field_behavior) = REQUIRED]; 96 | * 97 | * @return The bytes for albumId. 98 | */ 99 | com.google.protobuf.ByteString getAlbumIdBytes(); 100 | } 101 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/BatchRemoveMediaItemsFromAlbumResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface BatchRemoveMediaItemsFromAlbumResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.BatchRemoveMediaItemsFromAlbumResponse) 9 | com.google.protobuf.MessageOrBuilder {} 10 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/CreateAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface CreateAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.CreateAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. The album to be created.
16 |    * 
17 | * 18 | * .google.photos.types.Album album = 1 [(.google.api.field_behavior) = REQUIRED]; 19 | * 20 | * @return Whether the album field is set. 21 | */ 22 | boolean hasAlbum(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Required. The album to be created.
28 |    * 
29 | * 30 | * .google.photos.types.Album album = 1 [(.google.api.field_behavior) = REQUIRED]; 31 | * 32 | * @return The album. 33 | */ 34 | com.google.photos.types.proto.Album getAlbum(); 35 | /** 36 | * 37 | * 38 | *
39 |    * Required. The album to be created.
40 |    * 
41 | * 42 | * .google.photos.types.Album album = 1 [(.google.api.field_behavior) = REQUIRED]; 43 | */ 44 | com.google.photos.types.proto.AlbumOrBuilder getAlbumOrBuilder(); 45 | } 46 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/DateFilterOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface DateFilterOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.DateFilter) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * List of dates that match the media items' creation date. A maximum of
 16 |    * 5 dates can be included per request.
 17 |    * 
18 | * 19 | * repeated .google.type.Date dates = 1; 20 | */ 21 | java.util.List getDatesList(); 22 | /** 23 | * 24 | * 25 | *
 26 |    * List of dates that match the media items' creation date. A maximum of
 27 |    * 5 dates can be included per request.
 28 |    * 
29 | * 30 | * repeated .google.type.Date dates = 1; 31 | */ 32 | com.google.type.Date getDates(int index); 33 | /** 34 | * 35 | * 36 | *
 37 |    * List of dates that match the media items' creation date. A maximum of
 38 |    * 5 dates can be included per request.
 39 |    * 
40 | * 41 | * repeated .google.type.Date dates = 1; 42 | */ 43 | int getDatesCount(); 44 | /** 45 | * 46 | * 47 | *
 48 |    * List of dates that match the media items' creation date. A maximum of
 49 |    * 5 dates can be included per request.
 50 |    * 
51 | * 52 | * repeated .google.type.Date dates = 1; 53 | */ 54 | java.util.List getDatesOrBuilderList(); 55 | /** 56 | * 57 | * 58 | *
 59 |    * List of dates that match the media items' creation date. A maximum of
 60 |    * 5 dates can be included per request.
 61 |    * 
62 | * 63 | * repeated .google.type.Date dates = 1; 64 | */ 65 | com.google.type.DateOrBuilder getDatesOrBuilder(int index); 66 | 67 | /** 68 | * 69 | * 70 | *
 71 |    * List of dates ranges that match the media items' creation date. A
 72 |    * maximum of 5 dates ranges can be included per request.
 73 |    * 
74 | * 75 | * repeated .google.photos.types.DateRange ranges = 2; 76 | */ 77 | java.util.List getRangesList(); 78 | /** 79 | * 80 | * 81 | *
 82 |    * List of dates ranges that match the media items' creation date. A
 83 |    * maximum of 5 dates ranges can be included per request.
 84 |    * 
85 | * 86 | * repeated .google.photos.types.DateRange ranges = 2; 87 | */ 88 | com.google.photos.types.proto.DateRange getRanges(int index); 89 | /** 90 | * 91 | * 92 | *
 93 |    * List of dates ranges that match the media items' creation date. A
 94 |    * maximum of 5 dates ranges can be included per request.
 95 |    * 
96 | * 97 | * repeated .google.photos.types.DateRange ranges = 2; 98 | */ 99 | int getRangesCount(); 100 | /** 101 | * 102 | * 103 | *
104 |    * List of dates ranges that match the media items' creation date. A
105 |    * maximum of 5 dates ranges can be included per request.
106 |    * 
107 | * 108 | * repeated .google.photos.types.DateRange ranges = 2; 109 | */ 110 | java.util.List 111 | getRangesOrBuilderList(); 112 | /** 113 | * 114 | * 115 | *
116 |    * List of dates ranges that match the media items' creation date. A
117 |    * maximum of 5 dates ranges can be included per request.
118 |    * 
119 | * 120 | * repeated .google.photos.types.DateRange ranges = 2; 121 | */ 122 | com.google.photos.types.proto.DateRangeOrBuilder getRangesOrBuilder(int index); 123 | } 124 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/EnrichmentItemOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface EnrichmentItemOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.EnrichmentItem) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Identifier of the enrichment item.
16 |    * 
17 | * 18 | * string id = 1; 19 | * 20 | * @return The id. 21 | */ 22 | java.lang.String getId(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Identifier of the enrichment item.
28 |    * 
29 | * 30 | * string id = 1; 31 | * 32 | * @return The bytes for id. 33 | */ 34 | com.google.protobuf.ByteString getIdBytes(); 35 | } 36 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/FeatureFilterOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface FeatureFilterOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.FeatureFilter) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * The set of features to be included in the media item search results.
16 |    * The items in the set are ORed and may match any of the specified features.
17 |    * 
18 | * 19 | * repeated .google.photos.library.v1.FeatureFilter.Feature included_features = 1; 20 | * 21 | * @return A list containing the includedFeatures. 22 | */ 23 | java.util.List 24 | getIncludedFeaturesList(); 25 | /** 26 | * 27 | * 28 | *
29 |    * The set of features to be included in the media item search results.
30 |    * The items in the set are ORed and may match any of the specified features.
31 |    * 
32 | * 33 | * repeated .google.photos.library.v1.FeatureFilter.Feature included_features = 1; 34 | * 35 | * @return The count of includedFeatures. 36 | */ 37 | int getIncludedFeaturesCount(); 38 | /** 39 | * 40 | * 41 | *
42 |    * The set of features to be included in the media item search results.
43 |    * The items in the set are ORed and may match any of the specified features.
44 |    * 
45 | * 46 | * repeated .google.photos.library.v1.FeatureFilter.Feature included_features = 1; 47 | * 48 | * @param index The index of the element to return. 49 | * @return The includedFeatures at the given index. 50 | */ 51 | com.google.photos.library.v1.proto.FeatureFilter.Feature getIncludedFeatures(int index); 52 | /** 53 | * 54 | * 55 | *
56 |    * The set of features to be included in the media item search results.
57 |    * The items in the set are ORed and may match any of the specified features.
58 |    * 
59 | * 60 | * repeated .google.photos.library.v1.FeatureFilter.Feature included_features = 1; 61 | * 62 | * @return A list containing the enum numeric values on the wire for includedFeatures. 63 | */ 64 | java.util.List getIncludedFeaturesValueList(); 65 | /** 66 | * 67 | * 68 | *
69 |    * The set of features to be included in the media item search results.
70 |    * The items in the set are ORed and may match any of the specified features.
71 |    * 
72 | * 73 | * repeated .google.photos.library.v1.FeatureFilter.Feature included_features = 1; 74 | * 75 | * @param index The index of the value to return. 76 | * @return The enum numeric value on the wire of includedFeatures at the given index. 77 | */ 78 | int getIncludedFeaturesValue(int index); 79 | } 80 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/GetAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface GetAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.GetAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Identifier of the album to be requested.
16 |    * 
17 | * 18 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 19 | * 20 | * @return The albumId. 21 | */ 22 | java.lang.String getAlbumId(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Required. Identifier of the album to be requested.
28 |    * 
29 | * 30 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 31 | * 32 | * @return The bytes for albumId. 33 | */ 34 | com.google.protobuf.ByteString getAlbumIdBytes(); 35 | } 36 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/GetMediaItemRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface GetMediaItemRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.GetMediaItemRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Identifier of the media item to be requested.
16 |    * 
17 | * 18 | * string media_item_id = 1 [(.google.api.field_behavior) = REQUIRED]; 19 | * 20 | * @return The mediaItemId. 21 | */ 22 | java.lang.String getMediaItemId(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Required. Identifier of the media item to be requested.
28 |    * 
29 | * 30 | * string media_item_id = 1 [(.google.api.field_behavior) = REQUIRED]; 31 | * 32 | * @return The bytes for mediaItemId. 33 | */ 34 | com.google.protobuf.ByteString getMediaItemIdBytes(); 35 | } 36 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/GetSharedAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface GetSharedAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.GetSharedAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Share token of the album to be requested.
16 |    * 
17 | * 18 | * string share_token = 1 [(.google.api.field_behavior) = REQUIRED]; 19 | * 20 | * @return The shareToken. 21 | */ 22 | java.lang.String getShareToken(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Required. Share token of the album to be requested.
28 |    * 
29 | * 30 | * string share_token = 1 [(.google.api.field_behavior) = REQUIRED]; 31 | * 32 | * @return The bytes for shareToken. 33 | */ 34 | com.google.protobuf.ByteString getShareTokenBytes(); 35 | } 36 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/JoinSharedAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface JoinSharedAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.JoinSharedAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Token to join the shared album on behalf of the user.
16 |    * 
17 | * 18 | * string share_token = 1 [(.google.api.field_behavior) = REQUIRED]; 19 | * 20 | * @return The shareToken. 21 | */ 22 | java.lang.String getShareToken(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Required. Token to join the shared album on behalf of the user.
28 |    * 
29 | * 30 | * string share_token = 1 [(.google.api.field_behavior) = REQUIRED]; 31 | * 32 | * @return The bytes for shareToken. 33 | */ 34 | com.google.protobuf.ByteString getShareTokenBytes(); 35 | } 36 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/JoinSharedAlbumResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface JoinSharedAlbumResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.JoinSharedAlbumResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Shared album that the user has joined.
16 |    * 
17 | * 18 | * .google.photos.types.Album album = 1; 19 | * 20 | * @return Whether the album field is set. 21 | */ 22 | boolean hasAlbum(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Shared album that the user has joined.
28 |    * 
29 | * 30 | * .google.photos.types.Album album = 1; 31 | * 32 | * @return The album. 33 | */ 34 | com.google.photos.types.proto.Album getAlbum(); 35 | /** 36 | * 37 | * 38 | *
39 |    * Shared album that the user has joined.
40 |    * 
41 | * 42 | * .google.photos.types.Album album = 1; 43 | */ 44 | com.google.photos.types.proto.AlbumOrBuilder getAlbumOrBuilder(); 45 | } 46 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/LeaveSharedAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface LeaveSharedAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.LeaveSharedAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Token to leave the shared album on behalf of the user.
16 |    * 
17 | * 18 | * string share_token = 1 [(.google.api.field_behavior) = REQUIRED]; 19 | * 20 | * @return The shareToken. 21 | */ 22 | java.lang.String getShareToken(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Required. Token to leave the shared album on behalf of the user.
28 |    * 
29 | * 30 | * string share_token = 1 [(.google.api.field_behavior) = REQUIRED]; 31 | * 32 | * @return The bytes for shareToken. 33 | */ 34 | com.google.protobuf.ByteString getShareTokenBytes(); 35 | } 36 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/LeaveSharedAlbumResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface LeaveSharedAlbumResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.LeaveSharedAlbumResponse) 9 | com.google.protobuf.MessageOrBuilder {} 10 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ListAlbumsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ListAlbumsRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ListAlbumsRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Maximum number of albums to return in the response. Fewer albums might be
16 |    * returned than the specified number. The default `pageSize` is 20, the
17 |    * maximum is 50.
18 |    * 
19 | * 20 | * int32 page_size = 1; 21 | * 22 | * @return The pageSize. 23 | */ 24 | int getPageSize(); 25 | 26 | /** 27 | * 28 | * 29 | *
30 |    * A continuation token to get the next page of the results. Adding this to
31 |    * the request returns the rows after the `pageToken`. The `pageToken` should
32 |    * be the value returned in the `nextPageToken` parameter in the response to
33 |    * the `listAlbums` request.
34 |    * 
35 | * 36 | * string page_token = 2; 37 | * 38 | * @return The pageToken. 39 | */ 40 | java.lang.String getPageToken(); 41 | /** 42 | * 43 | * 44 | *
45 |    * A continuation token to get the next page of the results. Adding this to
46 |    * the request returns the rows after the `pageToken`. The `pageToken` should
47 |    * be the value returned in the `nextPageToken` parameter in the response to
48 |    * the `listAlbums` request.
49 |    * 
50 | * 51 | * string page_token = 2; 52 | * 53 | * @return The bytes for pageToken. 54 | */ 55 | com.google.protobuf.ByteString getPageTokenBytes(); 56 | 57 | /** 58 | * 59 | * 60 | *
61 |    * If set, the results exclude media items that were not created by this app.
62 |    * Defaults to false (all albums are returned). This field is ignored if the
63 |    * photoslibrary.readonly.appcreateddata scope is used.
64 |    * 
65 | * 66 | * bool exclude_non_app_created_data = 3; 67 | * 68 | * @return The excludeNonAppCreatedData. 69 | */ 70 | boolean getExcludeNonAppCreatedData(); 71 | } 72 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ListAlbumsResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ListAlbumsResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ListAlbumsResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. List of albums shown in the Albums tab of the user's Google
16 |    * Photos app.
17 |    * 
18 | * 19 | * repeated .google.photos.types.Album albums = 1; 20 | */ 21 | java.util.List getAlbumsList(); 22 | /** 23 | * 24 | * 25 | *
26 |    * Output only. List of albums shown in the Albums tab of the user's Google
27 |    * Photos app.
28 |    * 
29 | * 30 | * repeated .google.photos.types.Album albums = 1; 31 | */ 32 | com.google.photos.types.proto.Album getAlbums(int index); 33 | /** 34 | * 35 | * 36 | *
37 |    * Output only. List of albums shown in the Albums tab of the user's Google
38 |    * Photos app.
39 |    * 
40 | * 41 | * repeated .google.photos.types.Album albums = 1; 42 | */ 43 | int getAlbumsCount(); 44 | /** 45 | * 46 | * 47 | *
48 |    * Output only. List of albums shown in the Albums tab of the user's Google
49 |    * Photos app.
50 |    * 
51 | * 52 | * repeated .google.photos.types.Album albums = 1; 53 | */ 54 | java.util.List getAlbumsOrBuilderList(); 55 | /** 56 | * 57 | * 58 | *
59 |    * Output only. List of albums shown in the Albums tab of the user's Google
60 |    * Photos app.
61 |    * 
62 | * 63 | * repeated .google.photos.types.Album albums = 1; 64 | */ 65 | com.google.photos.types.proto.AlbumOrBuilder getAlbumsOrBuilder(int index); 66 | 67 | /** 68 | * 69 | * 70 | *
71 |    * Output only. Token to use to get the next set of albums. Populated if
72 |    * there are more albums to retrieve for this request.
73 |    * 
74 | * 75 | * string next_page_token = 2; 76 | * 77 | * @return The nextPageToken. 78 | */ 79 | java.lang.String getNextPageToken(); 80 | /** 81 | * 82 | * 83 | *
84 |    * Output only. Token to use to get the next set of albums. Populated if
85 |    * there are more albums to retrieve for this request.
86 |    * 
87 | * 88 | * string next_page_token = 2; 89 | * 90 | * @return The bytes for nextPageToken. 91 | */ 92 | com.google.protobuf.ByteString getNextPageTokenBytes(); 93 | } 94 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ListMediaItemsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ListMediaItemsRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ListMediaItemsRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Maximum number of media items to return in the response. Fewer media items
16 |    * might be returned than the specified number. The default `pageSize` is 25,
17 |    * the maximum is 100.
18 |    * 
19 | * 20 | * int32 page_size = 1; 21 | * 22 | * @return The pageSize. 23 | */ 24 | int getPageSize(); 25 | 26 | /** 27 | * 28 | * 29 | *
30 |    * A continuation token to get the next page of the results. Adding this to
31 |    * the request returns the rows after the `pageToken`. The `pageToken` should
32 |    * be the value returned in the `nextPageToken` parameter in the response to
33 |    * the `listMediaItems` request.
34 |    * 
35 | * 36 | * string page_token = 2; 37 | * 38 | * @return The pageToken. 39 | */ 40 | java.lang.String getPageToken(); 41 | /** 42 | * 43 | * 44 | *
45 |    * A continuation token to get the next page of the results. Adding this to
46 |    * the request returns the rows after the `pageToken`. The `pageToken` should
47 |    * be the value returned in the `nextPageToken` parameter in the response to
48 |    * the `listMediaItems` request.
49 |    * 
50 | * 51 | * string page_token = 2; 52 | * 53 | * @return The bytes for pageToken. 54 | */ 55 | com.google.protobuf.ByteString getPageTokenBytes(); 56 | } 57 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ListMediaItemsResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ListMediaItemsResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ListMediaItemsResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. List of media items in the user's library.
16 |    * 
17 | * 18 | * repeated .google.photos.types.MediaItem media_items = 1; 19 | */ 20 | java.util.List getMediaItemsList(); 21 | /** 22 | * 23 | * 24 | *
25 |    * Output only. List of media items in the user's library.
26 |    * 
27 | * 28 | * repeated .google.photos.types.MediaItem media_items = 1; 29 | */ 30 | com.google.photos.types.proto.MediaItem getMediaItems(int index); 31 | /** 32 | * 33 | * 34 | *
35 |    * Output only. List of media items in the user's library.
36 |    * 
37 | * 38 | * repeated .google.photos.types.MediaItem media_items = 1; 39 | */ 40 | int getMediaItemsCount(); 41 | /** 42 | * 43 | * 44 | *
45 |    * Output only. List of media items in the user's library.
46 |    * 
47 | * 48 | * repeated .google.photos.types.MediaItem media_items = 1; 49 | */ 50 | java.util.List 51 | getMediaItemsOrBuilderList(); 52 | /** 53 | * 54 | * 55 | *
56 |    * Output only. List of media items in the user's library.
57 |    * 
58 | * 59 | * repeated .google.photos.types.MediaItem media_items = 1; 60 | */ 61 | com.google.photos.types.proto.MediaItemOrBuilder getMediaItemsOrBuilder(int index); 62 | 63 | /** 64 | * 65 | * 66 | *
67 |    * Output only. Token to use to get the next set of media items. Its presence
68 |    * is the only reliable indicator of more media items being available in the
69 |    * next request.
70 |    * 
71 | * 72 | * string next_page_token = 2; 73 | * 74 | * @return The nextPageToken. 75 | */ 76 | java.lang.String getNextPageToken(); 77 | /** 78 | * 79 | * 80 | *
81 |    * Output only. Token to use to get the next set of media items. Its presence
82 |    * is the only reliable indicator of more media items being available in the
83 |    * next request.
84 |    * 
85 | * 86 | * string next_page_token = 2; 87 | * 88 | * @return The bytes for nextPageToken. 89 | */ 90 | com.google.protobuf.ByteString getNextPageTokenBytes(); 91 | } 92 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ListSharedAlbumsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ListSharedAlbumsRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ListSharedAlbumsRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Maximum number of albums to return in the response. Fewer albums might be
16 |    * returned than the specified number. The default `pageSize` is 20, the
17 |    * maximum is 50.
18 |    * 
19 | * 20 | * int32 page_size = 1; 21 | * 22 | * @return The pageSize. 23 | */ 24 | int getPageSize(); 25 | 26 | /** 27 | * 28 | * 29 | *
30 |    * A continuation token to get the next page of the results. Adding this to
31 |    * the request returns the rows after the `pageToken`. The `pageToken` should
32 |    * be the value returned in the `nextPageToken` parameter in the response to
33 |    * the `listSharedAlbums` request.
34 |    * 
35 | * 36 | * string page_token = 2; 37 | * 38 | * @return The pageToken. 39 | */ 40 | java.lang.String getPageToken(); 41 | /** 42 | * 43 | * 44 | *
45 |    * A continuation token to get the next page of the results. Adding this to
46 |    * the request returns the rows after the `pageToken`. The `pageToken` should
47 |    * be the value returned in the `nextPageToken` parameter in the response to
48 |    * the `listSharedAlbums` request.
49 |    * 
50 | * 51 | * string page_token = 2; 52 | * 53 | * @return The bytes for pageToken. 54 | */ 55 | com.google.protobuf.ByteString getPageTokenBytes(); 56 | 57 | /** 58 | * 59 | * 60 | *
61 |    * If set, the results exclude media items that were not created by this app.
62 |    * Defaults to false (all albums are returned). This field is ignored if the
63 |    * photoslibrary.readonly.appcreateddata scope is used.
64 |    * 
65 | * 66 | * bool exclude_non_app_created_data = 3; 67 | * 68 | * @return The excludeNonAppCreatedData. 69 | */ 70 | boolean getExcludeNonAppCreatedData(); 71 | } 72 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ListSharedAlbumsResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ListSharedAlbumsResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ListSharedAlbumsResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. List of shared albums.
16 |    * 
17 | * 18 | * repeated .google.photos.types.Album shared_albums = 1; 19 | */ 20 | java.util.List getSharedAlbumsList(); 21 | /** 22 | * 23 | * 24 | *
25 |    * Output only. List of shared albums.
26 |    * 
27 | * 28 | * repeated .google.photos.types.Album shared_albums = 1; 29 | */ 30 | com.google.photos.types.proto.Album getSharedAlbums(int index); 31 | /** 32 | * 33 | * 34 | *
35 |    * Output only. List of shared albums.
36 |    * 
37 | * 38 | * repeated .google.photos.types.Album shared_albums = 1; 39 | */ 40 | int getSharedAlbumsCount(); 41 | /** 42 | * 43 | * 44 | *
45 |    * Output only. List of shared albums.
46 |    * 
47 | * 48 | * repeated .google.photos.types.Album shared_albums = 1; 49 | */ 50 | java.util.List 51 | getSharedAlbumsOrBuilderList(); 52 | /** 53 | * 54 | * 55 | *
56 |    * Output only. List of shared albums.
57 |    * 
58 | * 59 | * repeated .google.photos.types.Album shared_albums = 1; 60 | */ 61 | com.google.photos.types.proto.AlbumOrBuilder getSharedAlbumsOrBuilder(int index); 62 | 63 | /** 64 | * 65 | * 66 | *
67 |    * Output only. Token to use to get the next set of shared albums. Populated
68 |    * if there are more shared albums to retrieve for this request.
69 |    * 
70 | * 71 | * string next_page_token = 2; 72 | * 73 | * @return The nextPageToken. 74 | */ 75 | java.lang.String getNextPageToken(); 76 | /** 77 | * 78 | * 79 | *
80 |    * Output only. Token to use to get the next set of shared albums. Populated
81 |    * if there are more shared albums to retrieve for this request.
82 |    * 
83 | * 84 | * string next_page_token = 2; 85 | * 86 | * @return The bytes for nextPageToken. 87 | */ 88 | com.google.protobuf.ByteString getNextPageTokenBytes(); 89 | } 90 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/LocationEnrichmentOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface LocationEnrichmentOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.LocationEnrichment) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Location for this enrichment item.
16 |    * 
17 | * 18 | * .google.photos.library.v1.Location location = 1; 19 | * 20 | * @return Whether the location field is set. 21 | */ 22 | boolean hasLocation(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Location for this enrichment item.
28 |    * 
29 | * 30 | * .google.photos.library.v1.Location location = 1; 31 | * 32 | * @return The location. 33 | */ 34 | com.google.photos.library.v1.proto.Location getLocation(); 35 | /** 36 | * 37 | * 38 | *
39 |    * Location for this enrichment item.
40 |    * 
41 | * 42 | * .google.photos.library.v1.Location location = 1; 43 | */ 44 | com.google.photos.library.v1.proto.LocationOrBuilder getLocationOrBuilder(); 45 | } 46 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/LocationOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface LocationOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.Location) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Name of the location to be displayed.
16 |    * 
17 | * 18 | * string location_name = 1; 19 | * 20 | * @return The locationName. 21 | */ 22 | java.lang.String getLocationName(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Name of the location to be displayed.
28 |    * 
29 | * 30 | * string location_name = 1; 31 | * 32 | * @return The bytes for locationName. 33 | */ 34 | com.google.protobuf.ByteString getLocationNameBytes(); 35 | 36 | /** 37 | * 38 | * 39 | *
40 |    * Position of the location on the map.
41 |    * 
42 | * 43 | * .google.type.LatLng latlng = 2; 44 | * 45 | * @return Whether the latlng field is set. 46 | */ 47 | boolean hasLatlng(); 48 | /** 49 | * 50 | * 51 | *
52 |    * Position of the location on the map.
53 |    * 
54 | * 55 | * .google.type.LatLng latlng = 2; 56 | * 57 | * @return The latlng. 58 | */ 59 | com.google.type.LatLng getLatlng(); 60 | /** 61 | * 62 | * 63 | *
64 |    * Position of the location on the map.
65 |    * 
66 | * 67 | * .google.type.LatLng latlng = 2; 68 | */ 69 | com.google.type.LatLngOrBuilder getLatlngOrBuilder(); 70 | } 71 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/MapEnrichmentOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface MapEnrichmentOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.MapEnrichment) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Origin location for this enrichment item.
16 |    * 
17 | * 18 | * .google.photos.library.v1.Location origin = 1; 19 | * 20 | * @return Whether the origin field is set. 21 | */ 22 | boolean hasOrigin(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Origin location for this enrichment item.
28 |    * 
29 | * 30 | * .google.photos.library.v1.Location origin = 1; 31 | * 32 | * @return The origin. 33 | */ 34 | com.google.photos.library.v1.proto.Location getOrigin(); 35 | /** 36 | * 37 | * 38 | *
39 |    * Origin location for this enrichment item.
40 |    * 
41 | * 42 | * .google.photos.library.v1.Location origin = 1; 43 | */ 44 | com.google.photos.library.v1.proto.LocationOrBuilder getOriginOrBuilder(); 45 | 46 | /** 47 | * 48 | * 49 | *
50 |    * Destination location for this enrichemt item.
51 |    * 
52 | * 53 | * .google.photos.library.v1.Location destination = 2; 54 | * 55 | * @return Whether the destination field is set. 56 | */ 57 | boolean hasDestination(); 58 | /** 59 | * 60 | * 61 | *
62 |    * Destination location for this enrichemt item.
63 |    * 
64 | * 65 | * .google.photos.library.v1.Location destination = 2; 66 | * 67 | * @return The destination. 68 | */ 69 | com.google.photos.library.v1.proto.Location getDestination(); 70 | /** 71 | * 72 | * 73 | *
74 |    * Destination location for this enrichemt item.
75 |    * 
76 | * 77 | * .google.photos.library.v1.Location destination = 2; 78 | */ 79 | com.google.photos.library.v1.proto.LocationOrBuilder getDestinationOrBuilder(); 80 | } 81 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/MediaItemResultOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface MediaItemResultOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.MediaItemResult) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * If an error occurred while accessing this media item, this field
16 |    * is populated with information related to the error. For details regarding
17 |    * this field, see [Status][google.rpc.Status].
18 |    * 
19 | * 20 | * .google.rpc.Status status = 1; 21 | * 22 | * @return Whether the status field is set. 23 | */ 24 | boolean hasStatus(); 25 | /** 26 | * 27 | * 28 | *
29 |    * If an error occurred while accessing this media item, this field
30 |    * is populated with information related to the error. For details regarding
31 |    * this field, see [Status][google.rpc.Status].
32 |    * 
33 | * 34 | * .google.rpc.Status status = 1; 35 | * 36 | * @return The status. 37 | */ 38 | com.google.rpc.Status getStatus(); 39 | /** 40 | * 41 | * 42 | *
43 |    * If an error occurred while accessing this media item, this field
44 |    * is populated with information related to the error. For details regarding
45 |    * this field, see [Status][google.rpc.Status].
46 |    * 
47 | * 48 | * .google.rpc.Status status = 1; 49 | */ 50 | com.google.rpc.StatusOrBuilder getStatusOrBuilder(); 51 | 52 | /** 53 | * 54 | * 55 | *
56 |    * Media item retrieved from the user's library. It's populated if no errors
57 |    * occurred and the media item was fetched successfully.
58 |    * 
59 | * 60 | * .google.photos.types.MediaItem media_item = 2; 61 | * 62 | * @return Whether the mediaItem field is set. 63 | */ 64 | boolean hasMediaItem(); 65 | /** 66 | * 67 | * 68 | *
69 |    * Media item retrieved from the user's library. It's populated if no errors
70 |    * occurred and the media item was fetched successfully.
71 |    * 
72 | * 73 | * .google.photos.types.MediaItem media_item = 2; 74 | * 75 | * @return The mediaItem. 76 | */ 77 | com.google.photos.types.proto.MediaItem getMediaItem(); 78 | /** 79 | * 80 | * 81 | *
82 |    * Media item retrieved from the user's library. It's populated if no errors
83 |    * occurred and the media item was fetched successfully.
84 |    * 
85 | * 86 | * .google.photos.types.MediaItem media_item = 2; 87 | */ 88 | com.google.photos.types.proto.MediaItemOrBuilder getMediaItemOrBuilder(); 89 | } 90 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/MediaTypeFilterOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface MediaTypeFilterOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.MediaTypeFilter) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * The types of media items to be included. This field should be populated
16 |    * with only one media type. If you specify multiple media types, it results
17 |    * in an error.
18 |    * 
19 | * 20 | * repeated .google.photos.library.v1.MediaTypeFilter.MediaType media_types = 1; 21 | * 22 | * @return A list containing the mediaTypes. 23 | */ 24 | java.util.List getMediaTypesList(); 25 | /** 26 | * 27 | * 28 | *
29 |    * The types of media items to be included. This field should be populated
30 |    * with only one media type. If you specify multiple media types, it results
31 |    * in an error.
32 |    * 
33 | * 34 | * repeated .google.photos.library.v1.MediaTypeFilter.MediaType media_types = 1; 35 | * 36 | * @return The count of mediaTypes. 37 | */ 38 | int getMediaTypesCount(); 39 | /** 40 | * 41 | * 42 | *
43 |    * The types of media items to be included. This field should be populated
44 |    * with only one media type. If you specify multiple media types, it results
45 |    * in an error.
46 |    * 
47 | * 48 | * repeated .google.photos.library.v1.MediaTypeFilter.MediaType media_types = 1; 49 | * 50 | * @param index The index of the element to return. 51 | * @return The mediaTypes at the given index. 52 | */ 53 | com.google.photos.library.v1.proto.MediaTypeFilter.MediaType getMediaTypes(int index); 54 | /** 55 | * 56 | * 57 | *
58 |    * The types of media items to be included. This field should be populated
59 |    * with only one media type. If you specify multiple media types, it results
60 |    * in an error.
61 |    * 
62 | * 63 | * repeated .google.photos.library.v1.MediaTypeFilter.MediaType media_types = 1; 64 | * 65 | * @return A list containing the enum numeric values on the wire for mediaTypes. 66 | */ 67 | java.util.List getMediaTypesValueList(); 68 | /** 69 | * 70 | * 71 | *
72 |    * The types of media items to be included. This field should be populated
73 |    * with only one media type. If you specify multiple media types, it results
74 |    * in an error.
75 |    * 
76 | * 77 | * repeated .google.photos.library.v1.MediaTypeFilter.MediaType media_types = 1; 78 | * 79 | * @param index The index of the value to return. 80 | * @return The enum numeric value on the wire of mediaTypes at the given index. 81 | */ 82 | int getMediaTypesValue(int index); 83 | } 84 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/NewEnrichmentItemOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface NewEnrichmentItemOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.NewEnrichmentItem) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * Text to be added to the album.
 16 |    * 
17 | * 18 | * .google.photos.library.v1.TextEnrichment text_enrichment = 1; 19 | * 20 | * @return Whether the textEnrichment field is set. 21 | */ 22 | boolean hasTextEnrichment(); 23 | /** 24 | * 25 | * 26 | *
 27 |    * Text to be added to the album.
 28 |    * 
29 | * 30 | * .google.photos.library.v1.TextEnrichment text_enrichment = 1; 31 | * 32 | * @return The textEnrichment. 33 | */ 34 | com.google.photos.library.v1.proto.TextEnrichment getTextEnrichment(); 35 | /** 36 | * 37 | * 38 | *
 39 |    * Text to be added to the album.
 40 |    * 
41 | * 42 | * .google.photos.library.v1.TextEnrichment text_enrichment = 1; 43 | */ 44 | com.google.photos.library.v1.proto.TextEnrichmentOrBuilder getTextEnrichmentOrBuilder(); 45 | 46 | /** 47 | * 48 | * 49 | *
 50 |    * Location to be added to the album.
 51 |    * 
52 | * 53 | * .google.photos.library.v1.LocationEnrichment location_enrichment = 2; 54 | * 55 | * @return Whether the locationEnrichment field is set. 56 | */ 57 | boolean hasLocationEnrichment(); 58 | /** 59 | * 60 | * 61 | *
 62 |    * Location to be added to the album.
 63 |    * 
64 | * 65 | * .google.photos.library.v1.LocationEnrichment location_enrichment = 2; 66 | * 67 | * @return The locationEnrichment. 68 | */ 69 | com.google.photos.library.v1.proto.LocationEnrichment getLocationEnrichment(); 70 | /** 71 | * 72 | * 73 | *
 74 |    * Location to be added to the album.
 75 |    * 
76 | * 77 | * .google.photos.library.v1.LocationEnrichment location_enrichment = 2; 78 | */ 79 | com.google.photos.library.v1.proto.LocationEnrichmentOrBuilder getLocationEnrichmentOrBuilder(); 80 | 81 | /** 82 | * 83 | * 84 | *
 85 |    * Map to be added to the album.
 86 |    * 
87 | * 88 | * .google.photos.library.v1.MapEnrichment map_enrichment = 3; 89 | * 90 | * @return Whether the mapEnrichment field is set. 91 | */ 92 | boolean hasMapEnrichment(); 93 | /** 94 | * 95 | * 96 | *
 97 |    * Map to be added to the album.
 98 |    * 
99 | * 100 | * .google.photos.library.v1.MapEnrichment map_enrichment = 3; 101 | * 102 | * @return The mapEnrichment. 103 | */ 104 | com.google.photos.library.v1.proto.MapEnrichment getMapEnrichment(); 105 | /** 106 | * 107 | * 108 | *
109 |    * Map to be added to the album.
110 |    * 
111 | * 112 | * .google.photos.library.v1.MapEnrichment map_enrichment = 3; 113 | */ 114 | com.google.photos.library.v1.proto.MapEnrichmentOrBuilder getMapEnrichmentOrBuilder(); 115 | 116 | public com.google.photos.library.v1.proto.NewEnrichmentItem.EnrichmentCase getEnrichmentCase(); 117 | } 118 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/NewMediaItemOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface NewMediaItemOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.NewMediaItem) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Description of the media item. This is shown to the user in the item's info
16 |    * section in the Google Photos app. Must be shorter than 1000 characters.
17 |    * Only include text written by users. Descriptions should add context and
18 |    * help users understand media. Do not include any auto-generated
19 |    * strings such as filenames, tags, and other metadata.
20 |    * 
21 | * 22 | * string description = 1; 23 | * 24 | * @return The description. 25 | */ 26 | java.lang.String getDescription(); 27 | /** 28 | * 29 | * 30 | *
31 |    * Description of the media item. This is shown to the user in the item's info
32 |    * section in the Google Photos app. Must be shorter than 1000 characters.
33 |    * Only include text written by users. Descriptions should add context and
34 |    * help users understand media. Do not include any auto-generated
35 |    * strings such as filenames, tags, and other metadata.
36 |    * 
37 | * 38 | * string description = 1; 39 | * 40 | * @return The bytes for description. 41 | */ 42 | com.google.protobuf.ByteString getDescriptionBytes(); 43 | 44 | /** 45 | * 46 | * 47 | *
48 |    * A new media item that has been uploaded via the included `uploadToken`.
49 |    * 
50 | * 51 | * .google.photos.library.v1.SimpleMediaItem simple_media_item = 2; 52 | * 53 | * @return Whether the simpleMediaItem field is set. 54 | */ 55 | boolean hasSimpleMediaItem(); 56 | /** 57 | * 58 | * 59 | *
60 |    * A new media item that has been uploaded via the included `uploadToken`.
61 |    * 
62 | * 63 | * .google.photos.library.v1.SimpleMediaItem simple_media_item = 2; 64 | * 65 | * @return The simpleMediaItem. 66 | */ 67 | com.google.photos.library.v1.proto.SimpleMediaItem getSimpleMediaItem(); 68 | /** 69 | * 70 | * 71 | *
72 |    * A new media item that has been uploaded via the included `uploadToken`.
73 |    * 
74 | * 75 | * .google.photos.library.v1.SimpleMediaItem simple_media_item = 2; 76 | */ 77 | com.google.photos.library.v1.proto.SimpleMediaItemOrBuilder getSimpleMediaItemOrBuilder(); 78 | 79 | public com.google.photos.library.v1.proto.NewMediaItem.NewMediaItemTypeCase 80 | getNewMediaItemTypeCase(); 81 | } 82 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/NewMediaItemResultOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface NewMediaItemResultOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.NewMediaItemResult) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * The upload token used to create this new (simple) media item. Only
 16 |    * populated if the media item is simple and required a single upload token.
 17 |    * 
18 | * 19 | * string upload_token = 1; 20 | * 21 | * @return The uploadToken. 22 | */ 23 | java.lang.String getUploadToken(); 24 | /** 25 | * 26 | * 27 | *
 28 |    * The upload token used to create this new (simple) media item. Only
 29 |    * populated if the media item is simple and required a single upload token.
 30 |    * 
31 | * 32 | * string upload_token = 1; 33 | * 34 | * @return The bytes for uploadToken. 35 | */ 36 | com.google.protobuf.ByteString getUploadTokenBytes(); 37 | 38 | /** 39 | * 40 | * 41 | *
 42 |    * If an error occurred during the creation of this media item, this field
 43 |    * is  populated with information related to the error. For details regarding
 44 |    * this field, see <a href="#Status">Status</a>.
 45 |    * 
46 | * 47 | * .google.rpc.Status status = 2; 48 | * 49 | * @return Whether the status field is set. 50 | */ 51 | boolean hasStatus(); 52 | /** 53 | * 54 | * 55 | *
 56 |    * If an error occurred during the creation of this media item, this field
 57 |    * is  populated with information related to the error. For details regarding
 58 |    * this field, see <a href="#Status">Status</a>.
 59 |    * 
60 | * 61 | * .google.rpc.Status status = 2; 62 | * 63 | * @return The status. 64 | */ 65 | com.google.rpc.Status getStatus(); 66 | /** 67 | * 68 | * 69 | *
 70 |    * If an error occurred during the creation of this media item, this field
 71 |    * is  populated with information related to the error. For details regarding
 72 |    * this field, see <a href="#Status">Status</a>.
 73 |    * 
74 | * 75 | * .google.rpc.Status status = 2; 76 | */ 77 | com.google.rpc.StatusOrBuilder getStatusOrBuilder(); 78 | 79 | /** 80 | * 81 | * 82 | *
 83 |    * Media item created with the upload token. It's populated if no errors
 84 |    * occurred and the media item was created successfully.
 85 |    * 
86 | * 87 | * .google.photos.types.MediaItem media_item = 3; 88 | * 89 | * @return Whether the mediaItem field is set. 90 | */ 91 | boolean hasMediaItem(); 92 | /** 93 | * 94 | * 95 | *
 96 |    * Media item created with the upload token. It's populated if no errors
 97 |    * occurred and the media item was created successfully.
 98 |    * 
99 | * 100 | * .google.photos.types.MediaItem media_item = 3; 101 | * 102 | * @return The mediaItem. 103 | */ 104 | com.google.photos.types.proto.MediaItem getMediaItem(); 105 | /** 106 | * 107 | * 108 | *
109 |    * Media item created with the upload token. It's populated if no errors
110 |    * occurred and the media item was created successfully.
111 |    * 
112 | * 113 | * .google.photos.types.MediaItem media_item = 3; 114 | */ 115 | com.google.photos.types.proto.MediaItemOrBuilder getMediaItemOrBuilder(); 116 | } 117 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/SearchMediaItemsResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface SearchMediaItemsResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.SearchMediaItemsResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. List of media items that match the search parameters.
16 |    * 
17 | * 18 | * repeated .google.photos.types.MediaItem media_items = 1; 19 | */ 20 | java.util.List getMediaItemsList(); 21 | /** 22 | * 23 | * 24 | *
25 |    * Output only. List of media items that match the search parameters.
26 |    * 
27 | * 28 | * repeated .google.photos.types.MediaItem media_items = 1; 29 | */ 30 | com.google.photos.types.proto.MediaItem getMediaItems(int index); 31 | /** 32 | * 33 | * 34 | *
35 |    * Output only. List of media items that match the search parameters.
36 |    * 
37 | * 38 | * repeated .google.photos.types.MediaItem media_items = 1; 39 | */ 40 | int getMediaItemsCount(); 41 | /** 42 | * 43 | * 44 | *
45 |    * Output only. List of media items that match the search parameters.
46 |    * 
47 | * 48 | * repeated .google.photos.types.MediaItem media_items = 1; 49 | */ 50 | java.util.List 51 | getMediaItemsOrBuilderList(); 52 | /** 53 | * 54 | * 55 | *
56 |    * Output only. List of media items that match the search parameters.
57 |    * 
58 | * 59 | * repeated .google.photos.types.MediaItem media_items = 1; 60 | */ 61 | com.google.photos.types.proto.MediaItemOrBuilder getMediaItemsOrBuilder(int index); 62 | 63 | /** 64 | * 65 | * 66 | *
67 |    * Output only. Use this token to get the next set of media items. Its
68 |    * presence is the only reliable indicator of more media items being available
69 |    * in the next request.
70 |    * 
71 | * 72 | * string next_page_token = 2; 73 | * 74 | * @return The nextPageToken. 75 | */ 76 | java.lang.String getNextPageToken(); 77 | /** 78 | * 79 | * 80 | *
81 |    * Output only. Use this token to get the next set of media items. Its
82 |    * presence is the only reliable indicator of more media items being available
83 |    * in the next request.
84 |    * 
85 | * 86 | * string next_page_token = 2; 87 | * 88 | * @return The bytes for nextPageToken. 89 | */ 90 | com.google.protobuf.ByteString getNextPageTokenBytes(); 91 | } 92 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ShareAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ShareAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ShareAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Identifier of the album to be shared. This `albumId` must belong
16 |    * to an album created by the developer.
17 |    * 
18 | * 19 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 20 | * 21 | * @return The albumId. 22 | */ 23 | java.lang.String getAlbumId(); 24 | /** 25 | * 26 | * 27 | *
28 |    * Required. Identifier of the album to be shared. This `albumId` must belong
29 |    * to an album created by the developer.
30 |    * 
31 | * 32 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 33 | * 34 | * @return The bytes for albumId. 35 | */ 36 | com.google.protobuf.ByteString getAlbumIdBytes(); 37 | 38 | /** 39 | * 40 | * 41 | *
42 |    * Options to be set when converting the album to a shared album.
43 |    * 
44 | * 45 | * .google.photos.types.SharedAlbumOptions shared_album_options = 2; 46 | * 47 | * @return Whether the sharedAlbumOptions field is set. 48 | */ 49 | boolean hasSharedAlbumOptions(); 50 | /** 51 | * 52 | * 53 | *
54 |    * Options to be set when converting the album to a shared album.
55 |    * 
56 | * 57 | * .google.photos.types.SharedAlbumOptions shared_album_options = 2; 58 | * 59 | * @return The sharedAlbumOptions. 60 | */ 61 | com.google.photos.types.proto.SharedAlbumOptions getSharedAlbumOptions(); 62 | /** 63 | * 64 | * 65 | *
66 |    * Options to be set when converting the album to a shared album.
67 |    * 
68 | * 69 | * .google.photos.types.SharedAlbumOptions shared_album_options = 2; 70 | */ 71 | com.google.photos.types.proto.SharedAlbumOptionsOrBuilder getSharedAlbumOptionsOrBuilder(); 72 | } 73 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/ShareAlbumResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface ShareAlbumResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.ShareAlbumResponse) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Output only. Information about the shared album.
16 |    * 
17 | * 18 | * .google.photos.types.ShareInfo share_info = 1; 19 | * 20 | * @return Whether the shareInfo field is set. 21 | */ 22 | boolean hasShareInfo(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Output only. Information about the shared album.
28 |    * 
29 | * 30 | * .google.photos.types.ShareInfo share_info = 1; 31 | * 32 | * @return The shareInfo. 33 | */ 34 | com.google.photos.types.proto.ShareInfo getShareInfo(); 35 | /** 36 | * 37 | * 38 | *
39 |    * Output only. Information about the shared album.
40 |    * 
41 | * 42 | * .google.photos.types.ShareInfo share_info = 1; 43 | */ 44 | com.google.photos.types.proto.ShareInfoOrBuilder getShareInfoOrBuilder(); 45 | } 46 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/SimpleMediaItemOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface SimpleMediaItemOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.SimpleMediaItem) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Token identifying the media bytes that have been uploaded to Google.
16 |    * 
17 | * 18 | * string upload_token = 1; 19 | * 20 | * @return The uploadToken. 21 | */ 22 | java.lang.String getUploadToken(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Token identifying the media bytes that have been uploaded to Google.
28 |    * 
29 | * 30 | * string upload_token = 1; 31 | * 32 | * @return The bytes for uploadToken. 33 | */ 34 | com.google.protobuf.ByteString getUploadTokenBytes(); 35 | 36 | /** 37 | * 38 | * 39 | *
40 |    * File name with extension of the media item. This is shown to the user in
41 |    * Google Photos. The file name specified during the <a
42 |    * href="https://developers.google.com/photos/library/guides/upload-media">byte
43 |    * upload process</a> is ignored if this field is set. The file name,
44 |    * including the file extension, shouldn't be more than 255 characters. This
45 |    * is an optional field.
46 |    * 
47 | * 48 | * string file_name = 2; 49 | * 50 | * @return The fileName. 51 | */ 52 | java.lang.String getFileName(); 53 | /** 54 | * 55 | * 56 | *
57 |    * File name with extension of the media item. This is shown to the user in
58 |    * Google Photos. The file name specified during the <a
59 |    * href="https://developers.google.com/photos/library/guides/upload-media">byte
60 |    * upload process</a> is ignored if this field is set. The file name,
61 |    * including the file extension, shouldn't be more than 255 characters. This
62 |    * is an optional field.
63 |    * 
64 | * 65 | * string file_name = 2; 66 | * 67 | * @return The bytes for fileName. 68 | */ 69 | com.google.protobuf.ByteString getFileNameBytes(); 70 | } 71 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/TextEnrichmentOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface TextEnrichmentOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.TextEnrichment) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Text for this enrichment item.
16 |    * 
17 | * 18 | * string text = 1; 19 | * 20 | * @return The text. 21 | */ 22 | java.lang.String getText(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Text for this enrichment item.
28 |    * 
29 | * 30 | * string text = 1; 31 | * 32 | * @return The bytes for text. 33 | */ 34 | com.google.protobuf.ByteString getTextBytes(); 35 | } 36 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/UnshareAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface UnshareAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.UnshareAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. Identifier of the album to be unshared. This album id must belong
16 |    * to an album created by the developer.
17 |    * 
18 | * 19 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 20 | * 21 | * @return The albumId. 22 | */ 23 | java.lang.String getAlbumId(); 24 | /** 25 | * 26 | * 27 | *
28 |    * Required. Identifier of the album to be unshared. This album id must belong
29 |    * to an album created by the developer.
30 |    * 
31 | * 32 | * string album_id = 1 [(.google.api.field_behavior) = REQUIRED]; 33 | * 34 | * @return The bytes for albumId. 35 | */ 36 | com.google.protobuf.ByteString getAlbumIdBytes(); 37 | } 38 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/UnshareAlbumResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface UnshareAlbumResponseOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.UnshareAlbumResponse) 9 | com.google.protobuf.MessageOrBuilder {} 10 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/UpdateAlbumRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface UpdateAlbumRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.UpdateAlbumRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Required. The [Album][google.photos.types.Album] to update.
16 |    * The album’s `id` field is used to identify the album to be updated.
17 |    * The album’s `title` field is used to set the new album title.
18 |    * The album’s `cover_photo_media_item_id` field is used to set the new album
19 |    * cover photo.
20 |    * 
21 | * 22 | * .google.photos.types.Album album = 1 [(.google.api.field_behavior) = REQUIRED]; 23 | * 24 | * @return Whether the album field is set. 25 | */ 26 | boolean hasAlbum(); 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The [Album][google.photos.types.Album] to update.
32 |    * The album’s `id` field is used to identify the album to be updated.
33 |    * The album’s `title` field is used to set the new album title.
34 |    * The album’s `cover_photo_media_item_id` field is used to set the new album
35 |    * cover photo.
36 |    * 
37 | * 38 | * .google.photos.types.Album album = 1 [(.google.api.field_behavior) = REQUIRED]; 39 | * 40 | * @return The album. 41 | */ 42 | com.google.photos.types.proto.Album getAlbum(); 43 | /** 44 | * 45 | * 46 | *
47 |    * Required. The [Album][google.photos.types.Album] to update.
48 |    * The album’s `id` field is used to identify the album to be updated.
49 |    * The album’s `title` field is used to set the new album title.
50 |    * The album’s `cover_photo_media_item_id` field is used to set the new album
51 |    * cover photo.
52 |    * 
53 | * 54 | * .google.photos.types.Album album = 1 [(.google.api.field_behavior) = REQUIRED]; 55 | */ 56 | com.google.photos.types.proto.AlbumOrBuilder getAlbumOrBuilder(); 57 | 58 | /** 59 | * 60 | * 61 | *
62 |    * Required. Indicate what fields in the provided album to update.
63 |    * The only valid values are `title` and `cover_photo_media_item_id`.
64 |    * 
65 | * 66 | * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; 67 | * 68 | * 69 | * @return Whether the updateMask field is set. 70 | */ 71 | boolean hasUpdateMask(); 72 | /** 73 | * 74 | * 75 | *
76 |    * Required. Indicate what fields in the provided album to update.
77 |    * The only valid values are `title` and `cover_photo_media_item_id`.
78 |    * 
79 | * 80 | * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; 81 | * 82 | * 83 | * @return The updateMask. 84 | */ 85 | com.google.protobuf.FieldMask getUpdateMask(); 86 | /** 87 | * 88 | * 89 | *
90 |    * Required. Indicate what fields in the provided album to update.
91 |    * The only valid values are `title` and `cover_photo_media_item_id`.
92 |    * 
93 | * 94 | * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; 95 | * 96 | */ 97 | com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); 98 | } 99 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/UpdateMediaItemRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/library/v1/photos_library.proto 3 | 4 | package com.google.photos.library.v1.proto; 5 | 6 | public interface UpdateMediaItemRequestOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.library.v1.UpdateMediaItemRequest) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * Required. The [MediaItem][google.photos.types.MediaItem] to update.
 16 |    * The media item's `id` field is used to identify the media item to be
 17 |    * updated.
 18 |    * The media item's `description` field is used to set the new media item
 19 |    * description.
 20 |    * 
21 | * 22 | * .google.photos.types.MediaItem media_item = 1 [(.google.api.field_behavior) = REQUIRED]; 23 | * 24 | * 25 | * @return Whether the mediaItem field is set. 26 | */ 27 | boolean hasMediaItem(); 28 | /** 29 | * 30 | * 31 | *
 32 |    * Required. The [MediaItem][google.photos.types.MediaItem] to update.
 33 |    * The media item's `id` field is used to identify the media item to be
 34 |    * updated.
 35 |    * The media item's `description` field is used to set the new media item
 36 |    * description.
 37 |    * 
38 | * 39 | * .google.photos.types.MediaItem media_item = 1 [(.google.api.field_behavior) = REQUIRED]; 40 | * 41 | * 42 | * @return The mediaItem. 43 | */ 44 | com.google.photos.types.proto.MediaItem getMediaItem(); 45 | /** 46 | * 47 | * 48 | *
 49 |    * Required. The [MediaItem][google.photos.types.MediaItem] to update.
 50 |    * The media item's `id` field is used to identify the media item to be
 51 |    * updated.
 52 |    * The media item's `description` field is used to set the new media item
 53 |    * description.
 54 |    * 
55 | * 56 | * .google.photos.types.MediaItem media_item = 1 [(.google.api.field_behavior) = REQUIRED]; 57 | * 58 | */ 59 | com.google.photos.types.proto.MediaItemOrBuilder getMediaItemOrBuilder(); 60 | 61 | /** 62 | * 63 | * 64 | *
 65 |    * Required. Indicate what fields in the provided media item to update.
 66 |    * The only valid value is `description`.
 67 |    * 
68 | * 69 | * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; 70 | * 71 | * 72 | * @return Whether the updateMask field is set. 73 | */ 74 | boolean hasUpdateMask(); 75 | /** 76 | * 77 | * 78 | *
 79 |    * Required. Indicate what fields in the provided media item to update.
 80 |    * The only valid value is `description`.
 81 |    * 
82 | * 83 | * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; 84 | * 85 | * 86 | * @return The updateMask. 87 | */ 88 | com.google.protobuf.FieldMask getUpdateMask(); 89 | /** 90 | * 91 | * 92 | *
 93 |    * Required. Indicate what fields in the provided media item to update.
 94 |    * The only valid value is `description`.
 95 |    * 
96 | * 97 | * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; 98 | * 99 | */ 100 | com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); 101 | } 102 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/upload/ExceptionStrings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.upload; 18 | 19 | final class ExceptionStrings { 20 | 21 | static final String INVALID_UPLOAD_RESULT = 22 | "The upload was completed but failed to finalize or get the result."; 23 | static final String INVALID_UPLOAD_STATUS = "Invalid upload status received."; 24 | static final String NOT_INITIALIZED = "The upload could not be initialized."; 25 | static final String UNKNOWN_ERROR = "The upload encountered an unknown error."; 26 | static final String UPLOAD_THREAD_INTERRUPTED = "Upload thread was interrupted."; 27 | static final String UPLOAD_URL_REJECTED = 28 | "The upload url is either finalized or rejected by the server."; 29 | static final String UPLOAD_TIMED_OUT = "The upload has timed out."; 30 | static final String INVALID_PROGRESS = "The upload progress could not be verified."; 31 | } 32 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/upload/NestedUploadRetryCallable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.upload; 18 | 19 | import com.google.api.core.ApiFuture; 20 | import com.google.api.gax.rpc.ApiCallContext; 21 | import com.google.api.gax.rpc.Callables; 22 | import com.google.api.gax.rpc.ClientContext; 23 | import com.google.api.gax.rpc.UnaryCallSettings; 24 | import com.google.api.gax.rpc.UnaryCallable; 25 | 26 | /** 27 | * Manages retries and calls to a Callable that uploads bytes. 28 | * 29 | *

Each individual call to {@link #futureCall(UploadMediaItemRequest, ApiCallContext)} is wrapped 30 | * in a {@link UploadRetryCallable} that handles retries and resumes of in-progress upload requests. 31 | * 32 | *

Package-private for internal use. 33 | */ 34 | final class NestedUploadRetryCallable 35 | extends UnaryCallable { 36 | private final UnaryCallable uploadCallable; 37 | private final ClientContext clientContext; 38 | private final UnaryCallSettings settings; 39 | 40 | /** 41 | * Callable that wraps the given callable in an {@link UploadRetryCallable} and calls it when 42 | * called. 43 | * 44 | * @param uploadCallable A callable (e.g. {@link PhotosLibraryUploadCallable}) that uploads bytes 45 | * to the Photos Library API. 46 | * @param settings Settings for the upload call, in particular its retry configuration. 47 | * @param clientContext Context for calls. 48 | */ 49 | public NestedUploadRetryCallable( 50 | UnaryCallable uploadCallable, 51 | UnaryCallSettings settings, 52 | ClientContext clientContext) { 53 | this.uploadCallable = uploadCallable; 54 | this.clientContext = clientContext; 55 | this.settings = settings; 56 | } 57 | 58 | /** 59 | * Calls the wrapped callable asynchronously. 60 | * 61 | *

Calls are retried per the retry configuration configured in the {@link UnaryCallSettings} 62 | * given when this object was created. Retries are handled through {@link UploadRetryCallable}. 63 | */ 64 | @Override 65 | public ApiFuture futureCall( 66 | UploadMediaItemRequest request, ApiCallContext context) { 67 | 68 | // Pass the callable through a callable that maps errors to 69 | // APIExceptions and updates any requests if they can be resumed. 70 | UnaryCallable callable = 71 | new UploadRetryCallable(uploadCallable, clientContext); 72 | 73 | callable = Callables.retrying(callable, settings, clientContext); 74 | callable = callable.withDefaultCallContext(clientContext.getDefaultCallContext()); 75 | 76 | return callable.futureCall(request, context); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/upload/PhotosLibraryUploadExceptionMappingFn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.upload; 18 | 19 | import com.google.api.core.ApiFunction; 20 | import com.google.api.gax.grpc.GrpcStatusCode; 21 | import com.google.api.gax.rpc.ApiException; 22 | import com.google.api.gax.rpc.StatusCode; 23 | import com.google.common.collect.ImmutableSet; 24 | import io.grpc.Status.Code; 25 | import io.grpc.internal.GrpcUtil; 26 | import java.util.Optional; 27 | import java.util.Set; 28 | import java.util.concurrent.atomic.AtomicReference; 29 | import javax.annotation.Nullable; 30 | import org.apache.http.client.HttpResponseException; 31 | 32 | /** Maps a {@link Throwable} to an {@link UploadApiException} or an {@link ApiException}. */ 33 | final class PhotosLibraryUploadExceptionMappingFn 34 | implements ApiFunction { 35 | 36 | private final AtomicReference atomicResumeUrl; 37 | private final ImmutableSet retryableCodes; 38 | 39 | PhotosLibraryUploadExceptionMappingFn( 40 | Set retryCodes, AtomicReference atomicResumeUrl) { 41 | this.atomicResumeUrl = atomicResumeUrl; 42 | this.retryableCodes = ImmutableSet.copyOf(retryCodes); 43 | } 44 | 45 | @Nullable 46 | @Override 47 | public UploadMediaItemResponse apply(@Nullable Throwable input) { 48 | Optional resumeUrl = Optional.ofNullable(atomicResumeUrl.get()); 49 | StatusCode statusCode = getStatusCode(input); 50 | 51 | boolean canRetry = retryableCodes.contains(statusCode.getCode()); 52 | 53 | if (resumeUrl.isPresent()) { 54 | throw new UploadApiException(input, statusCode, canRetry, resumeUrl.get()); 55 | } else { 56 | throw new ApiException(input, statusCode, canRetry); 57 | } 58 | } 59 | 60 | public static StatusCode getStatusCode(@Nullable Throwable input) { 61 | if (input == null) { 62 | return GrpcStatusCode.of(Code.UNKNOWN); 63 | } else if (input instanceof HttpResponseException) { 64 | HttpResponseException httpResponseException = (HttpResponseException) input; 65 | return httpCodeToStatusCode(httpResponseException.getStatusCode()); 66 | } else { 67 | return GrpcStatusCode.of(Code.INVALID_ARGUMENT); 68 | } 69 | } 70 | 71 | private static StatusCode httpCodeToStatusCode(int httpCode) { 72 | switch (httpCode) { 73 | // Include a specific mapping for some codes that have special meaning for the upload 74 | // endpoint, otherwise fall back to the default HTTP/GRPC code mapping. 75 | case 200: 76 | return GrpcStatusCode.of(Code.OK); 77 | case 409: 78 | return GrpcStatusCode.of(Code.ABORTED); 79 | case 503: 80 | return GrpcStatusCode.of(Code.UNAVAILABLE); 81 | case 400: 82 | return GrpcStatusCode.of(Code.INVALID_ARGUMENT); 83 | case 412: 84 | return GrpcStatusCode.of(Code.FAILED_PRECONDITION); 85 | case 413: 86 | return GrpcStatusCode.of(Code.OUT_OF_RANGE); 87 | case 500: 88 | return GrpcStatusCode.of(Code.INTERNAL); 89 | case 429: 90 | return GrpcStatusCode.of(Code.RESOURCE_EXHAUSTED); 91 | default: 92 | return GrpcStatusCode.of(GrpcUtil.httpStatusToGrpcStatus(httpCode).getCode()); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/upload/PhotosLibraryUploadStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.upload; 18 | 19 | import com.google.api.gax.core.BackgroundResource; 20 | import com.google.api.gax.rpc.UnaryCallable; 21 | 22 | /** Base stub class for uploading with Photos Library API. */ 23 | public abstract class PhotosLibraryUploadStub implements BackgroundResource { 24 | public UnaryCallable uploadMediaItemCallable() { 25 | throw new UnsupportedOperationException("Not implemented: uploadMediaItemCallable()"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/upload/PhotosLibraryUploadStubImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.upload; 18 | 19 | import com.google.api.gax.core.BackgroundResource; 20 | import com.google.api.gax.core.BackgroundResourceAggregation; 21 | import com.google.api.gax.rpc.ClientContext; 22 | import com.google.api.gax.rpc.UnaryCallSettings; 23 | import com.google.api.gax.rpc.UnaryCallable; 24 | import com.google.photos.library.v1.PhotosLibrarySettings; 25 | import java.io.IOException; 26 | import java.util.concurrent.TimeUnit; 27 | 28 | /** Implementation for {@link PhotosLibraryUploadStub}. */ 29 | public final class PhotosLibraryUploadStubImpl extends PhotosLibraryUploadStub { 30 | 31 | private final BackgroundResource backgroundResources; 32 | private final UnaryCallable callable; 33 | 34 | private PhotosLibraryUploadStubImpl(PhotosLibrarySettings librarySettings) throws IOException { 35 | ClientContext clientContext = ClientContext.create(librarySettings); 36 | this.backgroundResources = 37 | new BackgroundResourceAggregation(clientContext.getBackgroundResources()); 38 | 39 | UnaryCallSettings settings = 40 | librarySettings.uploadMediaItemSettings(); 41 | 42 | UnaryCallable uploadCallable = 43 | new PhotosLibraryUploadUnaryCallable(clientContext, settings, settings.getRetryableCodes()); 44 | 45 | callable = new NestedUploadRetryCallable(uploadCallable, settings, clientContext); 46 | } 47 | 48 | public static PhotosLibraryUploadStub createStub(PhotosLibrarySettings settings) 49 | throws IOException { 50 | return new PhotosLibraryUploadStubImpl(settings); 51 | } 52 | 53 | @Override 54 | public UnaryCallable uploadMediaItemCallable() { 55 | return callable; 56 | } 57 | 58 | @Override 59 | public void shutdown() { 60 | backgroundResources.shutdown(); 61 | } 62 | 63 | @Override 64 | public boolean isShutdown() { 65 | return backgroundResources.isShutdown(); 66 | } 67 | 68 | @Override 69 | public boolean isTerminated() { 70 | return backgroundResources.isTerminated(); 71 | } 72 | 73 | @Override 74 | public void shutdownNow() { 75 | backgroundResources.shutdownNow(); 76 | } 77 | 78 | @Override 79 | public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 80 | return backgroundResources.awaitTermination(duration, unit); 81 | } 82 | 83 | @Override 84 | public void close() throws Exception { 85 | backgroundResources.close(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/upload/UploadApiException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.upload; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import com.google.api.gax.rpc.StatusCode; 21 | 22 | /** 23 | * Exception that occurred during byte uploads. Includes a URL to resume this upload. 24 | * 25 | *

This type of {@link ApiException} contains an optional resume URL from which an in-progress 26 | * upload can be resumed. 27 | * 28 | * @see PhotosLibraryUploadCallable 29 | */ 30 | public class UploadApiException extends ApiException { 31 | 32 | /** Resume URL from which an in-progress upload can be resumed. */ 33 | private final String resumeUrl; 34 | 35 | /** 36 | * Exception that occurred during an upload that includes a URL to resume the upload. 37 | * 38 | * @param cause The cause of this exception. 39 | * @param statusCode StatusCode that describes the underlying error. 40 | * @param retryable Whether the request can be retried. 41 | * @param resumeUrl The URL to use to resume the failed upload. 42 | */ 43 | public UploadApiException( 44 | Throwable cause, StatusCode statusCode, boolean retryable, String resumeUrl) { 45 | super(cause, statusCode, retryable); 46 | this.resumeUrl = resumeUrl; 47 | } 48 | 49 | /** 50 | * Exception that occurred during an upload that includes a resume URL to resume the upload. 51 | * 52 | * @param message The detail message that describes this error. 53 | * @param cause The cause of this exception. 54 | * @param statusCode StatusCode that describes the underlying error. 55 | * @param retryable Whether the request can be retried. 56 | * @param resumeUrl The URL to use to resume the failed upload. 57 | */ 58 | public UploadApiException( 59 | String message, Throwable cause, StatusCode statusCode, boolean retryable, String resumeUrl) { 60 | super(message, cause, statusCode, retryable); 61 | this.resumeUrl = resumeUrl; 62 | } 63 | 64 | /** 65 | * The resume URL from which the in-progress upload can be resumed. 66 | * 67 | *

This URL can be set for an {@link UploadMediaItemRequest} in {@link 68 | * UploadMediaItemRequest.Builder#setUploadUrl(String)}. 69 | */ 70 | public String getResumeUrl() { 71 | return resumeUrl; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/upload/UploadMediaItemResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.upload; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import java.util.Optional; 21 | 22 | /** Represents an upload response. */ 23 | public final class UploadMediaItemResponse { 24 | /** Represents an error while uploading the media item. */ 25 | public static final class Error { 26 | private final Optional resumeUrl; 27 | private final ApiException cause; 28 | 29 | private Error(Optional resumeUrl, ApiException cause) { 30 | this.resumeUrl = resumeUrl; 31 | this.cause = cause; 32 | } 33 | 34 | /** Url to retry the upload. */ 35 | public Optional getResumeUrl() { 36 | return resumeUrl; 37 | } 38 | 39 | /** Cause of the error. */ 40 | public Throwable getCause() { 41 | return cause; 42 | } 43 | 44 | public static final Builder newBuilder() { 45 | return new Builder(); 46 | } 47 | 48 | /** Builder for {@link Error}. */ 49 | public static final class Builder { 50 | private Optional resumeUrl; 51 | private ApiException cause; 52 | 53 | private Builder() { 54 | resumeUrl = Optional.empty(); 55 | } 56 | 57 | public Builder setResumeUrl(Optional resumeUrl) { 58 | this.resumeUrl = resumeUrl; 59 | return this; 60 | } 61 | 62 | public Builder setCause(ApiException cause) { 63 | this.cause = cause; 64 | return this; 65 | } 66 | 67 | public Error build() { 68 | return new Error(resumeUrl, cause); 69 | } 70 | } 71 | } 72 | 73 | private final Optional uploadToken; 74 | private final Optional error; 75 | 76 | private UploadMediaItemResponse(Optional uploadToken, Optional error) { 77 | this.uploadToken = uploadToken; 78 | this.error = error; 79 | } 80 | 81 | /** Upload token in case of success. */ 82 | public Optional getUploadToken() { 83 | return uploadToken; 84 | } 85 | 86 | /** Error in case of failure. */ 87 | public Optional getError() { 88 | return error; 89 | } 90 | 91 | public static final Builder newBuilder() { 92 | return new Builder(); 93 | } 94 | 95 | /** Builder for {@link UploadMediaItemResponse}. */ 96 | public static final class Builder { 97 | 98 | private Optional uploadToken; 99 | private Optional error; 100 | 101 | private Builder() {} 102 | 103 | public Builder setUploadToken(String uploadToken) { 104 | this.uploadToken = Optional.of(uploadToken); 105 | this.error = Optional.empty(); 106 | return this; 107 | } 108 | 109 | public Builder setError(Error error) { 110 | this.error = Optional.of(error); 111 | this.uploadToken = Optional.empty(); 112 | return this; 113 | } 114 | 115 | public UploadMediaItemResponse build() { 116 | return new UploadMediaItemResponse(uploadToken, error); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/util/AlbumPositionFactory.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.v1.util; 2 | 3 | import static com.google.photos.library.v1.proto.AlbumPosition.PositionType; 4 | 5 | import com.google.photos.library.v1.proto.AlbumPosition; 6 | 7 | /** Factory class to create different {@link AlbumPosition}s. */ 8 | public final class AlbumPositionFactory { 9 | private AlbumPositionFactory() {} 10 | 11 | /** 12 | * Creates an {@link AlbumPosition} positioned at the start of the album. 13 | * 14 | * @see AlbumPosition.PositionType#FIRST_IN_ALBUM 15 | */ 16 | public static final AlbumPosition createFirstInAlbum() { 17 | return AlbumPosition.newBuilder().setPosition(PositionType.FIRST_IN_ALBUM).build(); 18 | } 19 | 20 | /** 21 | * Creates an {@link AlbumPosition} positioned at the end of the album. 22 | * 23 | * @see AlbumPosition.PositionType#LAST_IN_ALBUM 24 | */ 25 | public static final AlbumPosition createLastInAlbum() { 26 | return AlbumPosition.newBuilder().setPosition(PositionType.LAST_IN_ALBUM).build(); 27 | } 28 | 29 | /** 30 | * Creates an {@link AlbumPosition} positioned after the provided media item. 31 | * 32 | * @see AlbumPosition.PositionType#AFTER_MEDIA_ITEM 33 | * @throws IllegalArgumentException Thrown if mediaItemId is null or empty. 34 | */ 35 | public static final AlbumPosition createAfterMediaItem(String mediaItemId) { 36 | if (mediaItemId == null || mediaItemId.isEmpty()) { 37 | throw new IllegalArgumentException("Media item ID cannot be null or empty."); 38 | } 39 | return AlbumPosition.newBuilder() 40 | .setPosition(PositionType.AFTER_MEDIA_ITEM) 41 | .setRelativeMediaItemId(mediaItemId) 42 | .build(); 43 | } 44 | 45 | /** 46 | * Creates an {@link AlbumPosition} positioned after the provided enrichment item. 47 | * 48 | * @see AlbumPosition.PositionType#AFTER_ENRICHMENT_ITEM 49 | * @throws IllegalArgumentException Thrown if enrichmentItemId is null or empty. 50 | */ 51 | public static final AlbumPosition createAfterEnrichmentItem(String enrichmentItemId) { 52 | if (enrichmentItemId == null || enrichmentItemId.isEmpty()) { 53 | throw new IllegalArgumentException("Enrichment item ID cannot be null or empty."); 54 | } 55 | return AlbumPosition.newBuilder() 56 | .setPosition(PositionType.AFTER_ENRICHMENT_ITEM) 57 | .setRelativeEnrichmentItemId(enrichmentItemId) 58 | .build(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/util/NewEnrichmentItemFactory.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.v1.util; 2 | 3 | import com.google.photos.library.v1.proto.Location; 4 | import com.google.photos.library.v1.proto.LocationEnrichment; 5 | import com.google.photos.library.v1.proto.MapEnrichment; 6 | import com.google.photos.library.v1.proto.NewEnrichmentItem; 7 | import com.google.photos.library.v1.proto.TextEnrichment; 8 | import com.google.type.LatLng; 9 | 10 | /** Factory class to create different {@link NewEnrichmentItem}s. */ 11 | public final class NewEnrichmentItemFactory { 12 | private NewEnrichmentItemFactory() {} 13 | 14 | /** Creates a {@link NewEnrichmentItem} with a {@link TextEnrichment}. */ 15 | public static final NewEnrichmentItem createTextEnrichment(String text) { 16 | return NewEnrichmentItem.newBuilder() 17 | .setTextEnrichment(TextEnrichment.newBuilder().setText(text).build()) 18 | .build(); 19 | } 20 | 21 | /** 22 | * Creates a {@link NewEnrichmentItem} with a {@link LocationEnrichment}. 23 | * 24 | * @throws IllegalArgumentException Thrown if the location name is null or empty. 25 | */ 26 | public static final NewEnrichmentItem createLocationEnrichment( 27 | String locationName, double latitude, double longitude) { 28 | if (locationName == null || locationName.isEmpty()) { 29 | throw new IllegalArgumentException("Location name cannot be null or empty."); 30 | } 31 | 32 | return NewEnrichmentItem.newBuilder() 33 | .setLocationEnrichment( 34 | LocationEnrichment.newBuilder() 35 | .setLocation( 36 | Location.newBuilder() 37 | .setLocationName(locationName) 38 | .setLatlng( 39 | LatLng.newBuilder().setLatitude(latitude).setLongitude(longitude)))) 40 | .build(); 41 | } 42 | 43 | /** 44 | * Creates a {@link NewEnrichmentItem} with a {@link MapEnrichment}. 45 | * 46 | * @throws IllegalArgumentException Thrown if the origin or destination location names are either 47 | * null or empty. 48 | */ 49 | public static final NewEnrichmentItem createMapEnrichment( 50 | String originLocationName, 51 | double originLatitude, 52 | double originLongitude, 53 | String destinationLocationName, 54 | double destinationLatitude, 55 | double destinationLongitude) { 56 | if (originLocationName == null || originLocationName.isEmpty()) { 57 | throw new IllegalArgumentException("Origin location name cannot be null or empty."); 58 | } 59 | if (destinationLocationName == null || destinationLocationName.isEmpty()) { 60 | throw new IllegalArgumentException("Destination location name cannot be null or empty."); 61 | } 62 | 63 | Location.Builder originLocation = 64 | Location.newBuilder() 65 | .setLocationName(originLocationName) 66 | .setLatlng( 67 | LatLng.newBuilder().setLatitude(originLatitude).setLongitude(originLongitude)); 68 | 69 | Location.Builder destinationLocation = 70 | Location.newBuilder() 71 | .setLocationName(destinationLocationName) 72 | .setLatlng( 73 | LatLng.newBuilder() 74 | .setLatitude(destinationLatitude) 75 | .setLongitude(destinationLongitude)); 76 | 77 | return NewEnrichmentItem.newBuilder() 78 | .setMapEnrichment( 79 | MapEnrichment.newBuilder() 80 | .setOrigin(originLocation) 81 | .setDestination(destinationLocation)) 82 | .build(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/util/NewMediaItemFactory.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.v1.util; 2 | 3 | import com.google.photos.library.v1.proto.NewMediaItem; 4 | import com.google.photos.library.v1.proto.SimpleMediaItem; 5 | 6 | /** Factory class to create different {@link NewMediaItem}s. */ 7 | public final class NewMediaItemFactory { 8 | private NewMediaItemFactory() {} 9 | 10 | /** 11 | * Creates a {@link NewMediaItem} with the given file name, description and upload token. 12 | * 13 | * @see SimpleMediaItem 14 | * @throws IllegalArgumentException Thrown if either the file name, description or uploadToken is 15 | * null or empty. 16 | */ 17 | public static final NewMediaItem createNewMediaItem( 18 | String uploadToken, String fileName, String description) { 19 | if (description == null || description.isEmpty()) { 20 | throw new IllegalArgumentException("The description cannot be null or empty."); 21 | } 22 | if (fileName == null || fileName.isEmpty()) { 23 | throw new IllegalArgumentException("The file name cannot be null or empty."); 24 | } 25 | if (uploadToken == null || uploadToken.isEmpty()) { 26 | throw new IllegalArgumentException("The upload token cannot be null or empty."); 27 | } 28 | 29 | return NewMediaItem.newBuilder() 30 | .setDescription(description) 31 | .setSimpleMediaItem( 32 | SimpleMediaItem.newBuilder().setUploadToken(uploadToken).setFileName(fileName)) 33 | .build(); 34 | } 35 | 36 | /** 37 | * Creates a {@link NewMediaItem} with the given description and upload token. 38 | * 39 | * @see SimpleMediaItem 40 | * @throws IllegalArgumentException Thrown if either the description or uploadToken is null or 41 | * empty. 42 | */ 43 | public static final NewMediaItem createNewMediaItem(String uploadToken, String description) { 44 | if (description == null || description.isEmpty()) { 45 | throw new IllegalArgumentException("The description cannot be null or empty."); 46 | } 47 | if (uploadToken == null || uploadToken.isEmpty()) { 48 | throw new IllegalArgumentException("The upload token cannot be null or empty."); 49 | } 50 | 51 | return NewMediaItem.newBuilder() 52 | .setDescription(description) 53 | .setSimpleMediaItem(SimpleMediaItem.newBuilder().setUploadToken(uploadToken)) 54 | .build(); 55 | } 56 | 57 | /** 58 | * Creates a {@link NewMediaItem} with the given upload token. 59 | * 60 | * @see SimpleMediaItem 61 | * @throws IllegalArgumentException Thrown if the uploadToken is null or empty. 62 | */ 63 | public static final NewMediaItem createNewMediaItem(String uploadToken) { 64 | if (uploadToken == null || uploadToken.isEmpty()) { 65 | throw new IllegalArgumentException("The upload token cannot be null or empty."); 66 | } 67 | 68 | return NewMediaItem.newBuilder() 69 | .setSimpleMediaItem(SimpleMediaItem.newBuilder().setUploadToken(uploadToken)) 70 | .build(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/library/v1/util/OrderBy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.util; 18 | 19 | import com.google.photos.library.v1.proto.Filters; 20 | 21 | /** 22 | * Order of search results. 23 | * 24 | *

The value expected by the Library API can be retrieved from {@link #getRequestValue()}. 25 | * 26 | * @see com.google.photos.library.v1.PhotosLibraryClient#searchMediaItems(Filters, OrderBy...) 27 | */ 28 | public enum OrderBy { 29 | MEDIAMETADATA_CREATION_TIME("MediaMetadata.creation_time"), 30 | MEDIAMETADATA_CREATION_TIME_DESC("MediaMetadata.creation_time desc"); 31 | 32 | /** Separator used to join multiple order configurations. */ 33 | public static final String SEPARATOR = ","; 34 | 35 | /** String representation of this order as expected by the API. */ 36 | private final String requestValue; 37 | 38 | /** 39 | * Order of search results. 40 | * 41 | * @param requestValue String representation as expected by the API. 42 | */ 43 | OrderBy(String requestValue) { 44 | this.requestValue = requestValue; 45 | } 46 | 47 | /** 48 | * String representation of a sort option. Returns a string that is accepted by the Google Photos 49 | * Library as a parameter. 50 | * 51 | * @return Representation of this order as accepted by the API. 52 | */ 53 | public String getRequestValue() { 54 | return requestValue; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/types/proto/ContributorInfoOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/types/media_item.proto 3 | 4 | package com.google.photos.types.proto; 5 | 6 | public interface ContributorInfoOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.types.ContributorInfo) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *

15 |    * URL to the profile picture of the contributor.
16 |    * 
17 | * 18 | * string profile_picture_base_url = 1; 19 | * 20 | * @return The profilePictureBaseUrl. 21 | */ 22 | java.lang.String getProfilePictureBaseUrl(); 23 | /** 24 | * 25 | * 26 | *
27 |    * URL to the profile picture of the contributor.
28 |    * 
29 | * 30 | * string profile_picture_base_url = 1; 31 | * 32 | * @return The bytes for profilePictureBaseUrl. 33 | */ 34 | com.google.protobuf.ByteString getProfilePictureBaseUrlBytes(); 35 | 36 | /** 37 | * 38 | * 39 | *
40 |    * Display name of the contributor.
41 |    * 
42 | * 43 | * string display_name = 2; 44 | * 45 | * @return The displayName. 46 | */ 47 | java.lang.String getDisplayName(); 48 | /** 49 | * 50 | * 51 | *
52 |    * Display name of the contributor.
53 |    * 
54 | * 55 | * string display_name = 2; 56 | * 57 | * @return The bytes for displayName. 58 | */ 59 | com.google.protobuf.ByteString getDisplayNameBytes(); 60 | } 61 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/types/proto/DateRangeOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/types/date_range.proto 3 | 4 | package com.google.photos.types.proto; 5 | 6 | public interface DateRangeOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.types.DateRange) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * The start date (included as part of the range) in one of the formats
16 |    * described.
17 |    * 
18 | * 19 | * .google.type.Date start_date = 1; 20 | * 21 | * @return Whether the startDate field is set. 22 | */ 23 | boolean hasStartDate(); 24 | /** 25 | * 26 | * 27 | *
28 |    * The start date (included as part of the range) in one of the formats
29 |    * described.
30 |    * 
31 | * 32 | * .google.type.Date start_date = 1; 33 | * 34 | * @return The startDate. 35 | */ 36 | com.google.type.Date getStartDate(); 37 | /** 38 | * 39 | * 40 | *
41 |    * The start date (included as part of the range) in one of the formats
42 |    * described.
43 |    * 
44 | * 45 | * .google.type.Date start_date = 1; 46 | */ 47 | com.google.type.DateOrBuilder getStartDateOrBuilder(); 48 | 49 | /** 50 | * 51 | * 52 | *
53 |    * The end date (included as part of the range). It must be specified in the
54 |    * same format as the start date.
55 |    * 
56 | * 57 | * .google.type.Date end_date = 2; 58 | * 59 | * @return Whether the endDate field is set. 60 | */ 61 | boolean hasEndDate(); 62 | /** 63 | * 64 | * 65 | *
66 |    * The end date (included as part of the range). It must be specified in the
67 |    * same format as the start date.
68 |    * 
69 | * 70 | * .google.type.Date end_date = 2; 71 | * 72 | * @return The endDate. 73 | */ 74 | com.google.type.Date getEndDate(); 75 | /** 76 | * 77 | * 78 | *
79 |    * The end date (included as part of the range). It must be specified in the
80 |    * same format as the start date.
81 |    * 
82 | * 83 | * .google.type.Date end_date = 2; 84 | */ 85 | com.google.type.DateOrBuilder getEndDateOrBuilder(); 86 | } 87 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/types/proto/DateRangeProto.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/types/date_range.proto 3 | 4 | package com.google.photos.types.proto; 5 | 6 | public final class DateRangeProto { 7 | private DateRangeProto() {} 8 | 9 | public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} 10 | 11 | public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { 12 | registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); 13 | } 14 | 15 | static final com.google.protobuf.Descriptors.Descriptor 16 | internal_static_google_photos_types_DateRange_descriptor; 17 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 18 | internal_static_google_photos_types_DateRange_fieldAccessorTable; 19 | 20 | public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { 21 | return descriptor; 22 | } 23 | 24 | private static com.google.protobuf.Descriptors.FileDescriptor descriptor; 25 | 26 | static { 27 | java.lang.String[] descriptorData = { 28 | "\n$google/photos/types/date_range.proto\022\023" 29 | + "google.photos.types\032\026google/type/date.pr" 30 | + "oto\"W\n\tDateRange\022%\n\nstart_date\030\001 \001(\0132\021.g" 31 | + "oogle.type.Date\022#\n\010end_date\030\002 \001(\0132\021.goog" 32 | + "le.type.DateBk\n\035com.google.photos.types." 33 | + "protoB\016DateRangeProtoP\001Z8google.golang.o" 34 | + "rg/genproto/googleapis/photos/types;type" 35 | + "sb\006proto3" 36 | }; 37 | descriptor = 38 | com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( 39 | descriptorData, 40 | new com.google.protobuf.Descriptors.FileDescriptor[] { 41 | com.google.type.DateProto.getDescriptor(), 42 | }); 43 | internal_static_google_photos_types_DateRange_descriptor = 44 | getDescriptor().getMessageTypes().get(0); 45 | internal_static_google_photos_types_DateRange_fieldAccessorTable = 46 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 47 | internal_static_google_photos_types_DateRange_descriptor, 48 | new java.lang.String[] { 49 | "StartDate", "EndDate", 50 | }); 51 | com.google.type.DateProto.getDescriptor(); 52 | } 53 | 54 | // @@protoc_insertion_point(outer_class_scope) 55 | } 56 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/types/proto/MediaMetadataOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/types/media_item.proto 3 | 4 | package com.google.photos.types.proto; 5 | 6 | public interface MediaMetadataOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.types.MediaMetadata) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * Time when the media item was first created (not when it was uploaded to
 16 |    * Google Photos).
 17 |    * 
18 | * 19 | * .google.protobuf.Timestamp creation_time = 1; 20 | * 21 | * @return Whether the creationTime field is set. 22 | */ 23 | boolean hasCreationTime(); 24 | /** 25 | * 26 | * 27 | *
 28 |    * Time when the media item was first created (not when it was uploaded to
 29 |    * Google Photos).
 30 |    * 
31 | * 32 | * .google.protobuf.Timestamp creation_time = 1; 33 | * 34 | * @return The creationTime. 35 | */ 36 | com.google.protobuf.Timestamp getCreationTime(); 37 | /** 38 | * 39 | * 40 | *
 41 |    * Time when the media item was first created (not when it was uploaded to
 42 |    * Google Photos).
 43 |    * 
44 | * 45 | * .google.protobuf.Timestamp creation_time = 1; 46 | */ 47 | com.google.protobuf.TimestampOrBuilder getCreationTimeOrBuilder(); 48 | 49 | /** 50 | * 51 | * 52 | *
 53 |    * Original width (in pixels) of the media item.
 54 |    * 
55 | * 56 | * int64 width = 2; 57 | * 58 | * @return The width. 59 | */ 60 | long getWidth(); 61 | 62 | /** 63 | * 64 | * 65 | *
 66 |    * Original height (in pixels) of the media item.
 67 |    * 
68 | * 69 | * int64 height = 3; 70 | * 71 | * @return The height. 72 | */ 73 | long getHeight(); 74 | 75 | /** 76 | * 77 | * 78 | *
 79 |    * Metadata for a photo media type.
 80 |    * 
81 | * 82 | * .google.photos.types.Photo photo = 6; 83 | * 84 | * @return Whether the photo field is set. 85 | */ 86 | boolean hasPhoto(); 87 | /** 88 | * 89 | * 90 | *
 91 |    * Metadata for a photo media type.
 92 |    * 
93 | * 94 | * .google.photos.types.Photo photo = 6; 95 | * 96 | * @return The photo. 97 | */ 98 | com.google.photos.types.proto.Photo getPhoto(); 99 | /** 100 | * 101 | * 102 | *
103 |    * Metadata for a photo media type.
104 |    * 
105 | * 106 | * .google.photos.types.Photo photo = 6; 107 | */ 108 | com.google.photos.types.proto.PhotoOrBuilder getPhotoOrBuilder(); 109 | 110 | /** 111 | * 112 | * 113 | *
114 |    * Metadata for a video media type.
115 |    * 
116 | * 117 | * .google.photos.types.Video video = 7; 118 | * 119 | * @return Whether the video field is set. 120 | */ 121 | boolean hasVideo(); 122 | /** 123 | * 124 | * 125 | *
126 |    * Metadata for a video media type.
127 |    * 
128 | * 129 | * .google.photos.types.Video video = 7; 130 | * 131 | * @return The video. 132 | */ 133 | com.google.photos.types.proto.Video getVideo(); 134 | /** 135 | * 136 | * 137 | *
138 |    * Metadata for a video media type.
139 |    * 
140 | * 141 | * .google.photos.types.Video video = 7; 142 | */ 143 | com.google.photos.types.proto.VideoOrBuilder getVideoOrBuilder(); 144 | 145 | public com.google.photos.types.proto.MediaMetadata.MetadataCase getMetadataCase(); 146 | } 147 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/types/proto/PhotoOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/types/media_item.proto 3 | 4 | package com.google.photos.types.proto; 5 | 6 | public interface PhotoOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.types.Photo) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
 15 |    * Brand of the camera with which the photo was taken.
 16 |    * 
17 | * 18 | * string camera_make = 1; 19 | * 20 | * @return The cameraMake. 21 | */ 22 | java.lang.String getCameraMake(); 23 | /** 24 | * 25 | * 26 | *
 27 |    * Brand of the camera with which the photo was taken.
 28 |    * 
29 | * 30 | * string camera_make = 1; 31 | * 32 | * @return The bytes for cameraMake. 33 | */ 34 | com.google.protobuf.ByteString getCameraMakeBytes(); 35 | 36 | /** 37 | * 38 | * 39 | *
 40 |    * Model of the camera with which the photo was taken.
 41 |    * 
42 | * 43 | * string camera_model = 2; 44 | * 45 | * @return The cameraModel. 46 | */ 47 | java.lang.String getCameraModel(); 48 | /** 49 | * 50 | * 51 | *
 52 |    * Model of the camera with which the photo was taken.
 53 |    * 
54 | * 55 | * string camera_model = 2; 56 | * 57 | * @return The bytes for cameraModel. 58 | */ 59 | com.google.protobuf.ByteString getCameraModelBytes(); 60 | 61 | /** 62 | * 63 | * 64 | *
 65 |    * Focal length of the camera lens with which the photo was taken.
 66 |    * 
67 | * 68 | * float focal_length = 3; 69 | * 70 | * @return The focalLength. 71 | */ 72 | float getFocalLength(); 73 | 74 | /** 75 | * 76 | * 77 | *
 78 |    * Aperture f number of the camera lens with which the photo was taken.
 79 |    * 
80 | * 81 | * float aperture_f_number = 4; 82 | * 83 | * @return The apertureFNumber. 84 | */ 85 | float getApertureFNumber(); 86 | 87 | /** 88 | * 89 | * 90 | *
 91 |    * ISO of the camera with which the photo was taken.
 92 |    * 
93 | * 94 | * int32 iso_equivalent = 5; 95 | * 96 | * @return The isoEquivalent. 97 | */ 98 | int getIsoEquivalent(); 99 | 100 | /** 101 | * 102 | * 103 | *
104 |    * Exposure time of the camera aperture when the photo was taken.
105 |    * 
106 | * 107 | * .google.protobuf.Duration exposure_time = 6; 108 | * 109 | * @return Whether the exposureTime field is set. 110 | */ 111 | boolean hasExposureTime(); 112 | /** 113 | * 114 | * 115 | *
116 |    * Exposure time of the camera aperture when the photo was taken.
117 |    * 
118 | * 119 | * .google.protobuf.Duration exposure_time = 6; 120 | * 121 | * @return The exposureTime. 122 | */ 123 | com.google.protobuf.Duration getExposureTime(); 124 | /** 125 | * 126 | * 127 | *
128 |    * Exposure time of the camera aperture when the photo was taken.
129 |    * 
130 | * 131 | * .google.protobuf.Duration exposure_time = 6; 132 | */ 133 | com.google.protobuf.DurationOrBuilder getExposureTimeOrBuilder(); 134 | } 135 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/types/proto/SharedAlbumOptionsOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/types/album.proto 3 | 4 | package com.google.photos.types.proto; 5 | 6 | public interface SharedAlbumOptionsOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.types.SharedAlbumOptions) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * True if the shared album allows collaborators (users who have joined
16 |    * the album) to add media items to it. Defaults to false.
17 |    * 
18 | * 19 | * bool is_collaborative = 1; 20 | * 21 | * @return The isCollaborative. 22 | */ 23 | boolean getIsCollaborative(); 24 | 25 | /** 26 | * 27 | * 28 | *
29 |    * True if the shared album allows collaborators (users who have joined the
30 |    * album) to add comments to the album. Defaults to false.
31 |    * 
32 | * 33 | * bool is_commentable = 2; 34 | * 35 | * @return The isCommentable. 36 | */ 37 | boolean getIsCommentable(); 38 | } 39 | -------------------------------------------------------------------------------- /photoslibraryapi/src/main/java/com/google/photos/types/proto/VideoOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/photos/types/media_item.proto 3 | 4 | package com.google.photos.types.proto; 5 | 6 | public interface VideoOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:google.photos.types.Video) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** 12 | * 13 | * 14 | *
15 |    * Brand of the camera with which the video was taken.
16 |    * 
17 | * 18 | * string camera_make = 1; 19 | * 20 | * @return The cameraMake. 21 | */ 22 | java.lang.String getCameraMake(); 23 | /** 24 | * 25 | * 26 | *
27 |    * Brand of the camera with which the video was taken.
28 |    * 
29 | * 30 | * string camera_make = 1; 31 | * 32 | * @return The bytes for cameraMake. 33 | */ 34 | com.google.protobuf.ByteString getCameraMakeBytes(); 35 | 36 | /** 37 | * 38 | * 39 | *
40 |    * Model of the camera with which the video was taken.
41 |    * 
42 | * 43 | * string camera_model = 2; 44 | * 45 | * @return The cameraModel. 46 | */ 47 | java.lang.String getCameraModel(); 48 | /** 49 | * 50 | * 51 | *
52 |    * Model of the camera with which the video was taken.
53 |    * 
54 | * 55 | * string camera_model = 2; 56 | * 57 | * @return The bytes for cameraModel. 58 | */ 59 | com.google.protobuf.ByteString getCameraModelBytes(); 60 | 61 | /** 62 | * 63 | * 64 | *
65 |    * Frame rate of the video.
66 |    * 
67 | * 68 | * double fps = 3; 69 | * 70 | * @return The fps. 71 | */ 72 | double getFps(); 73 | 74 | /** 75 | * 76 | * 77 | *
78 |    * Processing status of the video.
79 |    * 
80 | * 81 | * .google.photos.types.VideoProcessingStatus status = 4; 82 | * 83 | * @return The enum numeric value on the wire for status. 84 | */ 85 | int getStatusValue(); 86 | /** 87 | * 88 | * 89 | *
90 |    * Processing status of the video.
91 |    * 
92 | * 93 | * .google.photos.types.VideoProcessingStatus status = 4; 94 | * 95 | * @return The status. 96 | */ 97 | com.google.photos.types.proto.VideoProcessingStatus getStatus(); 98 | } 99 | -------------------------------------------------------------------------------- /photoslibraryapi/src/test/java/com/google/photos/library/v1/PhotosLibraryClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1; 18 | 19 | import com.google.api.gax.core.NoCredentialsProvider; 20 | import com.google.api.gax.grpc.testing.LocalChannelProvider; 21 | import com.google.api.gax.grpc.testing.MockGrpcService; 22 | import com.google.api.gax.grpc.testing.MockServiceHelper; 23 | import com.google.photos.library.v1.internal.MockPhotosLibrary; 24 | import com.google.photos.library.v1.proto.Filters; 25 | import com.google.photos.library.v1.proto.SearchMediaItemsRequest; 26 | import com.google.photos.library.v1.proto.SearchMediaItemsResponse; 27 | import com.google.photos.library.v1.util.OrderBy; 28 | import com.google.protobuf.AbstractMessage; 29 | import java.io.IOException; 30 | import java.util.Arrays; 31 | import java.util.List; 32 | import java.util.UUID; 33 | import org.junit.AfterClass; 34 | import org.junit.Assert; 35 | import org.junit.Before; 36 | import org.junit.BeforeClass; 37 | import org.junit.Test; 38 | 39 | public class PhotosLibraryClientTest { 40 | private static MockPhotosLibrary mockPhotosLibrary; 41 | private static MockServiceHelper mockServiceHelper; 42 | private LocalChannelProvider channelProvider; 43 | private PhotosLibraryClient client; 44 | 45 | @BeforeClass 46 | public static void startStaticServer() { 47 | mockPhotosLibrary = new MockPhotosLibrary(); 48 | mockServiceHelper = 49 | new MockServiceHelper( 50 | UUID.randomUUID().toString(), Arrays.asList(mockPhotosLibrary)); 51 | mockServiceHelper.start(); 52 | } 53 | 54 | @AfterClass 55 | public static void stopServer() { 56 | mockServiceHelper.stop(); 57 | } 58 | 59 | @Before 60 | public void setUp() throws IOException { 61 | mockServiceHelper.reset(); 62 | channelProvider = mockServiceHelper.createChannelProvider(); 63 | PhotosLibrarySettings settings = 64 | PhotosLibrarySettings.newBuilder() 65 | .setTransportChannelProvider(channelProvider) 66 | .setCredentialsProvider(NoCredentialsProvider.create()) 67 | .build(); 68 | client = PhotosLibraryClient.initialize(settings); 69 | } 70 | 71 | /** 72 | * Test that the orderBy parameter is generated and used correctly. 73 | * 74 | * @throws Exception 75 | */ 76 | @Test 77 | public void searchWithOrderTest() throws Exception { 78 | Filters filter = Filters.newBuilder().build(); 79 | 80 | SearchMediaItemsResponse expectedResponse = SearchMediaItemsResponse.newBuilder().build(); 81 | mockPhotosLibrary.addResponse(expectedResponse); 82 | OrderBy order = OrderBy.MEDIAMETADATA_CREATION_TIME_DESC; 83 | client.searchMediaItems(filter, order); 84 | 85 | List actualRequests = mockPhotosLibrary.getRequests(); 86 | Assert.assertEquals(1, actualRequests.size()); 87 | SearchMediaItemsRequest actualRequest = (SearchMediaItemsRequest) actualRequests.get(0); 88 | 89 | Assert.assertEquals("MediaMetadata.creation_time desc", actualRequest.getOrderBy()); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /photoslibraryapi/src/test/java/com/google/photos/library/v1/internal/MockPhotosLibrary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.v1.internal; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockPhotosLibrary implements MockGrpcService { 29 | private final MockPhotosLibraryImpl serviceImpl; 30 | 31 | public MockPhotosLibrary() { 32 | serviceImpl = new MockPhotosLibraryImpl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /sample/README.md: -------------------------------------------------------------------------------- 1 | # Google Photos Library API Java Client Library Samples 2 | 3 | This directory contains three samples to help you get started with the Java 4 | client library for the [Google Photos Library API](https://developers.google.com/photos). 5 | 6 | ## Get started 7 | 8 | 1. Follow the steps in the client library get started guide either by 9 | [cloning this repository](../README.md#using-git-clone) or [downloading a compressed tarball](../README.md#downloading-a-compressed-tarball). 10 | 1. Set up your Google Developers project, enable the Google Photos Library API 11 | and set up new OAuth credentials **for an "other-type" application**. 12 | Download the OAuth configuration as a JSON file. See [Setting up your OAuth2 credentials](../README.md#Setting-up-your-OAuth2-credentials). 13 | 2. Open the `build.gradle` file in this directory in your IDE or make a build from the commandline 14 | using `./gradlew assemble` to build the samples. 15 | 3. Run one of the samples main classes from the package `com.google.photos.library.sample.demos` . 16 | You can also run one of the following gradle tasks, for example `./gradlew sample:runAlbum`: 17 | * `sample:runAlbum` 18 | * `sample:runFilter` 19 | * `sample:runShare` 20 | * `sample:runUpload` 21 | 22 | Note: You may need to clean your build project and build directories (`./gradlew clean`) before you 23 | run a different sample app. The user authentication credentials are cached for all samples together 24 | and execution will fail for samples that require different authentication scopes. 25 | 26 | ## Samples 27 | This repository includes three samples. 28 | 29 | ### Filters 30 | Class: `com.google.photos.library.sample.demos.FilterDemo`. 31 | [File: `FilterDemo.java`](src/main/java/com/google/photos/library/sample/demos/FilterDemo.java) 32 | 33 | Shows how to list media, apply filters and read media metadata. 34 | 35 | ### Albums and Uploads 36 | Class: `com.google.photos.library.sample.demos.AlbumDemo`. 37 | [File: `AlbumDemo.java`](src/main/java/com/google/photos/library/sample/demos/AlbumDemo.java) 38 | 39 | Shows how to list albums, list the content of albums, create new albums and 40 | upload media. 41 | 42 | ### Sharing 43 | Class: `com.google.photos.library.sample.demos.ShareDemo`. 44 | [File: `AlbumDemo.java`](src/main/java/com/google/photos/library/sample/demos/ShareDemo.java) 45 | 46 | Shows how to share an album created by this application using `share tokens`. 47 | 48 | ### Upload 49 | Class: `com.google.photos.library.sample.demos.UploadDemo`. 50 | [File: `AlbumDemo.java`](src/main/java/com/google/photos/library/sample/demos/UploadDemo.java) 51 | 52 | Shows how to efficiently upload media, including parallelization and other best 53 | practices. -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'application' 18 | 19 | dependencies { 20 | implementation project(':photoslibraryapi') 21 | implementation 'com.google.auth:google-auth-library-oauth2-http:1.3.0' 22 | implementation 'com.google.oauth-client:google-oauth-client-jetty:1.32.1' 23 | implementation 'com.google.oauth-client:google-oauth-client-java6:1.32.1' 24 | implementation('com.google.api-client:google-api-client:1.33.0') { 25 | exclude group: 'com.google.guava', module: 'guava-jdk5' 26 | } 27 | 28 | implementation 'com.google.api:gax-grpc:2.7.1' 29 | implementation 'com.google.api:gax:2.7.1' 30 | implementation 'com.google.http-client:google-http-client-gson:1.41.0' 31 | implementation 'commons-cli:commons-cli:1.5.0' 32 | implementation 'commons-lang:commons-lang:2.6' 33 | implementation 'io.grpc:grpc-netty:1.42.1' 34 | implementation 'io.grpc:grpc-protobuf:1.42.1' 35 | implementation 'io.netty:netty-tcnative-boringssl-static:2.0.47.Final' 36 | implementation 'org.apache.httpcomponents:httpclient:4.5.13' 37 | } 38 | 39 | sourceSets { 40 | main { 41 | java { 42 | srcDir "src/main/java" 43 | } 44 | resources { 45 | srcDir "src/main/resources" 46 | } 47 | } 48 | } 49 | 50 | // By default, run the album demo. 51 | mainClassName = "com.google.photos.library.sample.demo.AlbumDemo" 52 | 53 | task runAlbum(type: JavaExec) { 54 | classpath sourceSets.main.runtimeClasspath 55 | main = "com.google.photos.library.sample.demos.AlbumDemo" 56 | } 57 | 58 | task runFilter(type: JavaExec) { 59 | classpath sourceSets.main.runtimeClasspath 60 | main = "com.google.photos.library.sample.demos.FilterDemo" 61 | } 62 | 63 | task runShare(type: JavaExec) { 64 | classpath sourceSets.main.runtimeClasspath 65 | main = "com.google.photos.library.sample.demos.ShareDemo" 66 | } 67 | 68 | task runUpload(type: JavaExec) { 69 | classpath sourceSets.main.runtimeClasspath 70 | main = "com.google.photos.library.sample.demos.UploadDemo" 71 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/Resources.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample; 2 | 3 | public final class Resources { 4 | private Resources() {} 5 | 6 | public static final String TITLE = "Photos Library API Sample"; 7 | public static final String GOOGLE_PHOTOS_ICON_RESOURCE = "/assets/google_photos.png"; 8 | public static final String BACK_ICON_RESOURCE = "/assets/back.png"; 9 | public static final String ALBUM_ICON_RESOURCE = "/assets/album.png"; 10 | } 11 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/AbstractCreateAlbumToolPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.components; 18 | 19 | import com.google.photos.library.sample.helpers.UIHelper; 20 | import com.google.photos.library.sample.views.AbstractCustomView; 21 | import java.awt.*; 22 | import java.io.IOException; 23 | import java.util.Optional; 24 | import java.util.function.BiConsumer; 25 | import javax.swing.*; 26 | 27 | /** Represents an {@link ToolPanel} that lets user create a new album in the library. */ 28 | public abstract class AbstractCreateAlbumToolPanel extends ToolPanel { 29 | private static final String CREATE_TEXT = "CREATE ALBUM"; 30 | private static final Dimension CREATE_DIMENSION = new Dimension(144 /* width */, 36 /* height */); 31 | private static final String CREATE_ALBUM_INPUT_TITLE = "Create album"; 32 | private static final String CREATE_ALBUM_INPUT_DESCRIPTION = 33 | "To create a new album," + "enter the title here and click on 'OK'."; 34 | 35 | public AbstractCreateAlbumToolPanel(BiConsumer onCreateClicked) { 36 | super(); 37 | } 38 | 39 | protected JPanel getCreatePanel(BiConsumer onCreateClicked) 40 | throws IOException, FontFormatException { 41 | JPanel panel = new JPanel(); 42 | panel.setLayout(new FlowLayout(FlowLayout.LEFT)); 43 | panel.add(getCreateButton(onCreateClicked)); 44 | return panel; 45 | } 46 | 47 | protected CustomButton getCreateButton(BiConsumer onCreateClicked) 48 | throws IOException, FontFormatException { 49 | CustomButton button = new CustomButton(CREATE_TEXT); 50 | UIHelper.setFixedSize(button, CREATE_DIMENSION); 51 | 52 | button.addActionListener( 53 | actionEvent -> { 54 | AbstractCustomView customView = (AbstractCustomView) getRootPane().getParent(); 55 | Optional albumTitle = 56 | Optional.ofNullable( 57 | (String) 58 | JOptionPane.showInputDialog( 59 | customView, 60 | CREATE_ALBUM_INPUT_DESCRIPTION, 61 | CREATE_ALBUM_INPUT_TITLE, 62 | JOptionPane.PLAIN_MESSAGE)); 63 | if (albumTitle.isPresent()) { 64 | onCreateClicked.accept(customView, albumTitle.get()); 65 | } 66 | }); 67 | return button; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/AlbumPreviewPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.components; 18 | 19 | import java.awt.BorderLayout; 20 | import javax.swing.JLabel; 21 | import javax.swing.JPanel; 22 | 23 | /** Represents an album preview, which contains the album thumbnail and title. */ 24 | public final class AlbumPreviewPanel extends JPanel { 25 | private static final int HGAP = 0; 26 | private static final int VGAP = 6; 27 | 28 | public AlbumPreviewPanel(JLabel thumbnail, JLabel title) { 29 | setLayout(new BorderLayout(HGAP, VGAP)); 30 | add(thumbnail, BorderLayout.CENTER); 31 | add(title, BorderLayout.PAGE_END); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/ConnectToPhotosButton.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import com.google.photos.library.sample.Resources; 4 | import com.google.photos.library.sample.helpers.UIHelper; 5 | import com.google.photos.library.sample.views.ConnectToPhotosView; 6 | import java.awt.Color; 7 | import java.awt.Dimension; 8 | import java.awt.Image; 9 | import javax.swing.ImageIcon; 10 | 11 | /** Represents a styled button for Connect To Google Photos. */ 12 | public final class ConnectToPhotosButton extends CustomButton { 13 | private static final String TEXT = "Connect to Google Photos"; 14 | private static final Dimension DIMENSION = new Dimension(280 /* width */, 40 /* height */); 15 | private static final String FOREGROUND_COLOR = "0x3c4043"; 16 | private static final String BACKGROUND_COLOR = "0xffffff"; 17 | private static final float FONT_SIZE = 14; 18 | private static final float FONT_WEIGHT = 1.5f; 19 | private static final int ICON_WIDTH = 24; 20 | private static final int ICON_HEIGHT = 24; 21 | private static final int ICON_TEXT_GAP = 8; 22 | 23 | public ConnectToPhotosButton() { 24 | super(TEXT); 25 | UIHelper.setFixedSize(this, DIMENSION); 26 | setForeground(Color.decode(FOREGROUND_COLOR)); 27 | setBackground(Color.decode(BACKGROUND_COLOR)); 28 | setText(TEXT); 29 | setIcon(getConnectIcon()); 30 | setIconTextGap(ICON_TEXT_GAP); 31 | setFont(UIHelper.resizeFont(getFont(), FONT_WEIGHT, FONT_SIZE)); 32 | } 33 | 34 | private static ImageIcon getConnectIcon() { 35 | ImageIcon imageIcon = 36 | new ImageIcon(ConnectToPhotosView.class.getResource(Resources.GOOGLE_PHOTOS_ICON_RESOURCE)); 37 | return new ImageIcon( 38 | imageIcon.getImage().getScaledInstance(ICON_WIDTH, ICON_HEIGHT, Image.SCALE_SMOOTH)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/CreateAlbumToolPanel.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import com.google.photos.library.sample.helpers.UIHelper; 4 | import com.google.photos.library.sample.views.AbstractCustomView; 5 | import java.awt.*; 6 | import java.io.IOException; 7 | import java.util.function.BiConsumer; 8 | import javax.swing.JLabel; 9 | 10 | /** 11 | * Represents an {@link ToolPanel} that lets user create a new album in the library and includes a 12 | * title and introduction. 13 | */ 14 | public final class CreateAlbumToolPanel extends AbstractCreateAlbumToolPanel { 15 | 16 | private static final int VGAP = 20; 17 | 18 | private static final String TITLE = "Google Photos albums"; 19 | private static final int TITLE_SIZE = 20; 20 | 21 | private static final String DESCRIPTION = 22 | "You're viewing all albums in the user library. " 23 | + "Use the create action to add a new album."; 24 | private static final int DESCRIPTION_SIZE = 13; 25 | 26 | public CreateAlbumToolPanel(BiConsumer onCreateClicked) 27 | throws IOException, FontFormatException { 28 | super(onCreateClicked); 29 | setLayout(new BorderLayout(0 /* unset hgap */, VGAP)); 30 | add(getTitleLabel(), BorderLayout.PAGE_START); 31 | add(getDescriptionLabel(), BorderLayout.CENTER); 32 | add(getCreatePanel(onCreateClicked), BorderLayout.PAGE_END); 33 | } 34 | 35 | private JLabel getTitleLabel() { 36 | JLabel label = 37 | new JLabel(String.format("%s", UIHelper.getFormattedText(TITLE, TITLE_SIZE))); 38 | return label; 39 | } 40 | 41 | private JLabel getDescriptionLabel() { 42 | JLabel label = 43 | new JLabel( 44 | String.format( 45 | "%s", UIHelper.getFormattedText(DESCRIPTION, DESCRIPTION_SIZE))); 46 | return label; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/CustomButton.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import com.google.photos.library.sample.helpers.UIHelper; 4 | import java.awt.Color; 5 | import javax.swing.JButton; 6 | 7 | /** Represents a customized button. */ 8 | public class CustomButton extends JButton { 9 | 10 | private static final float FONT_SIZE = 13; 11 | private static final float FONT_WEIGHT = 1.6f; 12 | private static final String BACKGROUND_COLOR = "0x4285f4"; 13 | private static final String FOREGROUND_COLOR = "0xffffff"; 14 | 15 | public CustomButton(String text) { 16 | super(text); 17 | configureButton(); 18 | } 19 | 20 | private void configureButton() { 21 | setBorderPainted(false); 22 | setOpaque(true); 23 | setFont(UIHelper.resizeFont(getFont(), FONT_WEIGHT, FONT_SIZE)); 24 | setBackground(Color.decode(BACKGROUND_COLOR)); 25 | setForeground(Color.decode(FOREGROUND_COLOR)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/DatePickerPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.components; 18 | 19 | import com.google.type.Date; 20 | import java.awt.GridLayout; 21 | import java.awt.event.ActionEvent; 22 | import java.awt.event.ActionListener; 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | import java.util.Optional; 26 | import java.util.OptionalInt; 27 | import java.util.function.Consumer; 28 | import javax.swing.JFormattedTextField; 29 | import javax.swing.JPanel; 30 | 31 | /** A component that lets user enter day, month, and year. */ 32 | public final class DatePickerPanel extends JPanel implements ActionListener { 33 | private final JFormattedTextField yearTextField; 34 | private final JFormattedTextField monthTextField; 35 | private final JFormattedTextField dayTextField; 36 | private List> dateConsumers; 37 | 38 | public DatePickerPanel() { 39 | super(); 40 | setLayout(new GridLayout(1 /* rows */, 3 /* cols */)); 41 | 42 | yearTextField = new JFormattedTextField(); 43 | yearTextField.setToolTipText("Year (YYYY)"); 44 | yearTextField.addActionListener(this); 45 | add(yearTextField); 46 | 47 | monthTextField = new JFormattedTextField(); 48 | monthTextField.setToolTipText("Month (MM)"); 49 | monthTextField.addActionListener(this); 50 | add(monthTextField); 51 | 52 | dayTextField = new JFormattedTextField(); 53 | dayTextField.setToolTipText("Day (DD)"); 54 | dayTextField.addActionListener(this); 55 | add(dayTextField); 56 | 57 | dateConsumers = new ArrayList<>(); 58 | } 59 | 60 | public void addDateConsumer(Consumer dateConsumer) { 61 | dateConsumers.add(dateConsumer); 62 | } 63 | 64 | public Date getSelectedDate() { 65 | Date.Builder dateBuilder = Date.newBuilder(); 66 | 67 | OptionalInt year = tryParseInt(yearTextField.getText()); 68 | if (year.isPresent()) { 69 | dateBuilder.setYear(year.getAsInt()); 70 | } 71 | 72 | OptionalInt month = tryParseInt(monthTextField.getText()); 73 | if (month.isPresent()) { 74 | dateBuilder.setMonth(month.getAsInt()); 75 | } 76 | 77 | OptionalInt day = tryParseInt(dayTextField.getText()); 78 | if (day.isPresent()) { 79 | dateBuilder.setDay(day.getAsInt()); 80 | } 81 | 82 | return dateBuilder.build(); 83 | } 84 | 85 | private OptionalInt tryParseInt(String text) { 86 | return Optional.of(text) 87 | .filter(s -> s.matches("\\d+")) 88 | .map(s -> OptionalInt.of(Integer.parseInt(s))) 89 | .orElse(OptionalInt.empty()); 90 | } 91 | 92 | @Override 93 | public void actionPerformed(ActionEvent e) { 94 | for (Consumer dateConsumer : dateConsumers) { 95 | dateConsumer.accept(getSelectedDate()); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/LoadMoreButton.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import com.google.photos.library.sample.helpers.UIHelper; 4 | import java.awt.Color; 5 | import java.awt.Dimension; 6 | 7 | /** Represents a styled button that lets user paginate results. */ 8 | public class LoadMoreButton extends CustomButton { 9 | 10 | private static final Dimension DIMENSION = new Dimension(0 /* unset width */, 36 /* height */); 11 | private static final String FOREGROUND_COLOR = "0x3c4043"; 12 | private static final String BACKGROUND_COLOR = "0xe8eaed"; 13 | 14 | public LoadMoreButton(String text) { 15 | super(text); 16 | UIHelper.setFixedSize(this, DIMENSION); 17 | setForeground(Color.decode(FOREGROUND_COLOR)); 18 | setBackground(Color.decode(BACKGROUND_COLOR)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/OrderByPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.components; 18 | 19 | import com.google.photos.library.v1.util.OrderBy; 20 | import java.awt.*; 21 | import java.awt.event.ActionEvent; 22 | import java.awt.event.ActionListener; 23 | import java.util.ArrayList; 24 | import java.util.HashMap; 25 | import java.util.List; 26 | import java.util.Map; 27 | import java.util.function.Consumer; 28 | import javax.swing.*; 29 | 30 | /** A component that lets user enter day, month, and year. */ 31 | public final class OrderByPanel extends JPanel implements ActionListener { 32 | ButtonGroup group = new ButtonGroup(); 33 | private final Map orderByRadioButton = new HashMap<>(); 34 | 35 | private final List> orderByConsumers; 36 | 37 | public OrderByPanel() { 38 | super(); 39 | setLayout(new GridLayout(3 /* rows */, 1 /* cols */)); 40 | 41 | JRadioButton undefined = new JRadioButton("Default (undefined)"); 42 | undefined.setSelected(true); 43 | undefined.addActionListener(this); 44 | add(undefined); 45 | group.add(undefined); 46 | 47 | // Create the radio buttons with different sort options and 48 | // map the radio button to its own OrderBy configuration that will be included 49 | // in the API request. 50 | 51 | JRadioButton newestFirst = new JRadioButton("Newest first"); 52 | orderByRadioButton.put(newestFirst, OrderBy.MEDIAMETADATA_CREATION_TIME_DESC); 53 | newestFirst.addActionListener(this); 54 | add(newestFirst); 55 | group.add(newestFirst); 56 | 57 | JRadioButton oldestFirst = new JRadioButton("Oldest first"); 58 | orderByRadioButton.put(oldestFirst, OrderBy.MEDIAMETADATA_CREATION_TIME); 59 | oldestFirst.addActionListener(this); 60 | add(oldestFirst); 61 | group.add(oldestFirst); 62 | 63 | orderByConsumers = new ArrayList<>(); 64 | } 65 | 66 | public void addOrderByConsumer(Consumer orderByConsumer) { 67 | orderByConsumers.add(orderByConsumer); 68 | } 69 | 70 | /** 71 | * Returns the selected order or null if none is selected. 72 | * 73 | * @return 74 | */ 75 | public OrderBy getSelectedOrderBy() { 76 | for (Map.Entry entry : orderByRadioButton.entrySet()) { 77 | if (entry.getKey().isSelected()) { 78 | return entry.getValue(); 79 | } 80 | } 81 | return null; 82 | } 83 | 84 | @Override 85 | public void actionPerformed(ActionEvent e) { 86 | for (Consumer orderByConsumer : orderByConsumers) { 87 | orderByConsumer.accept(getSelectedOrderBy()); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/PlainCreateAlbumToolPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.components; 18 | 19 | import com.google.photos.library.sample.views.AbstractCustomView; 20 | import java.awt.*; 21 | import java.io.IOException; 22 | import java.util.function.BiConsumer; 23 | 24 | /** Represents an {@link ToolPanel} that lets user create a new album in the library. */ 25 | public class PlainCreateAlbumToolPanel extends AbstractCreateAlbumToolPanel { 26 | 27 | public PlainCreateAlbumToolPanel(BiConsumer onCreateClicked) 28 | throws IOException, FontFormatException { 29 | super(onCreateClicked); 30 | setLayout(new FlowLayout(FlowLayout.LEFT)); 31 | add(getCreatePanel(onCreateClicked)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/SearchToolPanel.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import com.google.photos.library.sample.helpers.UIHelper; 4 | import com.google.photos.library.sample.views.AbstractCustomView; 5 | import java.awt.BorderLayout; 6 | import java.awt.Dimension; 7 | import java.awt.FlowLayout; 8 | import java.util.function.Consumer; 9 | import javax.swing.JLabel; 10 | import javax.swing.JPanel; 11 | 12 | /** Represents a {@link ToolPanel} that lets user search for media items in the library. */ 13 | public final class SearchToolPanel extends ToolPanel { 14 | 15 | private static final int VGAP = 20; 16 | 17 | private static final String TITLE = "Google Photos library"; 18 | private static final int TITLE_SIZE = 20; 19 | private static final String DESCRIPTION = 20 | "You're viewing all photos in the user library. " 21 | + "Use the search action to refine your results with filters."; 22 | private static final int DESCRIPTION_SIZE = 13; 23 | private static final String SEARCH_TEXT = "SEARCH"; 24 | private static final Dimension SEARCH_DIMENSION = new Dimension(94 /* width */, 36 /* height */); 25 | 26 | public SearchToolPanel(Consumer onSearchClicked) { 27 | super(); 28 | setLayout(new BorderLayout(0 /* unset hgap */, VGAP)); 29 | add(getTitleLabel(), BorderLayout.PAGE_START); 30 | add(getDescriptionLabel(), BorderLayout.CENTER); 31 | add(getSearchPanel(onSearchClicked), BorderLayout.PAGE_END); 32 | } 33 | 34 | private JLabel getTitleLabel() { 35 | JLabel label = 36 | new JLabel(String.format("%s", UIHelper.getFormattedText(TITLE, TITLE_SIZE))); 37 | return label; 38 | } 39 | 40 | private JLabel getDescriptionLabel() { 41 | JLabel label = 42 | new JLabel( 43 | String.format( 44 | "%s", UIHelper.getFormattedText(DESCRIPTION, DESCRIPTION_SIZE))); 45 | return label; 46 | } 47 | 48 | private JPanel getSearchPanel(Consumer onSearchClicked) { 49 | JPanel panel = new JPanel(); 50 | panel.setLayout(new FlowLayout(FlowLayout.LEFT)); 51 | panel.add(getSearchButton(onSearchClicked)); 52 | return panel; 53 | } 54 | 55 | private CustomButton getSearchButton(Consumer onSearchClicked) { 56 | CustomButton button = new CustomButton(SEARCH_TEXT); 57 | UIHelper.setFixedSize(button, SEARCH_DIMENSION); 58 | button.addActionListener( 59 | actionEvent -> { 60 | // Gets the view that contains this panel. 61 | AbstractCustomView parentView = (AbstractCustomView) getRootPane().getParent(); 62 | onSearchClicked.accept(parentView); 63 | }); 64 | return button; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/ShareAlbumToolPanel.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import com.google.photos.library.sample.helpers.UIHelper; 4 | import com.google.photos.library.sample.views.AbstractCustomView; 5 | import com.google.photos.types.proto.Album; 6 | import java.awt.BorderLayout; 7 | import java.awt.Dimension; 8 | import java.awt.FlowLayout; 9 | import java.awt.GridLayout; 10 | import java.util.function.BiConsumer; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.JTextArea; 14 | import javax.swing.border.Border; 15 | import javax.swing.border.EmptyBorder; 16 | 17 | /** Represents a {@link ToolPanel} that contains album metadata and let user share an album. */ 18 | public final class ShareAlbumToolPanel extends ToolPanel { 19 | private static final String META_TEXT = "Meta"; 20 | private static final int META_TEXT_SIZE = 20; 21 | 22 | private static final Border METADATA_BORDER = 23 | new EmptyBorder(12 /* top */, 24 /* left */, 12 /* bottom */, 24 /* right */); 24 | 25 | private static final String SHARE_TEXT = "SHARE ALBUM"; 26 | private static final Dimension SHARE_DIMENSION = new Dimension(144 /* width */, 36 /* height */); 27 | 28 | public ShareAlbumToolPanel(Album album, BiConsumer onShareClicked) { 29 | super(); 30 | add(getTitleLabel(), BorderLayout.PAGE_START); 31 | add(getMetadataTextArea(album), BorderLayout.CENTER); 32 | // Adds share button for not-shared albums 33 | if (!album.hasShareInfo()) { 34 | add(getSharePanel(album, onShareClicked), BorderLayout.PAGE_END); 35 | } 36 | } 37 | 38 | private JLabel getTitleLabel() { 39 | JLabel label = 40 | new JLabel( 41 | String.format("%s", UIHelper.getFormattedText(META_TEXT, META_TEXT_SIZE))); 42 | return label; 43 | } 44 | 45 | private JTextArea getMetadataTextArea(Album album) { 46 | JTextArea metadataTextArea = new JTextArea(); 47 | metadataTextArea.setBorder(METADATA_BORDER); 48 | metadataTextArea.setLayout( 49 | new GridLayout(2 /* rows */, 1 /* cols */, 0 /* unset hgap */, 10 /* vgap */)); 50 | metadataTextArea.setEditable(false); 51 | metadataTextArea.setLineWrap(true); 52 | metadataTextArea.append(String.format("Product URL: %s", album.getProductUrl())); 53 | if (album.hasShareInfo()) { 54 | metadataTextArea.append( 55 | String.format("\nShare URL: %s", album.getShareInfo().getShareableUrl())); 56 | metadataTextArea.append( 57 | String.format("\nShare Token: %s", album.getShareInfo().getShareToken())); 58 | } 59 | return metadataTextArea; 60 | } 61 | 62 | private JPanel getSharePanel(Album album, BiConsumer onShareClicked) { 63 | JPanel panel = new JPanel(); 64 | panel.setLayout(new FlowLayout(FlowLayout.LEFT)); 65 | panel.add(getShareButton(album, onShareClicked)); 66 | return panel; 67 | } 68 | 69 | private CustomButton getShareButton( 70 | Album album, BiConsumer onShareClicked) { 71 | CustomButton button = new CustomButton(SHARE_TEXT); 72 | UIHelper.setFixedSize(button, SHARE_DIMENSION); 73 | button.addActionListener( 74 | actionEvent -> { 75 | AbstractCustomView customView = (AbstractCustomView) getRootPane().getParent(); 76 | onShareClicked.accept(customView, album); 77 | }); 78 | return button; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/ShareableAlbumToolPanel.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import com.google.photos.library.sample.helpers.UIHelper; 4 | import com.google.photos.library.sample.views.AbstractCustomView; 5 | import java.awt.*; 6 | import java.io.IOException; 7 | import java.util.function.BiConsumer; 8 | import javax.swing.JLabel; 9 | 10 | /** Represents a {@link ToolPanel} for shareable album list view. */ 11 | public final class ShareableAlbumToolPanel extends ToolPanel { 12 | private static final int VGAP = 20; 13 | 14 | private static final String TITLE = "Albums you can share"; 15 | private static final int TITLE_SIZE = 20; 16 | 17 | private static final String DESCRIPTION = 18 | "You're viewing all albums that you can share, this only includes albums that have been " 19 | + "created by this app."; 20 | private static final int DESCRIPTION_SIZE = 13; 21 | 22 | public ShareableAlbumToolPanel(BiConsumer onCreateClicked) 23 | throws IOException, FontFormatException { 24 | super(); 25 | setLayout(new BorderLayout(0 /* unset hgap */, VGAP)); 26 | add(getTitleLabel(), BorderLayout.PAGE_START); 27 | add(getDescriptionLabel(), BorderLayout.CENTER); 28 | add(new PlainCreateAlbumToolPanel(onCreateClicked), BorderLayout.PAGE_END); 29 | } 30 | 31 | private JLabel getTitleLabel() { 32 | JLabel label = 33 | new JLabel(String.format("%s", UIHelper.getFormattedText(TITLE, TITLE_SIZE))); 34 | return label; 35 | } 36 | 37 | private JLabel getDescriptionLabel() { 38 | JLabel label = 39 | new JLabel( 40 | String.format( 41 | "%s", UIHelper.getFormattedText(DESCRIPTION, DESCRIPTION_SIZE))); 42 | return label; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/components/ToolPanel.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.components; 2 | 3 | import java.awt.BorderLayout; 4 | import javax.swing.JPanel; 5 | 6 | /** An abstract panel that may contain metadata, buttons. */ 7 | public abstract class ToolPanel extends JPanel { 8 | private static final int DEFAULT_HGAP = 0; 9 | private static final int DEFAULT_VGAP = 8; 10 | 11 | public ToolPanel() { 12 | setLayout(new BorderLayout(DEFAULT_HGAP, DEFAULT_VGAP)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/helpers/ErrorHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.helpers; 18 | 19 | import com.google.photos.library.sample.views.AbstractCustomView; 20 | import javax.swing.*; 21 | 22 | /** Utility methods for handling errors. */ 23 | public class ErrorHelper { 24 | 25 | /** 26 | * Show a dialog with the message and the exception. 27 | * 28 | * @param view Parent for dialog 29 | * @param exception Exception that caused this error 30 | * @param message Message to include in the dialog 31 | */ 32 | public static void showErrorMessage( 33 | AbstractCustomView view, Exception exception, String message) { 34 | JOptionPane.showMessageDialog(view, message + "\n" + exception.getMessage()); 35 | } 36 | 37 | /** 38 | * Show a dialog with the message and the exception. 39 | * 40 | * @param view Parent for dialog 41 | * @param exception Exception that caused this error 42 | */ 43 | public static void showErrorMessage(AbstractCustomView view, Exception exception) { 44 | JOptionPane.showMessageDialog(view, exception.getMessage()); 45 | } 46 | 47 | /** 48 | * Exit the app and show a dialog with the message and the exception. 49 | * 50 | * @param view Parent for dialog 51 | * @param exception Exception that caused this error 52 | * @param message Message to include in the dialog 53 | */ 54 | public static void showFatalErrorMessage( 55 | AbstractCustomView view, Exception exception, String message) { 56 | JOptionPane.showMessageDialog(view, message + "\n" + exception.getMessage()); 57 | System.exit(5); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/helpers/UIHelper.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.helpers; 2 | 3 | import java.awt.Component; 4 | import java.awt.Dimension; 5 | import java.awt.Font; 6 | import java.awt.font.TextAttribute; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import javax.swing.JLabel; 10 | import javax.swing.border.Border; 11 | import javax.swing.border.EmptyBorder; 12 | 13 | /** Represents a helper for UI. */ 14 | public final class UIHelper { 15 | public static final Border NO_BORDER = 16 | new EmptyBorder(0 /* top */, 0 /* left */, 0 /* bottom */, 0 /* right */); 17 | 18 | private static final float DEFAULT_FONT_WEIGHT = 1.5f; 19 | private static final int DEFAULT_LINE_MARGIN = 0; 20 | 21 | private UIHelper() {} 22 | 23 | public static void setUp() { 24 | System.setProperty("awt.useSystemAAFontSettings", "on"); 25 | System.setProperty("swing.aatext", "true"); 26 | } 27 | 28 | public static void setFixedSize(Component component, Dimension dimension) { 29 | component.setSize(dimension); 30 | component.setPreferredSize(dimension); 31 | component.setMaximumSize(dimension); 32 | component.setMinimumSize(dimension); 33 | } 34 | 35 | public static String getFormattedText(String text, int fontSize) { 36 | return getFormattedText(text, fontSize, DEFAULT_FONT_WEIGHT, DEFAULT_LINE_MARGIN); 37 | } 38 | 39 | public static String getFormattedText(String text, int fontSize, int lineMargin) { 40 | return getFormattedText(text, fontSize, DEFAULT_FONT_WEIGHT, lineMargin); 41 | } 42 | 43 | public static String getFormattedText( 44 | String text, int fontSize, float fontWeight, int lineMargin) { 45 | return String.format( 46 | "

%s

", 47 | fontSize, fontWeight, lineMargin, lineMargin, text); 48 | } 49 | 50 | public static JLabel getFormattedLabel(String text, int fontSize) { 51 | String formattedText = 52 | getFormattedText(text, fontSize, DEFAULT_FONT_WEIGHT, DEFAULT_LINE_MARGIN); 53 | return new JLabel(String.format("%s", formattedText)); 54 | } 55 | 56 | public static JLabel getFormattedLabel(String text, int fontSize, int lineMargin) { 57 | String formattedText = getFormattedText(text, fontSize, DEFAULT_FONT_WEIGHT, lineMargin); 58 | return new JLabel(String.format("%s", formattedText)); 59 | } 60 | 61 | public static JLabel getFormattedLabel( 62 | String text, int fontSize, float fontWeight, int lineMargin) { 63 | String formattedText = 64 | String.format( 65 | "

%s

", 66 | fontSize, fontWeight, lineMargin, lineMargin, text); 67 | return new JLabel(String.format("%s", formattedText)); 68 | } 69 | 70 | public static Font resizeFont(Font font, float fontWeight, float fontSize) { 71 | Map attributes = new HashMap<>(); 72 | attributes.put(TextAttribute.WEIGHT, fontWeight); 73 | attributes.put(TextAttribute.SIZE, fontSize); 74 | return font.deriveFont(attributes); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/suppliers/AlbumsSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.suppliers; 18 | 19 | import com.google.photos.types.proto.Album; 20 | import java.util.List; 21 | import java.util.function.Supplier; 22 | 23 | public interface AlbumsSupplier extends Supplier> { 24 | void refresh(); 25 | } 26 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/suppliers/ListAlbumsSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.suppliers; 18 | 19 | import com.google.photos.library.v1.PhotosLibraryClient; 20 | import com.google.photos.library.v1.proto.ListAlbumsRequest; 21 | import com.google.photos.library.v1.proto.ListAlbumsResponse; 22 | import com.google.photos.types.proto.Album; 23 | import java.util.Collections; 24 | import java.util.List; 25 | import java.util.Optional; 26 | 27 | public final class ListAlbumsSupplier implements AlbumsSupplier { 28 | private final PhotosLibraryClient client; 29 | private final ListAlbumsRequest baseRequest; 30 | private Optional request; 31 | 32 | public ListAlbumsSupplier(PhotosLibraryClient client, ListAlbumsRequest request) { 33 | this.client = client; 34 | this.baseRequest = request; 35 | this.request = Optional.of(this.baseRequest); 36 | } 37 | 38 | @Override 39 | public List get() { 40 | if (!request.isPresent()) { 41 | return Collections.emptyList(); 42 | } 43 | ListAlbumsResponse response = client.listAlbumsCallable().call(request.get()); 44 | if (response.getNextPageToken().isEmpty()) { 45 | request = Optional.empty(); 46 | } else { 47 | request = 48 | Optional.of(request.get().toBuilder().setPageToken(response.getNextPageToken()).build()); 49 | } 50 | return response.getAlbumsList(); 51 | } 52 | 53 | @Override 54 | public void refresh() { 55 | this.request = Optional.of(this.baseRequest); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/suppliers/ListSharedAlbumsSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.suppliers; 18 | 19 | import com.google.photos.library.v1.PhotosLibraryClient; 20 | import com.google.photos.library.v1.proto.ListSharedAlbumsRequest; 21 | import com.google.photos.library.v1.proto.ListSharedAlbumsResponse; 22 | import com.google.photos.types.proto.Album; 23 | import java.util.Collections; 24 | import java.util.List; 25 | import java.util.Optional; 26 | 27 | public final class ListSharedAlbumsSupplier implements AlbumsSupplier { 28 | private final PhotosLibraryClient client; 29 | private final ListSharedAlbumsRequest baseRequest; 30 | private Optional request; 31 | 32 | public ListSharedAlbumsSupplier(PhotosLibraryClient client, ListSharedAlbumsRequest request) { 33 | this.client = client; 34 | this.baseRequest = request; 35 | this.request = Optional.of(this.baseRequest); 36 | } 37 | 38 | @Override 39 | public List get() { 40 | if (!request.isPresent()) { 41 | return Collections.emptyList(); 42 | } 43 | ListSharedAlbumsResponse response = client.listSharedAlbumsCallable().call(request.get()); 44 | if (response.getNextPageToken().isEmpty()) { 45 | request = Optional.empty(); 46 | } else { 47 | request = 48 | Optional.of(request.get().toBuilder().setPageToken(response.getNextPageToken()).build()); 49 | } 50 | return response.getSharedAlbumsList(); 51 | } 52 | 53 | @Override 54 | public void refresh() { 55 | this.request = Optional.of(this.baseRequest); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/suppliers/SearchMediaItemSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.photos.library.sample.suppliers; 18 | 19 | import com.google.photos.library.v1.PhotosLibraryClient; 20 | import com.google.photos.library.v1.proto.SearchMediaItemsRequest; 21 | import com.google.photos.library.v1.proto.SearchMediaItemsResponse; 22 | import com.google.photos.types.proto.MediaItem; 23 | import java.util.Collections; 24 | import java.util.Optional; 25 | import java.util.function.Supplier; 26 | 27 | public final class SearchMediaItemSupplier implements Supplier> { 28 | private final PhotosLibraryClient client; 29 | private SearchMediaItemsRequest baseRequest; 30 | private Optional request; 31 | 32 | public SearchMediaItemSupplier(PhotosLibraryClient client, SearchMediaItemsRequest request) { 33 | this.client = client; 34 | this.baseRequest = request; 35 | this.request = Optional.of(request); 36 | } 37 | 38 | public void refresh() { 39 | this.request = Optional.of(this.baseRequest); 40 | } 41 | 42 | public void setBaseRequest(SearchMediaItemsRequest request) { 43 | this.baseRequest = request; 44 | } 45 | 46 | @Override 47 | public Iterable get() { 48 | if (!request.isPresent()) { 49 | return Collections.emptyList(); 50 | } 51 | SearchMediaItemsResponse response = client.searchMediaItemsCallable().call(request.get()); 52 | if (response.getNextPageToken().isEmpty()) { 53 | request = Optional.empty(); 54 | } else { 55 | request = 56 | Optional.of(request.get().toBuilder().setPageToken(response.getNextPageToken()).build()); 57 | } 58 | return response.getMediaItemsList(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/views/AbstractCustomView.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.views; 2 | 3 | import java.awt.Color; 4 | import java.awt.Dimension; 5 | import java.awt.Toolkit; 6 | import java.lang.Thread.State; 7 | import javax.swing.JFrame; 8 | import javax.swing.JOptionPane; 9 | 10 | /** Represents an abstract view that can show, hide and update itself. */ 11 | public abstract class AbstractCustomView extends JFrame { 12 | private static final String DEFAULT_DIALOG_BACKGROUND = "0xf8f9fa"; 13 | 14 | private final LoadingView loadingView; 15 | 16 | private final Thread initializationThread; 17 | 18 | private final Object updateLock = new Object(); 19 | private Thread updateThread = null; 20 | private boolean rerunUpdate = false; 21 | 22 | public AbstractCustomView() { 23 | hideView(); 24 | loadingView = LoadingView.getLoadingView(); 25 | initializationThread = getInitializationThread(); 26 | 27 | getRootPane().setOpaque(false); 28 | getContentPane().setBackground(Color.decode(DEFAULT_DIALOG_BACKGROUND)); 29 | } 30 | 31 | public final void showView() { 32 | setVisible(true); 33 | } 34 | 35 | public final void hideView() { 36 | setVisible(false); 37 | } 38 | 39 | /** Initializes the view in a new thread and shows loading indicator. */ 40 | public final void initializeView() { 41 | if (initializationThread.getState() == State.NEW) { 42 | loadingView.showView(); 43 | initializationThread.start(); 44 | } 45 | } 46 | 47 | /** Updates the view in a new thread and shows loading indicator. */ 48 | public final void updateView() { 49 | synchronized (updateLock) { 50 | if ((updateThread == null || updateThread.getState() == State.TERMINATED) 51 | && initializationThread.getState() == State.TERMINATED) { 52 | updateThread = getUpdateThread(); 53 | loadingView.showView(); 54 | updateThread.start(); 55 | } else { 56 | rerunUpdate = true; 57 | } 58 | } 59 | } 60 | 61 | /** View initialization method */ 62 | protected abstract void initialize() throws Exception; 63 | 64 | /** View update method */ 65 | protected abstract void update() throws Exception; 66 | 67 | private final Thread getUpdateThread() { 68 | final Runnable updateRunnable = 69 | () -> { 70 | try { 71 | update(); 72 | } catch (Exception e) { 73 | JOptionPane.showMessageDialog(this, e.getMessage()); 74 | } 75 | }; 76 | return new Thread( 77 | () -> { 78 | while (true) { 79 | updateRunnable.run(); 80 | synchronized (updateLock) { 81 | if (rerunUpdate) { 82 | rerunUpdate = false; 83 | } else { 84 | loadingView.hideView(); 85 | break; 86 | } 87 | } 88 | } 89 | }); 90 | } 91 | 92 | private final Thread getInitializationThread() { 93 | return new Thread( 94 | () -> { 95 | try { 96 | moveToCenter(); 97 | initialize(); 98 | requestFocusInWindow(); 99 | showView(); 100 | synchronized (updateLock) { 101 | if (rerunUpdate) { 102 | rerunUpdate = false; 103 | updateThread = getUpdateThread(); 104 | updateThread.start(); 105 | } else { 106 | loadingView.hideView(); 107 | } 108 | } 109 | } catch (Exception e) { 110 | JOptionPane.showMessageDialog(this, e.getMessage()); 111 | } 112 | }); 113 | } 114 | 115 | private final void moveToCenter() { 116 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 117 | setLocation( 118 | screenSize.width / 2 - this.getSize().width / 2, 119 | screenSize.height / 2 - this.getSize().height / 2); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /sample/src/main/java/com/google/photos/library/sample/views/LoadingView.java: -------------------------------------------------------------------------------- 1 | package com.google.photos.library.sample.views; 2 | 3 | import com.google.photos.library.sample.helpers.UIHelper; 4 | import java.awt.Dimension; 5 | import java.awt.GridLayout; 6 | import java.awt.Toolkit; 7 | import java.util.Optional; 8 | import javax.swing.BorderFactory; 9 | import javax.swing.JDialog; 10 | import javax.swing.JFrame; 11 | import javax.swing.JPanel; 12 | import javax.swing.JProgressBar; 13 | import javax.swing.border.Border; 14 | 15 | public final class LoadingView extends JDialog { 16 | private static final Dimension LOADING_DIMENSION = 17 | new Dimension(250 /* width */, 50 /* height */); 18 | private static final Border BORDER = 19 | BorderFactory.createEmptyBorder(10 /* top */, 10 /* left */, 10 /* bottom */, 10 /* right */); 20 | 21 | private static Optional loadingView = Optional.empty(); 22 | 23 | private LoadingView() { 24 | UIHelper.setFixedSize(this, LOADING_DIMENSION); 25 | setTitle("Loading"); 26 | moveToCenter(); 27 | setResizable(false); 28 | setAlwaysOnTop(true); 29 | setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); 30 | 31 | JProgressBar progressBar = new JProgressBar(); 32 | progressBar.setIndeterminate(true); 33 | 34 | JPanel panel = new JPanel(); 35 | panel.setBorder(BORDER); 36 | panel.setLayout(new GridLayout(1 /* rows */, 1 /* cols */)); 37 | panel.add(progressBar); 38 | 39 | add(panel); 40 | } 41 | 42 | public static LoadingView getLoadingView() { 43 | if (!loadingView.isPresent()) { 44 | loadingView = Optional.of(new LoadingView()); 45 | } 46 | return loadingView.get(); 47 | } 48 | 49 | public void showView() { 50 | setVisible(true); 51 | } 52 | 53 | public void hideView() { 54 | setVisible(false); 55 | } 56 | 57 | private void moveToCenter() { 58 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 59 | setLocation( 60 | screenSize.width / 2 - this.getSize().width / 2, 61 | screenSize.height / 2 - this.getSize().height / 2); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /sample/src/main/resources/assets/album.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/java-photoslibrary/fe3e366c2264774d78f6ae684c5842803ca2c02b/sample/src/main/resources/assets/album.png -------------------------------------------------------------------------------- /sample/src/main/resources/assets/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/java-photoslibrary/fe3e366c2264774d78f6ae684c5842803ca2c02b/sample/src/main/resources/assets/back.png -------------------------------------------------------------------------------- /sample/src/main/resources/assets/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/java-photoslibrary/fe3e366c2264774d78f6ae684c5842803ca2c02b/sample/src/main/resources/assets/filter.png -------------------------------------------------------------------------------- /sample/src/main/resources/assets/google_photos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/java-photoslibrary/fe3e366c2264774d78f6ae684c5842803ca2c02b/sample/src/main/resources/assets/google_photos.png -------------------------------------------------------------------------------- /sample/src/main/resources/assets/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/java-photoslibrary/fe3e366c2264774d78f6ae684c5842803ca2c02b/sample/src/main/resources/assets/share.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include 'sample', 'photoslibraryapi' --------------------------------------------------------------------------------