From 9e57987788b4364e6592e3f799e10e0893799e40 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 20 Sep 2022 18:02:22 +0000 Subject: [PATCH] feat: [speech] added Speech-to-Text V2 API proto (#8422) - [ ] Regenerate this pull request now. The next generation Speech-to-Text V2 API provides the same features clients are familiar with in the existing Speech-to-Text API, while modernizing and simplifying the API using API best practices, resourceful methods, and updated infrastructure. Although this proto is published, the service is not yet available. PiperOrigin-RevId: 474926510 Source-Link: https://github.com/googleapis/googleapis/commit/bb4d7f49441884fdfffa2d7552254d8540a597e2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/9ecdb75038b10cfe4685d8a301e2abf8e4dfaa48 Copy-Tag: eyJwIjoiamF2YS1zcGVlY2gvLk93bEJvdC55YW1sIiwiaCI6IjllY2RiNzUwMzhiMTBjZmU0Njg1ZDhhMzAxZTJhYmY4ZTRkZmFhNDgifQ== --- java-speech/README.md | 10 +- java-speech/google-cloud-speech-bom/pom.xml | 10 + java-speech/google-cloud-speech/pom.xml | 9 + .../google/cloud/speech/v2/SpeechClient.java | 3858 ++++++++++ .../cloud/speech/v2/SpeechSettings.java | 608 ++ .../cloud/speech/v2/gapic_metadata.json | 87 + .../google/cloud/speech/v2/package-info.java | 43 + .../v2/stub/GrpcSpeechCallableFactory.java | 113 + .../cloud/speech/v2/stub/GrpcSpeechStub.java | 1069 +++ .../stub/HttpJsonSpeechCallableFactory.java | 105 + .../speech/v2/stub/HttpJsonSpeechStub.java | 1615 ++++ .../cloud/speech/v2/stub/SpeechStub.java | 264 + .../speech/v2/stub/SpeechStubSettings.java | 1681 ++++ .../google/cloud/speech/v2/MockSpeech.java | 59 + .../cloud/speech/v2/MockSpeechImpl.java | 559 ++ .../speech/v2/SpeechClientHttpJsonTest.java | 2635 +++++++ .../cloud/speech/v2/SpeechClientTest.java | 2437 ++++++ .../grpc-google-cloud-speech-v2/pom.xml | 69 + .../google/cloud/speech/v2/SpeechGrpc.java | 2830 +++++++ java-speech/pom.xml | 12 + .../clirr-ignored-differences.xml | 19 + .../proto-google-cloud-speech-v2/pom.xml | 46 + .../speech/v2/AutoDetectDecodingConfig.java | 478 ++ .../v2/AutoDetectDecodingConfigOrBuilder.java | 24 + .../speech/v2/BatchRecognizeFileMetadata.java | 1546 ++++ .../BatchRecognizeFileMetadataOrBuilder.java | 191 + .../speech/v2/BatchRecognizeFileResult.java | 899 +++ .../v2/BatchRecognizeFileResultOrBuilder.java | 85 + .../speech/v2/BatchRecognizeMetadata.java | 867 +++ .../v2/BatchRecognizeMetadataOrBuilder.java | 97 + .../speech/v2/BatchRecognizeRequest.java | 1913 +++++ .../v2/BatchRecognizeRequestOrBuilder.java | 227 + .../speech/v2/BatchRecognizeResponse.java | 821 ++ .../v2/BatchRecognizeResponseOrBuilder.java | 85 + .../BatchRecognizeTranscriptionMetadata.java | 1000 +++ ...cognizeTranscriptionMetadataOrBuilder.java | 98 + .../cloud/speech/v2/CloudSpeechProto.java | 1346 ++++ .../com/google/cloud/speech/v2/Config.java | 1172 +++ .../google/cloud/speech/v2/ConfigName.java | 192 + .../cloud/speech/v2/ConfigOrBuilder.java | 131 + .../speech/v2/CreateCustomClassRequest.java | 1256 +++ .../v2/CreateCustomClassRequestOrBuilder.java | 142 + .../speech/v2/CreatePhraseSetRequest.java | 1256 +++ .../v2/CreatePhraseSetRequestOrBuilder.java | 142 + .../speech/v2/CreateRecognizerRequest.java | 1256 +++ .../v2/CreateRecognizerRequestOrBuilder.java | 142 + .../google/cloud/speech/v2/CustomClass.java | 4727 ++++++++++++ .../cloud/speech/v2/CustomClassName.java | 227 + .../cloud/speech/v2/CustomClassOrBuilder.java | 521 ++ .../speech/v2/DeleteCustomClassRequest.java | 1049 +++ .../v2/DeleteCustomClassRequestOrBuilder.java | 115 + .../speech/v2/DeletePhraseSetRequest.java | 1042 +++ .../v2/DeletePhraseSetRequestOrBuilder.java | 113 + .../speech/v2/DeleteRecognizerRequest.java | 1042 +++ .../v2/DeleteRecognizerRequestOrBuilder.java | 113 + .../speech/v2/ExplicitDecodingConfig.java | 1039 +++ .../v2/ExplicitDecodingConfigOrBuilder.java | 91 + .../cloud/speech/v2/GetConfigRequest.java | 666 ++ .../speech/v2/GetConfigRequestOrBuilder.java | 58 + .../speech/v2/GetCustomClassRequest.java | 660 ++ .../v2/GetCustomClassRequestOrBuilder.java | 56 + .../cloud/speech/v2/GetPhraseSetRequest.java | 659 ++ .../v2/GetPhraseSetRequestOrBuilder.java | 56 + .../cloud/speech/v2/GetRecognizerRequest.java | 660 ++ .../v2/GetRecognizerRequestOrBuilder.java | 56 + .../speech/v2/ListCustomClassesRequest.java | 1067 +++ .../v2/ListCustomClassesRequestOrBuilder.java | 120 + .../speech/v2/ListCustomClassesResponse.java | 1158 +++ .../ListCustomClassesResponseOrBuilder.java | 108 + .../speech/v2/ListPhraseSetsRequest.java | 1062 +++ .../v2/ListPhraseSetsRequestOrBuilder.java | 119 + .../speech/v2/ListPhraseSetsResponse.java | 1152 +++ .../v2/ListPhraseSetsResponseOrBuilder.java | 108 + .../speech/v2/ListRecognizersRequest.java | 1063 +++ .../v2/ListRecognizersRequestOrBuilder.java | 119 + .../speech/v2/ListRecognizersResponse.java | 1153 +++ .../v2/ListRecognizersResponseOrBuilder.java | 108 + .../google/cloud/speech/v2/LocationName.java | 192 + .../cloud/speech/v2/OperationMetadata.java | 6785 +++++++++++++++++ .../speech/v2/OperationMetadataOrBuilder.java | 762 ++ .../com/google/cloud/speech/v2/PhraseSet.java | 4981 ++++++++++++ .../google/cloud/speech/v2/PhraseSetName.java | 223 + .../cloud/speech/v2/PhraseSetOrBuilder.java | 536 ++ .../cloud/speech/v2/RecognitionConfig.java | 1758 +++++ .../speech/v2/RecognitionConfigOrBuilder.java | 176 + .../cloud/speech/v2/RecognitionFeatures.java | 1844 +++++ .../v2/RecognitionFeaturesOrBuilder.java | 218 + .../v2/RecognitionResponseMetadata.java | 735 ++ .../RecognitionResponseMetadataOrBuilder.java | 60 + .../cloud/speech/v2/RecognizeRequest.java | 1955 +++++ .../speech/v2/RecognizeRequestOrBuilder.java | 270 + .../cloud/speech/v2/RecognizeResponse.java | 1260 +++ .../speech/v2/RecognizeResponseOrBuilder.java | 117 + .../google/cloud/speech/v2/Recognizer.java | 4570 +++++++++++ .../cloud/speech/v2/RecognizerName.java | 223 + .../cloud/speech/v2/RecognizerOrBuilder.java | 655 ++ .../speech/v2/SpeakerDiarizationConfig.java | 666 ++ .../v2/SpeakerDiarizationConfigOrBuilder.java | 58 + .../cloud/speech/v2/SpeechAdaptation.java | 2680 +++++++ .../speech/v2/SpeechAdaptationOrBuilder.java | 141 + .../v2/SpeechRecognitionAlternative.java | 1318 ++++ ...SpeechRecognitionAlternativeOrBuilder.java | 136 + .../speech/v2/SpeechRecognitionResult.java | 1600 ++++ .../v2/SpeechRecognitionResultOrBuilder.java | 171 + .../speech/v2/StreamingRecognitionConfig.java | 1532 ++++ .../StreamingRecognitionConfigOrBuilder.java | 190 + .../v2/StreamingRecognitionFeatures.java | 2158 ++++++ ...StreamingRecognitionFeaturesOrBuilder.java | 103 + .../speech/v2/StreamingRecognitionResult.java | 1824 +++++ .../StreamingRecognitionResultOrBuilder.java | 207 + .../speech/v2/StreamingRecognizeRequest.java | 1262 +++ .../StreamingRecognizeRequestOrBuilder.java | 131 + .../speech/v2/StreamingRecognizeResponse.java | 2109 +++++ .../StreamingRecognizeResponseOrBuilder.java | 204 + .../speech/v2/UndeleteCustomClassRequest.java | 958 +++ .../UndeleteCustomClassRequestOrBuilder.java | 101 + .../speech/v2/UndeletePhraseSetRequest.java | 950 +++ .../v2/UndeletePhraseSetRequestOrBuilder.java | 99 + .../speech/v2/UndeleteRecognizerRequest.java | 950 +++ .../UndeleteRecognizerRequestOrBuilder.java | 99 + .../cloud/speech/v2/UpdateConfigRequest.java | 1034 +++ .../v2/UpdateConfigRequestOrBuilder.java | 104 + .../speech/v2/UpdateCustomClassRequest.java | 1175 +++ .../v2/UpdateCustomClassRequestOrBuilder.java | 127 + .../speech/v2/UpdatePhraseSetRequest.java | 1163 +++ .../v2/UpdatePhraseSetRequestOrBuilder.java | 124 + .../speech/v2/UpdateRecognizerRequest.java | 1163 +++ .../v2/UpdateRecognizerRequestOrBuilder.java | 124 + .../com/google/cloud/speech/v2/WordInfo.java | 1619 ++++ .../cloud/speech/v2/WordInfoOrBuilder.java | 203 + .../google/cloud/speech/v2/cloud_speech.proto | 1965 +++++ java-speech/renovate.json | 74 + .../batchrecognize/AsyncBatchRecognize.java | 57 + .../AsyncBatchRecognizeLRO.java | 59 + .../batchrecognize/SyncBatchRecognize.java | 54 + ...eldmaskListbatchrecognizefilemetadata.java | 54 + ...eldmaskListbatchrecognizefilemetadata.java | 53 + .../SyncCreateSetCredentialsProvider.java | 44 + .../SyncCreateSetCredentialsProvider1.java | 43 + .../create/SyncCreateSetEndpoint.java | 40 + .../AsyncCreateCustomClass.java | 53 + .../AsyncCreateCustomClassLRO.java | 54 + .../SyncCreateCustomClass.java | 49 + ...tomClassLocationnameCustomclassString.java | 45 + ...ateCustomClassStringCustomclassString.java | 45 + .../createphraseset/AsyncCreatePhraseSet.java | 53 + .../AsyncCreatePhraseSetLRO.java | 54 + .../createphraseset/SyncCreatePhraseSet.java | 49 + ...ePhraseSetLocationnamePhrasesetString.java | 44 + ...cCreatePhraseSetStringPhrasesetString.java | 44 + .../AsyncCreateRecognizer.java | 53 + .../AsyncCreateRecognizerLRO.java | 54 + .../SyncCreateRecognizer.java | 49 + ...ecognizerLocationnameRecognizerString.java | 45 + ...reateRecognizerStringRecognizerString.java | 45 + .../AsyncDeleteCustomClass.java | 52 + .../AsyncDeleteCustomClassLRO.java | 54 + .../SyncDeleteCustomClass.java | 49 + .../SyncDeleteCustomClassCustomclassname.java | 42 + .../SyncDeleteCustomClassString.java | 42 + .../deletephraseset/AsyncDeletePhraseSet.java | 52 + .../AsyncDeletePhraseSetLRO.java | 54 + .../deletephraseset/SyncDeletePhraseSet.java | 49 + .../SyncDeletePhraseSetPhrasesetname.java | 42 + .../SyncDeletePhraseSetString.java | 42 + .../AsyncDeleteRecognizer.java | 52 + .../AsyncDeleteRecognizerLRO.java | 54 + .../SyncDeleteRecognizer.java | 49 + .../SyncDeleteRecognizerRecognizername.java | 42 + .../SyncDeleteRecognizerString.java | 42 + .../getconfig/AsyncGetConfig.java | 49 + .../speechclient/getconfig/SyncGetConfig.java | 46 + .../getconfig/SyncGetConfigConfigname.java | 42 + .../getconfig/SyncGetConfigString.java | 42 + .../getcustomclass/AsyncGetCustomClass.java | 49 + .../getcustomclass/SyncGetCustomClass.java | 46 + .../SyncGetCustomClassCustomclassname.java | 42 + .../SyncGetCustomClassString.java | 42 + .../getphraseset/AsyncGetPhraseSet.java | 49 + .../getphraseset/SyncGetPhraseSet.java | 46 + .../SyncGetPhraseSetPhrasesetname.java | 42 + .../getphraseset/SyncGetPhraseSetString.java | 42 + .../getrecognizer/AsyncGetRecognizer.java | 49 + .../getrecognizer/SyncGetRecognizer.java | 46 + .../SyncGetRecognizerRecognizername.java | 42 + .../SyncGetRecognizerString.java | 42 + .../AsyncListCustomClasses.java | 55 + .../AsyncListCustomClassesPaged.java | 62 + .../SyncListCustomClasses.java | 51 + .../SyncListCustomClassesLocationname.java | 44 + .../SyncListCustomClassesString.java | 44 + .../listphrasesets/AsyncListPhraseSets.java | 54 + .../AsyncListPhraseSetsPaged.java | 62 + .../listphrasesets/SyncListPhraseSets.java | 51 + .../SyncListPhraseSetsLocationname.java | 44 + .../SyncListPhraseSetsString.java | 44 + .../listrecognizers/AsyncListRecognizers.java | 55 + .../AsyncListRecognizersPaged.java | 62 + .../listrecognizers/SyncListRecognizers.java | 51 + .../SyncListRecognizersLocationname.java | 44 + .../SyncListRecognizersString.java | 44 + .../recognize/AsyncRecognize.java | 54 + .../speechclient/recognize/SyncRecognize.java | 51 + ...eRecognitionconfigFieldmaskBytestring.java | 49 + ...rnameRecognitionconfigFieldmaskString.java | 48 + ...gRecognitionconfigFieldmaskBytestring.java | 48 + ...tringRecognitionconfigFieldmaskString.java | 47 + .../AsyncStreamingRecognize.java | 53 + .../AsyncUndeleteCustomClass.java | 51 + .../AsyncUndeleteCustomClassLRO.java | 53 + .../SyncUndeleteCustomClass.java | 48 + ...yncUndeleteCustomClassCustomclassname.java | 42 + .../SyncUndeleteCustomClassString.java | 42 + .../AsyncUndeletePhraseSet.java | 51 + .../AsyncUndeletePhraseSetLRO.java | 53 + .../SyncUndeletePhraseSet.java | 48 + .../SyncUndeletePhraseSetPhrasesetname.java | 42 + .../SyncUndeletePhraseSetString.java | 42 + .../AsyncUndeleteRecognizer.java | 51 + .../AsyncUndeleteRecognizerLRO.java | 53 + .../SyncUndeleteRecognizer.java | 48 + .../SyncUndeleteRecognizerRecognizername.java | 42 + .../SyncUndeleteRecognizerString.java | 42 + .../updateconfig/AsyncUpdateConfig.java | 50 + .../updateconfig/SyncUpdateConfig.java | 47 + .../SyncUpdateConfigConfigFieldmask.java | 43 + .../AsyncUpdateCustomClass.java | 52 + .../AsyncUpdateCustomClassLRO.java | 53 + .../SyncUpdateCustomClass.java | 48 + ...UpdateCustomClassCustomclassFieldmask.java | 43 + .../updatephraseset/AsyncUpdatePhraseSet.java | 52 + .../AsyncUpdatePhraseSetLRO.java | 53 + .../updatephraseset/SyncUpdatePhraseSet.java | 48 + ...SyncUpdatePhraseSetPhrasesetFieldmask.java | 43 + .../AsyncUpdateRecognizer.java | 52 + .../AsyncUpdateRecognizerLRO.java | 53 + .../SyncUpdateRecognizer.java | 48 + ...ncUpdateRecognizerRecognizerFieldmask.java | 43 + .../getrecognizer/SyncGetRecognizer.java | 45 + .../getrecognizer/SyncGetRecognizer.java | 45 + java-speech/versions.txt | 2 + 241 files changed, 114846 insertions(+), 5 deletions(-) create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechClient.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechSettings.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/gapic_metadata.json create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/package-info.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechCallableFactory.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechStub.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechCallableFactory.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechStub.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStub.java create mode 100644 java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStubSettings.java create mode 100644 java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeech.java create mode 100644 java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeechImpl.java create mode 100644 java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientHttpJsonTest.java create mode 100644 java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientTest.java create mode 100644 java-speech/grpc-google-cloud-speech-v2/pom.xml create mode 100644 java-speech/grpc-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechGrpc.java create mode 100644 java-speech/proto-google-cloud-speech-v2/clirr-ignored-differences.xml create mode 100644 java-speech/proto-google-cloud-speech-v2/pom.xml create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfig.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfigOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadata.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadataOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResult.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResultOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadata.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadataOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponse.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponseOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadata.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadataOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CloudSpeechProto.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/Config.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigName.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClass.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassName.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfig.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfigOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponse.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponseOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponse.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponseOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponse.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponseOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/LocationName.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadata.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadataOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSet.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetName.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfig.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfigOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeatures.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeaturesOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadata.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadataOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponse.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponseOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/Recognizer.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerName.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfig.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfigOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptation.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptationOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternative.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternativeOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResult.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResultOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfig.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfigOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeatures.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeaturesOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResult.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResultOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponse.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponseOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequest.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequestOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfo.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfoOrBuilder.java create mode 100644 java-speech/proto-google-cloud-speech-v2/src/main/proto/google/cloud/speech/v2/cloud_speech.proto create mode 100644 java-speech/renovate.json create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognize.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognizeLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognize.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeRecognizernameRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeStringRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetEndpoint.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClassLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassLocationnameCustomclassString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassStringCustomclassString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSetLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetLocationnamePhrasesetString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetStringPhrasesetString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizerLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerLocationnameRecognizerString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerStringRecognizerString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClassLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassCustomclassname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSetLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetPhrasesetname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizerLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerRecognizername.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/AsyncGetConfig.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfig.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigConfigname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/AsyncGetCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassCustomclassname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/AsyncGetPhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetPhrasesetname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/AsyncGetRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerRecognizername.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClasses.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClassesPaged.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClasses.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesLocationname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSets.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSetsPaged.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSets.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsLocationname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizers.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizersPaged.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizers.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersLocationname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/AsyncRecognize.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognize.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskBytestring.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskBytestring.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/streamingrecognize/AsyncStreamingRecognize.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClassLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassCustomclassname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSetLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetPhrasesetname.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizerLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerRecognizername.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerString.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/AsyncUpdateConfig.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfig.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfigConfigFieldmask.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClassLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClass.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClassCustomclassFieldmask.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSetLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSet.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSetPhrasesetFieldmask.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizerLRO.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizerRecognizerFieldmask.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechsettings/getrecognizer/SyncGetRecognizer.java create mode 100644 java-speech/samples/snippets/generated/com/google/cloud/speech/v2/stub/speechstubsettings/getrecognizer/SyncGetRecognizer.java diff --git a/java-speech/README.md b/java-speech/README.md index 89904a41464d..dc63e641eacc 100644 --- a/java-speech/README.md +++ b/java-speech/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.1.1 + 26.1.0 pom import @@ -47,7 +47,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-speech - 2.5.5 + 2.5.4 ``` @@ -55,20 +55,20 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.1.1') +implementation platform('com.google.cloud:libraries-bom:26.1.2') implementation 'com.google.cloud:google-cloud-speech' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-speech:2.5.6' +implementation 'com.google.cloud:google-cloud-speech:2.5.7' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-speech" % "2.5.6" +libraryDependencies += "com.google.cloud" % "google-cloud-speech" % "2.5.7" ``` ## Authentication diff --git a/java-speech/google-cloud-speech-bom/pom.xml b/java-speech/google-cloud-speech-bom/pom.xml index 4feba515c738..f901316535dd 100644 --- a/java-speech/google-cloud-speech-bom/pom.xml +++ b/java-speech/google-cloud-speech-bom/pom.xml @@ -71,6 +71,11 @@ grpc-google-cloud-speech-v1p1beta1 0.89.5-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-speech-v2 + 2.5.5-SNAPSHOT + com.google.api.grpc proto-google-cloud-speech-v1 @@ -86,6 +91,11 @@ proto-google-cloud-speech-v1p1beta1 0.89.5-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-speech-v2 + 2.5.5-SNAPSHOT + diff --git a/java-speech/google-cloud-speech/pom.xml b/java-speech/google-cloud-speech/pom.xml index 030ddf4b540b..a8eb76f090ad 100644 --- a/java-speech/google-cloud-speech/pom.xml +++ b/java-speech/google-cloud-speech/pom.xml @@ -23,6 +23,10 @@ com.google.api.grpc proto-google-cloud-speech-v1p1beta1 + + com.google.api.grpc + proto-google-cloud-speech-v2 + com.google.api.grpc proto-google-cloud-speech-v1beta1 @@ -87,6 +91,11 @@ grpc-google-cloud-speech-v1p1beta1 test + + com.google.api.grpc + grpc-google-cloud-speech-v2 + test + com.google.api.grpc grpc-google-cloud-speech-v1beta1 diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechClient.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechClient.java new file mode 100644 index 000000000000..702576de9906 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechClient.java @@ -0,0 +1,3858 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.speech.v2.stub.SpeechStub; +import com.google.cloud.speech.v2.stub.SpeechStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.longrunning.Operation; +import com.google.protobuf.ByteString; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Enables speech transcription and resource management. + * + *

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

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (SpeechClient speechClient = SpeechClient.create()) {
+ *   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+ *   Recognizer response = speechClient.getRecognizer(name);
+ * }
+ * }
+ * + *

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

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

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

See the individual methods for example code. + * + *

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

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

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SpeechSettings speechSettings =
+ *     SpeechSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * SpeechClient speechClient = SpeechClient.create(speechSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SpeechSettings speechSettings = SpeechSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * SpeechClient speechClient = SpeechClient.create(speechSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SpeechSettings speechSettings =
+ *     SpeechSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             SpeechSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * SpeechClient speechClient = SpeechClient.create(speechSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class SpeechClient implements BackgroundResource { + private final SpeechSettings settings; + private final SpeechStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of SpeechClient with default settings. */ + public static final SpeechClient create() throws IOException { + return create(SpeechSettings.newBuilder().build()); + } + + /** + * Constructs an instance of SpeechClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final SpeechClient create(SpeechSettings settings) throws IOException { + return new SpeechClient(settings); + } + + /** + * Constructs an instance of SpeechClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(SpeechSettings). + */ + public static final SpeechClient create(SpeechStub stub) { + return new SpeechClient(stub); + } + + /** + * Constructs an instance of SpeechClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected SpeechClient(SpeechSettings settings) throws IOException { + this.settings = settings; + this.stub = ((SpeechStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected SpeechClient(SpeechStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final SpeechSettings getSettings() { + return settings; + } + + public SpeechStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Recognizer recognizer = Recognizer.newBuilder().build();
+   *   String recognizerId = "recognizerId771963359";
+   *   Recognizer response =
+   *       speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
+   * }
+   * }
+ * + * @param parent Required. The project and location where this Recognizer will be created. The + * expected format is `projects/{project}/locations/{location}`. + * @param recognizer Required. The Recognizer to create. + * @param recognizerId The ID to use for the Recognizer, which will become the final component of + * the Recognizer's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createRecognizerAsync( + LocationName parent, Recognizer recognizer, String recognizerId) { + CreateRecognizerRequest request = + CreateRecognizerRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setRecognizer(recognizer) + .setRecognizerId(recognizerId) + .build(); + return createRecognizerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Recognizer recognizer = Recognizer.newBuilder().build();
+   *   String recognizerId = "recognizerId771963359";
+   *   Recognizer response =
+   *       speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
+   * }
+   * }
+ * + * @param parent Required. The project and location where this Recognizer will be created. The + * expected format is `projects/{project}/locations/{location}`. + * @param recognizer Required. The Recognizer to create. + * @param recognizerId The ID to use for the Recognizer, which will become the final component of + * the Recognizer's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createRecognizerAsync( + String parent, Recognizer recognizer, String recognizerId) { + CreateRecognizerRequest request = + CreateRecognizerRequest.newBuilder() + .setParent(parent) + .setRecognizer(recognizer) + .setRecognizerId(recognizerId) + .build(); + return createRecognizerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreateRecognizerRequest request =
+   *       CreateRecognizerRequest.newBuilder()
+   *           .setRecognizer(Recognizer.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setRecognizerId("recognizerId771963359")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   Recognizer response = speechClient.createRecognizerAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createRecognizerAsync( + CreateRecognizerRequest request) { + return createRecognizerOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreateRecognizerRequest request =
+   *       CreateRecognizerRequest.newBuilder()
+   *           .setRecognizer(Recognizer.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setRecognizerId("recognizerId771963359")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.createRecognizerOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Recognizer response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + createRecognizerOperationCallable() { + return stub.createRecognizerOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreateRecognizerRequest request =
+   *       CreateRecognizerRequest.newBuilder()
+   *           .setRecognizer(Recognizer.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setRecognizerId("recognizerId771963359")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   ApiFuture future = speechClient.createRecognizerCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createRecognizerCallable() { + return stub.createRecognizerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Recognizers. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The project and location of Recognizers to list. The expected format is + * `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListRecognizersPagedResponse listRecognizers(LocationName parent) { + ListRecognizersRequest request = + ListRecognizersRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listRecognizers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Recognizers. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The project and location of Recognizers to list. The expected format is + * `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListRecognizersPagedResponse listRecognizers(String parent) { + ListRecognizersRequest request = ListRecognizersRequest.newBuilder().setParent(parent).build(); + return listRecognizers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Recognizers. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListRecognizersRequest request =
+   *       ListRecognizersRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   for (Recognizer element : speechClient.listRecognizers(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListRecognizersPagedResponse listRecognizers(ListRecognizersRequest request) { + return listRecognizersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Recognizers. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListRecognizersRequest request =
+   *       ListRecognizersRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   ApiFuture future =
+   *       speechClient.listRecognizersPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Recognizer element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listRecognizersPagedCallable() { + return stub.listRecognizersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Recognizers. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListRecognizersRequest request =
+   *       ListRecognizersRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   while (true) {
+   *     ListRecognizersResponse response = speechClient.listRecognizersCallable().call(request);
+   *     for (Recognizer element : response.getRecognizersList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listRecognizersCallable() { + return stub.listRecognizersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with + * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+   *   Recognizer response = speechClient.getRecognizer(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Recognizer to retrieve. The expected format is + * `projects/{project}/locations/{location}/recognizers/{recognizer}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Recognizer getRecognizer(RecognizerName name) { + GetRecognizerRequest request = + GetRecognizerRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getRecognizer(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with + * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
+   *   Recognizer response = speechClient.getRecognizer(name);
+   * }
+   * }
+ * + * @param name Required. The name of the Recognizer to retrieve. The expected format is + * `projects/{project}/locations/{location}/recognizers/{recognizer}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Recognizer getRecognizer(String name) { + GetRecognizerRequest request = GetRecognizerRequest.newBuilder().setName(name).build(); + return getRecognizer(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with + * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetRecognizerRequest request =
+   *       GetRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .build();
+   *   Recognizer response = speechClient.getRecognizer(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Recognizer getRecognizer(GetRecognizerRequest request) { + return getRecognizerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with + * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't exist. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetRecognizerRequest request =
+   *       GetRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .build();
+   *   ApiFuture future = speechClient.getRecognizerCallable().futureCall(request);
+   *   // Do something.
+   *   Recognizer response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getRecognizerCallable() { + return stub.getRecognizerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   Recognizer recognizer = Recognizer.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Recognizer response = speechClient.updateRecognizerAsync(recognizer, updateMask).get();
+   * }
+   * }
+ * + * @param recognizer Required. The Recognizer to update. + *

The Recognizer's `name` field is used to identify the Recognizer to update. Format: + * `projects/{project}/locations/{location}/recognizers/{recognizer}`. + * @param updateMask The list of fields to update. If empty, all non-default valued fields are + * considered for update. Use `*` to update the entire Recognizer resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateRecognizerAsync( + Recognizer recognizer, FieldMask updateMask) { + UpdateRecognizerRequest request = + UpdateRecognizerRequest.newBuilder() + .setRecognizer(recognizer) + .setUpdateMask(updateMask) + .build(); + return updateRecognizerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateRecognizerRequest request =
+   *       UpdateRecognizerRequest.newBuilder()
+   *           .setRecognizer(Recognizer.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   Recognizer response = speechClient.updateRecognizerAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateRecognizerAsync( + UpdateRecognizerRequest request) { + return updateRecognizerOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateRecognizerRequest request =
+   *       UpdateRecognizerRequest.newBuilder()
+   *           .setRecognizer(Recognizer.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.updateRecognizerOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Recognizer response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + updateRecognizerOperationCallable() { + return stub.updateRecognizerOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateRecognizerRequest request =
+   *       UpdateRecognizerRequest.newBuilder()
+   *           .setRecognizer(Recognizer.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   ApiFuture future = speechClient.updateRecognizerCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateRecognizerCallable() { + return stub.updateRecognizerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+   *   Recognizer response = speechClient.deleteRecognizerAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Recognizer to delete. Format: + * `projects/{project}/locations/{location}/recognizers/{recognizer}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteRecognizerAsync( + RecognizerName name) { + DeleteRecognizerRequest request = + DeleteRecognizerRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteRecognizerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
+   *   Recognizer response = speechClient.deleteRecognizerAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Recognizer to delete. Format: + * `projects/{project}/locations/{location}/recognizers/{recognizer}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteRecognizerAsync(String name) { + DeleteRecognizerRequest request = DeleteRecognizerRequest.newBuilder().setName(name).build(); + return deleteRecognizerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeleteRecognizerRequest request =
+   *       DeleteRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   Recognizer response = speechClient.deleteRecognizerAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteRecognizerAsync( + DeleteRecognizerRequest request) { + return deleteRecognizerOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeleteRecognizerRequest request =
+   *       DeleteRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.deleteRecognizerOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Recognizer response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deleteRecognizerOperationCallable() { + return stub.deleteRecognizerOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeleteRecognizerRequest request =
+   *       DeleteRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = speechClient.deleteRecognizerCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteRecognizerCallable() { + return stub.deleteRecognizerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+   *   Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Recognizer to undelete. Format: + * `projects/{project}/locations/{location}/recognizers/{recognizer}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeleteRecognizerAsync( + RecognizerName name) { + UndeleteRecognizerRequest request = + UndeleteRecognizerRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return undeleteRecognizerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
+   *   Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Recognizer to undelete. Format: + * `projects/{project}/locations/{location}/recognizers/{recognizer}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeleteRecognizerAsync(String name) { + UndeleteRecognizerRequest request = + UndeleteRecognizerRequest.newBuilder().setName(name).build(); + return undeleteRecognizerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeleteRecognizerRequest request =
+   *       UndeleteRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   Recognizer response = speechClient.undeleteRecognizerAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeleteRecognizerAsync( + UndeleteRecognizerRequest request) { + return undeleteRecognizerOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeleteRecognizerRequest request =
+   *       UndeleteRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.undeleteRecognizerOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Recognizer response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + undeleteRecognizerOperationCallable() { + return stub.undeleteRecognizerOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeleteRecognizerRequest request =
+   *       UndeleteRecognizerRequest.newBuilder()
+   *           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = speechClient.undeleteRecognizerCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable undeleteRecognizerCallable() { + return stub.undeleteRecognizerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs synchronous Speech recognition: receive results after all audio has been sent and + * processed. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+   *   RecognitionConfig config = RecognitionConfig.newBuilder().build();
+   *   FieldMask configMask = FieldMask.newBuilder().build();
+   *   ByteString content = ByteString.EMPTY;
+   *   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
+   * }
+   * }
+ * + * @param recognizer Required. The name of the Recognizer to use during recognition. The expected + * format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. + * @param config Features and audio metadata to use for the Automatic Speech Recognition. This + * field in combination with the + * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to + * override parts of the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the Recognizer resource. + * @param configMask The list of fields in + * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the recognizer during this recognition request. If no mask is provided, all non-default + * valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the + * values in the recognizer for this recognition request. If a mask is provided, only the + * fields listed in the mask override the config in the recognizer for this recognition + * request. If a wildcard (`*`) is provided, + * [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces + * the config in the recognizer for this recognition request. + * @param content The audio data bytes encoded as specified in + * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields, + * proto buffers use a pure binary representation, whereas JSON representations use base64. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RecognizeResponse recognize( + RecognizerName recognizer, + RecognitionConfig config, + FieldMask configMask, + ByteString content) { + RecognizeRequest request = + RecognizeRequest.newBuilder() + .setRecognizer(recognizer == null ? null : recognizer.toString()) + .setConfig(config) + .setConfigMask(configMask) + .setContent(content) + .build(); + return recognize(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs synchronous Speech recognition: receive results after all audio has been sent and + * processed. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+   *   RecognitionConfig config = RecognitionConfig.newBuilder().build();
+   *   FieldMask configMask = FieldMask.newBuilder().build();
+   *   String uri = "uri116076";
+   *   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
+   * }
+   * }
+ * + * @param recognizer Required. The name of the Recognizer to use during recognition. The expected + * format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. + * @param config Features and audio metadata to use for the Automatic Speech Recognition. This + * field in combination with the + * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to + * override parts of the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the Recognizer resource. + * @param configMask The list of fields in + * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the recognizer during this recognition request. If no mask is provided, all non-default + * valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the + * values in the recognizer for this recognition request. If a mask is provided, only the + * fields listed in the mask override the config in the recognizer for this recognition + * request. If a wildcard (`*`) is provided, + * [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces + * the config in the recognizer for this recognition request. + * @param uri URI that points to a file that contains audio data bytes as specified in + * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file must not be + * compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, + * which must be specified in the following format: `gs://bucket_name/object_name` (other URI + * formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, + * see [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RecognizeResponse recognize( + RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, String uri) { + RecognizeRequest request = + RecognizeRequest.newBuilder() + .setRecognizer(recognizer == null ? null : recognizer.toString()) + .setConfig(config) + .setConfigMask(configMask) + .setUri(uri) + .build(); + return recognize(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs synchronous Speech recognition: receive results after all audio has been sent and + * processed. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
+   *   RecognitionConfig config = RecognitionConfig.newBuilder().build();
+   *   FieldMask configMask = FieldMask.newBuilder().build();
+   *   ByteString content = ByteString.EMPTY;
+   *   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
+   * }
+   * }
+ * + * @param recognizer Required. The name of the Recognizer to use during recognition. The expected + * format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. + * @param config Features and audio metadata to use for the Automatic Speech Recognition. This + * field in combination with the + * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to + * override parts of the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the Recognizer resource. + * @param configMask The list of fields in + * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the recognizer during this recognition request. If no mask is provided, all non-default + * valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the + * values in the recognizer for this recognition request. If a mask is provided, only the + * fields listed in the mask override the config in the recognizer for this recognition + * request. If a wildcard (`*`) is provided, + * [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces + * the config in the recognizer for this recognition request. + * @param content The audio data bytes encoded as specified in + * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields, + * proto buffers use a pure binary representation, whereas JSON representations use base64. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RecognizeResponse recognize( + String recognizer, RecognitionConfig config, FieldMask configMask, ByteString content) { + RecognizeRequest request = + RecognizeRequest.newBuilder() + .setRecognizer(recognizer) + .setConfig(config) + .setConfigMask(configMask) + .setContent(content) + .build(); + return recognize(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs synchronous Speech recognition: receive results after all audio has been sent and + * processed. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
+   *   RecognitionConfig config = RecognitionConfig.newBuilder().build();
+   *   FieldMask configMask = FieldMask.newBuilder().build();
+   *   String uri = "uri116076";
+   *   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
+   * }
+   * }
+ * + * @param recognizer Required. The name of the Recognizer to use during recognition. The expected + * format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. + * @param config Features and audio metadata to use for the Automatic Speech Recognition. This + * field in combination with the + * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to + * override parts of the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the Recognizer resource. + * @param configMask The list of fields in + * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the recognizer during this recognition request. If no mask is provided, all non-default + * valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the + * values in the recognizer for this recognition request. If a mask is provided, only the + * fields listed in the mask override the config in the recognizer for this recognition + * request. If a wildcard (`*`) is provided, + * [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces + * the config in the recognizer for this recognition request. + * @param uri URI that points to a file that contains audio data bytes as specified in + * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file must not be + * compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, + * which must be specified in the following format: `gs://bucket_name/object_name` (other URI + * formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, + * see [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RecognizeResponse recognize( + String recognizer, RecognitionConfig config, FieldMask configMask, String uri) { + RecognizeRequest request = + RecognizeRequest.newBuilder() + .setRecognizer(recognizer) + .setConfig(config) + .setConfigMask(configMask) + .setUri(uri) + .build(); + return recognize(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs synchronous Speech recognition: receive results after all audio has been sent and + * processed. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizeRequest request =
+   *       RecognizeRequest.newBuilder()
+   *           .setRecognizer(
+   *               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setConfig(RecognitionConfig.newBuilder().build())
+   *           .setConfigMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   RecognizeResponse response = speechClient.recognize(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RecognizeResponse recognize(RecognizeRequest request) { + return recognizeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs synchronous Speech recognition: receive results after all audio has been sent and + * processed. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizeRequest request =
+   *       RecognizeRequest.newBuilder()
+   *           .setRecognizer(
+   *               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setConfig(RecognitionConfig.newBuilder().build())
+   *           .setConfigMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = speechClient.recognizeCallable().futureCall(request);
+   *   // Do something.
+   *   RecognizeResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable recognizeCallable() { + return stub.recognizeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs bidirectional streaming speech recognition: receive results while sending audio. This + * method is only available via the gRPC API (not REST). + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   BidiStream bidiStream =
+   *       speechClient.streamingRecognizeCallable().call();
+   *   StreamingRecognizeRequest request =
+   *       StreamingRecognizeRequest.newBuilder()
+   *           .setRecognizer(
+   *               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .build();
+   *   bidiStream.send(request);
+   *   for (StreamingRecognizeResponse response : bidiStream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final BidiStreamingCallable + streamingRecognizeCallable() { + return stub.streamingRecognizeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs batch asynchronous speech recognition: send a request with N audio files and receive a + * long running operation that can be polled to see when the transcriptions are finished. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+   *   RecognitionConfig config = RecognitionConfig.newBuilder().build();
+   *   FieldMask configMask = FieldMask.newBuilder().build();
+   *   List files = new ArrayList<>();
+   *   BatchRecognizeResponse response =
+   *       speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
+   * }
+   * }
+ * + * @param recognizer Required. Resource name of the recognizer to be used for ASR. + * @param config Features and audio metadata to use for the Automatic Speech Recognition. This + * field in combination with the + * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used + * to override parts of the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the Recognizer resource. + * @param configMask The list of fields in + * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in + * the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the recognizer during this recognition request. If no mask is provided, all given fields + * in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the values in the + * recognizer for this recognition request. If a mask is provided, only the fields listed in + * the mask override the config in the recognizer for this recognition request. If a wildcard + * (`*`) is provided, [config][google.cloud.speech.v2.BatchRecognizeRequest.config] + * completely overrides and replaces the config in the recognizer for this recognition + * request. + * @param files Audio files with file metadata for ASR. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture batchRecognizeAsync( + RecognizerName recognizer, + RecognitionConfig config, + FieldMask configMask, + List files) { + BatchRecognizeRequest request = + BatchRecognizeRequest.newBuilder() + .setRecognizer(recognizer == null ? null : recognizer.toString()) + .setConfig(config) + .setConfigMask(configMask) + .addAllFiles(files) + .build(); + return batchRecognizeAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs batch asynchronous speech recognition: send a request with N audio files and receive a + * long running operation that can be polled to see when the transcriptions are finished. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
+   *   RecognitionConfig config = RecognitionConfig.newBuilder().build();
+   *   FieldMask configMask = FieldMask.newBuilder().build();
+   *   List files = new ArrayList<>();
+   *   BatchRecognizeResponse response =
+   *       speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
+   * }
+   * }
+ * + * @param recognizer Required. Resource name of the recognizer to be used for ASR. + * @param config Features and audio metadata to use for the Automatic Speech Recognition. This + * field in combination with the + * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used + * to override parts of the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the Recognizer resource. + * @param configMask The list of fields in + * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in + * the + * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + * of the recognizer during this recognition request. If no mask is provided, all given fields + * in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the values in the + * recognizer for this recognition request. If a mask is provided, only the fields listed in + * the mask override the config in the recognizer for this recognition request. If a wildcard + * (`*`) is provided, [config][google.cloud.speech.v2.BatchRecognizeRequest.config] + * completely overrides and replaces the config in the recognizer for this recognition + * request. + * @param files Audio files with file metadata for ASR. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture batchRecognizeAsync( + String recognizer, + RecognitionConfig config, + FieldMask configMask, + List files) { + BatchRecognizeRequest request = + BatchRecognizeRequest.newBuilder() + .setRecognizer(recognizer) + .setConfig(config) + .setConfigMask(configMask) + .addAllFiles(files) + .build(); + return batchRecognizeAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs batch asynchronous speech recognition: send a request with N audio files and receive a + * long running operation that can be polled to see when the transcriptions are finished. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   BatchRecognizeRequest request =
+   *       BatchRecognizeRequest.newBuilder()
+   *           .setRecognizer(
+   *               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setConfig(RecognitionConfig.newBuilder().build())
+   *           .setConfigMask(FieldMask.newBuilder().build())
+   *           .addAllFiles(new ArrayList())
+   *           .build();
+   *   BatchRecognizeResponse response = speechClient.batchRecognizeAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture batchRecognizeAsync( + BatchRecognizeRequest request) { + return batchRecognizeOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs batch asynchronous speech recognition: send a request with N audio files and receive a + * long running operation that can be polled to see when the transcriptions are finished. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   BatchRecognizeRequest request =
+   *       BatchRecognizeRequest.newBuilder()
+   *           .setRecognizer(
+   *               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setConfig(RecognitionConfig.newBuilder().build())
+   *           .setConfigMask(FieldMask.newBuilder().build())
+   *           .addAllFiles(new ArrayList())
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.batchRecognizeOperationCallable().futureCall(request);
+   *   // Do something.
+   *   BatchRecognizeResponse response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + batchRecognizeOperationCallable() { + return stub.batchRecognizeOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Performs batch asynchronous speech recognition: send a request with N audio files and receive a + * long running operation that can be polled to see when the transcriptions are finished. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   BatchRecognizeRequest request =
+   *       BatchRecognizeRequest.newBuilder()
+   *           .setRecognizer(
+   *               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
+   *           .setConfig(RecognitionConfig.newBuilder().build())
+   *           .setConfigMask(FieldMask.newBuilder().build())
+   *           .addAllFiles(new ArrayList())
+   *           .build();
+   *   ApiFuture future = speechClient.batchRecognizeCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable batchRecognizeCallable() { + return stub.batchRecognizeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Config][google.cloud.speech.v2.Config]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]");
+   *   Config response = speechClient.getConfig(name);
+   * }
+   * }
+ * + * @param name Required. The name of the config to retrieve. There is exactly one config resource + * per project per location. The expected format is + * `projects/{project}/locations/{location}/config`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Config getConfig(ConfigName name) { + GetConfigRequest request = + GetConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Config][google.cloud.speech.v2.Config]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = ConfigName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Config response = speechClient.getConfig(name);
+   * }
+   * }
+ * + * @param name Required. The name of the config to retrieve. There is exactly one config resource + * per project per location. The expected format is + * `projects/{project}/locations/{location}/config`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Config getConfig(String name) { + GetConfigRequest request = GetConfigRequest.newBuilder().setName(name).build(); + return getConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Config][google.cloud.speech.v2.Config]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetConfigRequest request =
+   *       GetConfigRequest.newBuilder()
+   *           .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   Config response = speechClient.getConfig(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Config getConfig(GetConfigRequest request) { + return getConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [Config][google.cloud.speech.v2.Config]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetConfigRequest request =
+   *       GetConfigRequest.newBuilder()
+   *           .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   ApiFuture future = speechClient.getConfigCallable().futureCall(request);
+   *   // Do something.
+   *   Config response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getConfigCallable() { + return stub.getConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Config][google.cloud.speech.v2.Config]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   Config config = Config.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Config response = speechClient.updateConfig(config, updateMask);
+   * }
+   * }
+ * + * @param config Required. The config to update. + *

The config's `name` field is used to identify the config to be updated. The expected + * format is `projects/{project}/locations/{location}/config`. + * @param updateMask The list of fields to be updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Config updateConfig(Config config, FieldMask updateMask) { + UpdateConfigRequest request = + UpdateConfigRequest.newBuilder().setConfig(config).setUpdateMask(updateMask).build(); + return updateConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Config][google.cloud.speech.v2.Config]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateConfigRequest request =
+   *       UpdateConfigRequest.newBuilder()
+   *           .setConfig(Config.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Config response = speechClient.updateConfig(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Config updateConfig(UpdateConfigRequest request) { + return updateConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [Config][google.cloud.speech.v2.Config]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateConfigRequest request =
+   *       UpdateConfigRequest.newBuilder()
+   *           .setConfig(Config.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = speechClient.updateConfigCallable().futureCall(request);
+   *   // Do something.
+   *   Config response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateConfigCallable() { + return stub.updateConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   CustomClass customClass = CustomClass.newBuilder().build();
+   *   String customClassId = "customClassId1871032322";
+   *   CustomClass response =
+   *       speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
+   * }
+   * }
+ * + * @param parent Required. The project and location where this CustomClass will be created. The + * expected format is `projects/{project}/locations/{location}`. + * @param customClass Required. The CustomClass to create. + * @param customClassId The ID to use for the CustomClass, which will become the final component + * of the CustomClass's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createCustomClassAsync( + LocationName parent, CustomClass customClass, String customClassId) { + CreateCustomClassRequest request = + CreateCustomClassRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setCustomClass(customClass) + .setCustomClassId(customClassId) + .build(); + return createCustomClassAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   CustomClass customClass = CustomClass.newBuilder().build();
+   *   String customClassId = "customClassId1871032322";
+   *   CustomClass response =
+   *       speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
+   * }
+   * }
+ * + * @param parent Required. The project and location where this CustomClass will be created. The + * expected format is `projects/{project}/locations/{location}`. + * @param customClass Required. The CustomClass to create. + * @param customClassId The ID to use for the CustomClass, which will become the final component + * of the CustomClass's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createCustomClassAsync( + String parent, CustomClass customClass, String customClassId) { + CreateCustomClassRequest request = + CreateCustomClassRequest.newBuilder() + .setParent(parent) + .setCustomClass(customClass) + .setCustomClassId(customClassId) + .build(); + return createCustomClassAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreateCustomClassRequest request =
+   *       CreateCustomClassRequest.newBuilder()
+   *           .setCustomClass(CustomClass.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setCustomClassId("customClassId1871032322")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   CustomClass response = speechClient.createCustomClassAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createCustomClassAsync( + CreateCustomClassRequest request) { + return createCustomClassOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreateCustomClassRequest request =
+   *       CreateCustomClassRequest.newBuilder()
+   *           .setCustomClass(CustomClass.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setCustomClassId("customClassId1871032322")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.createCustomClassOperationCallable().futureCall(request);
+   *   // Do something.
+   *   CustomClass response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + createCustomClassOperationCallable() { + return stub.createCustomClassOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreateCustomClassRequest request =
+   *       CreateCustomClassRequest.newBuilder()
+   *           .setCustomClass(CustomClass.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setCustomClassId("customClassId1871032322")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   ApiFuture future = speechClient.createCustomClassCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createCustomClassCallable() { + return stub.createCustomClassCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists CustomClasses. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The project and location of CustomClass resources to list. The expected + * format is `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCustomClassesPagedResponse listCustomClasses(LocationName parent) { + ListCustomClassesRequest request = + ListCustomClassesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listCustomClasses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists CustomClasses. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The project and location of CustomClass resources to list. The expected + * format is `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCustomClassesPagedResponse listCustomClasses(String parent) { + ListCustomClassesRequest request = + ListCustomClassesRequest.newBuilder().setParent(parent).build(); + return listCustomClasses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists CustomClasses. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListCustomClassesRequest request =
+   *       ListCustomClassesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   for (CustomClass element : speechClient.listCustomClasses(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesRequest request) { + return listCustomClassesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists CustomClasses. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListCustomClassesRequest request =
+   *       ListCustomClassesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   ApiFuture future =
+   *       speechClient.listCustomClassesPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (CustomClass element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listCustomClassesPagedCallable() { + return stub.listCustomClassesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists CustomClasses. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListCustomClassesRequest request =
+   *       ListCustomClassesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   while (true) {
+   *     ListCustomClassesResponse response = speechClient.listCustomClassesCallable().call(request);
+   *     for (CustomClass element : response.getCustomClassesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listCustomClassesCallable() { + return stub.listCustomClassesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
+   *   CustomClass response = speechClient.getCustomClass(name);
+   * }
+   * }
+ * + * @param name Required. The name of the CustomClass to retrieve. The expected format is + * `projects/{project}/locations/{location}/customClasses/{custom_class}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CustomClass getCustomClass(CustomClassName name) { + GetCustomClassRequest request = + GetCustomClassRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
+   *   CustomClass response = speechClient.getCustomClass(name);
+   * }
+   * }
+ * + * @param name Required. The name of the CustomClass to retrieve. The expected format is + * `projects/{project}/locations/{location}/customClasses/{custom_class}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CustomClass getCustomClass(String name) { + GetCustomClassRequest request = GetCustomClassRequest.newBuilder().setName(name).build(); + return getCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetCustomClassRequest request =
+   *       GetCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .build();
+   *   CustomClass response = speechClient.getCustomClass(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CustomClass getCustomClass(GetCustomClassRequest request) { + return getCustomClassCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetCustomClassRequest request =
+   *       GetCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .build();
+   *   ApiFuture future = speechClient.getCustomClassCallable().futureCall(request);
+   *   // Do something.
+   *   CustomClass response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getCustomClassCallable() { + return stub.getCustomClassCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CustomClass customClass = CustomClass.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   CustomClass response = speechClient.updateCustomClassAsync(customClass, updateMask).get();
+   * }
+   * }
+ * + * @param customClass Required. The CustomClass to update. + *

The CustomClass's `name` field is used to identify the CustomClass to update. Format: + * `projects/{project}/locations/{location}/customClasses/{custom_class}`. + * @param updateMask The list of fields to be updated. If empty, all fields are considered for + * update. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateCustomClassAsync( + CustomClass customClass, FieldMask updateMask) { + UpdateCustomClassRequest request = + UpdateCustomClassRequest.newBuilder() + .setCustomClass(customClass) + .setUpdateMask(updateMask) + .build(); + return updateCustomClassAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateCustomClassRequest request =
+   *       UpdateCustomClassRequest.newBuilder()
+   *           .setCustomClass(CustomClass.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   CustomClass response = speechClient.updateCustomClassAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateCustomClassAsync( + UpdateCustomClassRequest request) { + return updateCustomClassOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateCustomClassRequest request =
+   *       UpdateCustomClassRequest.newBuilder()
+   *           .setCustomClass(CustomClass.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.updateCustomClassOperationCallable().futureCall(request);
+   *   // Do something.
+   *   CustomClass response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + updateCustomClassOperationCallable() { + return stub.updateCustomClassOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdateCustomClassRequest request =
+   *       UpdateCustomClassRequest.newBuilder()
+   *           .setCustomClass(CustomClass.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   ApiFuture future = speechClient.updateCustomClassCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateCustomClassCallable() { + return stub.updateCustomClassCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
+   *   CustomClass response = speechClient.deleteCustomClassAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the CustomClass to delete. Format: + * `projects/{project}/locations/{location}/customClasses/{custom_class}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteCustomClassAsync( + CustomClassName name) { + DeleteCustomClassRequest request = + DeleteCustomClassRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return deleteCustomClassAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
+   *   CustomClass response = speechClient.deleteCustomClassAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the CustomClass to delete. Format: + * `projects/{project}/locations/{location}/customClasses/{custom_class}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteCustomClassAsync(String name) { + DeleteCustomClassRequest request = DeleteCustomClassRequest.newBuilder().setName(name).build(); + return deleteCustomClassAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeleteCustomClassRequest request =
+   *       DeleteCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   CustomClass response = speechClient.deleteCustomClassAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteCustomClassAsync( + DeleteCustomClassRequest request) { + return deleteCustomClassOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeleteCustomClassRequest request =
+   *       DeleteCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.deleteCustomClassOperationCallable().futureCall(request);
+   *   // Do something.
+   *   CustomClass response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deleteCustomClassOperationCallable() { + return stub.deleteCustomClassOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeleteCustomClassRequest request =
+   *       DeleteCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = speechClient.deleteCustomClassCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteCustomClassCallable() { + return stub.deleteCustomClassCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
+   *   CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the CustomClass to undelete. Format: + * `projects/{project}/locations/{location}/customClasses/{custom_class}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeleteCustomClassAsync( + CustomClassName name) { + UndeleteCustomClassRequest request = + UndeleteCustomClassRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return undeleteCustomClassAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
+   *   CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the CustomClass to undelete. Format: + * `projects/{project}/locations/{location}/customClasses/{custom_class}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeleteCustomClassAsync( + String name) { + UndeleteCustomClassRequest request = + UndeleteCustomClassRequest.newBuilder().setName(name).build(); + return undeleteCustomClassAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeleteCustomClassRequest request =
+   *       UndeleteCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   CustomClass response = speechClient.undeleteCustomClassAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeleteCustomClassAsync( + UndeleteCustomClassRequest request) { + return undeleteCustomClassOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeleteCustomClassRequest request =
+   *       UndeleteCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.undeleteCustomClassOperationCallable().futureCall(request);
+   *   // Do something.
+   *   CustomClass response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + undeleteCustomClassOperationCallable() { + return stub.undeleteCustomClassOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeleteCustomClassRequest request =
+   *       UndeleteCustomClassRequest.newBuilder()
+   *           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = speechClient.undeleteCustomClassCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable undeleteCustomClassCallable() { + return stub.undeleteCustomClassCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   PhraseSet phraseSet = PhraseSet.newBuilder().build();
+   *   String phraseSetId = "phraseSetId959902180";
+   *   PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
+   * }
+   * }
+ * + * @param parent Required. The project and location where this PhraseSet will be created. The + * expected format is `projects/{project}/locations/{location}`. + * @param phraseSet Required. The PhraseSet to create. + * @param phraseSetId The ID to use for the PhraseSet, which will become the final component of + * the PhraseSet's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createPhraseSetAsync( + LocationName parent, PhraseSet phraseSet, String phraseSetId) { + CreatePhraseSetRequest request = + CreatePhraseSetRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setPhraseSet(phraseSet) + .setPhraseSetId(phraseSetId) + .build(); + return createPhraseSetAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   PhraseSet phraseSet = PhraseSet.newBuilder().build();
+   *   String phraseSetId = "phraseSetId959902180";
+   *   PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
+   * }
+   * }
+ * + * @param parent Required. The project and location where this PhraseSet will be created. The + * expected format is `projects/{project}/locations/{location}`. + * @param phraseSet Required. The PhraseSet to create. + * @param phraseSetId The ID to use for the PhraseSet, which will become the final component of + * the PhraseSet's resource name. + *

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createPhraseSetAsync( + String parent, PhraseSet phraseSet, String phraseSetId) { + CreatePhraseSetRequest request = + CreatePhraseSetRequest.newBuilder() + .setParent(parent) + .setPhraseSet(phraseSet) + .setPhraseSetId(phraseSetId) + .build(); + return createPhraseSetAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreatePhraseSetRequest request =
+   *       CreatePhraseSetRequest.newBuilder()
+   *           .setPhraseSet(PhraseSet.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setPhraseSetId("phraseSetId959902180")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   PhraseSet response = speechClient.createPhraseSetAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createPhraseSetAsync( + CreatePhraseSetRequest request) { + return createPhraseSetOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreatePhraseSetRequest request =
+   *       CreatePhraseSetRequest.newBuilder()
+   *           .setPhraseSet(PhraseSet.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setPhraseSetId("phraseSetId959902180")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.createPhraseSetOperationCallable().futureCall(request);
+   *   // Do something.
+   *   PhraseSet response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + createPhraseSetOperationCallable() { + return stub.createPhraseSetOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   CreatePhraseSetRequest request =
+   *       CreatePhraseSetRequest.newBuilder()
+   *           .setPhraseSet(PhraseSet.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setPhraseSetId("phraseSetId959902180")
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   ApiFuture future = speechClient.createPhraseSetCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createPhraseSetCallable() { + return stub.createPhraseSetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists PhraseSets. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The project and location of PhraseSet resources to list. The expected + * format is `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListPhraseSetsPagedResponse listPhraseSets(LocationName parent) { + ListPhraseSetsRequest request = + ListPhraseSetsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listPhraseSets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists PhraseSets. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The project and location of PhraseSet resources to list. The expected + * format is `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListPhraseSetsPagedResponse listPhraseSets(String parent) { + ListPhraseSetsRequest request = ListPhraseSetsRequest.newBuilder().setParent(parent).build(); + return listPhraseSets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists PhraseSets. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListPhraseSetsRequest request =
+   *       ListPhraseSetsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   for (PhraseSet element : speechClient.listPhraseSets(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListPhraseSetsPagedResponse listPhraseSets(ListPhraseSetsRequest request) { + return listPhraseSetsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists PhraseSets. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListPhraseSetsRequest request =
+   *       ListPhraseSetsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   ApiFuture future = speechClient.listPhraseSetsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (PhraseSet element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listPhraseSetsPagedCallable() { + return stub.listPhraseSetsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists PhraseSets. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   ListPhraseSetsRequest request =
+   *       ListPhraseSetsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   while (true) {
+   *     ListPhraseSetsResponse response = speechClient.listPhraseSetsCallable().call(request);
+   *     for (PhraseSet element : response.getPhraseSetsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listPhraseSetsCallable() { + return stub.listPhraseSetsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
+   *   PhraseSet response = speechClient.getPhraseSet(name);
+   * }
+   * }
+ * + * @param name Required. The name of the PhraseSet to retrieve. The expected format is + * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PhraseSet getPhraseSet(PhraseSetName name) { + GetPhraseSetRequest request = + GetPhraseSetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
+   *   PhraseSet response = speechClient.getPhraseSet(name);
+   * }
+   * }
+ * + * @param name Required. The name of the PhraseSet to retrieve. The expected format is + * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PhraseSet getPhraseSet(String name) { + GetPhraseSetRequest request = GetPhraseSetRequest.newBuilder().setName(name).build(); + return getPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetPhraseSetRequest request =
+   *       GetPhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .build();
+   *   PhraseSet response = speechClient.getPhraseSet(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PhraseSet getPhraseSet(GetPhraseSetRequest request) { + return getPhraseSetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   GetPhraseSetRequest request =
+   *       GetPhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .build();
+   *   ApiFuture future = speechClient.getPhraseSetCallable().futureCall(request);
+   *   // Do something.
+   *   PhraseSet response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getPhraseSetCallable() { + return stub.getPhraseSetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   PhraseSet phraseSet = PhraseSet.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   PhraseSet response = speechClient.updatePhraseSetAsync(phraseSet, updateMask).get();
+   * }
+   * }
+ * + * @param phraseSet Required. The PhraseSet to update. + *

The PhraseSet's `name` field is used to identify the PhraseSet to update. Format: + * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. + * @param updateMask The list of fields to update. If empty, all non-default valued fields are + * considered for update. Use `*` to update the entire PhraseSet resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updatePhraseSetAsync( + PhraseSet phraseSet, FieldMask updateMask) { + UpdatePhraseSetRequest request = + UpdatePhraseSetRequest.newBuilder() + .setPhraseSet(phraseSet) + .setUpdateMask(updateMask) + .build(); + return updatePhraseSetAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdatePhraseSetRequest request =
+   *       UpdatePhraseSetRequest.newBuilder()
+   *           .setPhraseSet(PhraseSet.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   PhraseSet response = speechClient.updatePhraseSetAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updatePhraseSetAsync( + UpdatePhraseSetRequest request) { + return updatePhraseSetOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdatePhraseSetRequest request =
+   *       UpdatePhraseSetRequest.newBuilder()
+   *           .setPhraseSet(PhraseSet.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.updatePhraseSetOperationCallable().futureCall(request);
+   *   // Do something.
+   *   PhraseSet response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + updatePhraseSetOperationCallable() { + return stub.updatePhraseSetOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UpdatePhraseSetRequest request =
+   *       UpdatePhraseSetRequest.newBuilder()
+   *           .setPhraseSet(PhraseSet.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .build();
+   *   ApiFuture future = speechClient.updatePhraseSetCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updatePhraseSetCallable() { + return stub.updatePhraseSetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
+   *   PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the PhraseSet to delete. Format: + * `projects/{project}/locations/{location}/phraseSets/{phrase_set}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deletePhraseSetAsync( + PhraseSetName name) { + DeletePhraseSetRequest request = + DeletePhraseSetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deletePhraseSetAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
+   *   PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the PhraseSet to delete. Format: + * `projects/{project}/locations/{location}/phraseSets/{phrase_set}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deletePhraseSetAsync(String name) { + DeletePhraseSetRequest request = DeletePhraseSetRequest.newBuilder().setName(name).build(); + return deletePhraseSetAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeletePhraseSetRequest request =
+   *       DeletePhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   PhraseSet response = speechClient.deletePhraseSetAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deletePhraseSetAsync( + DeletePhraseSetRequest request) { + return deletePhraseSetOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeletePhraseSetRequest request =
+   *       DeletePhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.deletePhraseSetOperationCallable().futureCall(request);
+   *   // Do something.
+   *   PhraseSet response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deletePhraseSetOperationCallable() { + return stub.deletePhraseSetOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   DeletePhraseSetRequest request =
+   *       DeletePhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = speechClient.deletePhraseSetCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deletePhraseSetCallable() { + return stub.deletePhraseSetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
+   *   PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the PhraseSet to undelete. Format: + * `projects/{project}/locations/{location}/phraseSets/{phrase_set}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeletePhraseSetAsync( + PhraseSetName name) { + UndeletePhraseSetRequest request = + UndeletePhraseSetRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return undeletePhraseSetAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
+   *   PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the PhraseSet to undelete. Format: + * `projects/{project}/locations/{location}/phraseSets/{phrase_set}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeletePhraseSetAsync(String name) { + UndeletePhraseSetRequest request = UndeletePhraseSetRequest.newBuilder().setName(name).build(); + return undeletePhraseSetAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeletePhraseSetRequest request =
+   *       UndeletePhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   PhraseSet response = speechClient.undeletePhraseSetAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture undeletePhraseSetAsync( + UndeletePhraseSetRequest request) { + return undeletePhraseSetOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeletePhraseSetRequest request =
+   *       UndeletePhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       speechClient.undeletePhraseSetOperationCallable().futureCall(request);
+   *   // Do something.
+   *   PhraseSet response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + undeletePhraseSetOperationCallable() { + return stub.undeletePhraseSetOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SpeechClient speechClient = SpeechClient.create()) {
+   *   UndeletePhraseSetRequest request =
+   *       UndeletePhraseSetRequest.newBuilder()
+   *           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = speechClient.undeletePhraseSetCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable undeletePhraseSetCallable() { + return stub.undeletePhraseSetCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRecognizersPagedResponse + extends AbstractPagedListResponse< + ListRecognizersRequest, + ListRecognizersResponse, + Recognizer, + ListRecognizersPage, + ListRecognizersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRecognizersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListRecognizersPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListRecognizersPagedResponse(ListRecognizersPage page) { + super(page, ListRecognizersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRecognizersPage + extends AbstractPage< + ListRecognizersRequest, ListRecognizersResponse, Recognizer, ListRecognizersPage> { + + private ListRecognizersPage( + PageContext context, + ListRecognizersResponse response) { + super(context, response); + } + + private static ListRecognizersPage createEmptyPage() { + return new ListRecognizersPage(null, null); + } + + @Override + protected ListRecognizersPage createPage( + PageContext context, + ListRecognizersResponse response) { + return new ListRecognizersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRecognizersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRecognizersRequest, + ListRecognizersResponse, + Recognizer, + ListRecognizersPage, + ListRecognizersFixedSizeCollection> { + + private ListRecognizersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRecognizersFixedSizeCollection createEmptyCollection() { + return new ListRecognizersFixedSizeCollection(null, 0); + } + + @Override + protected ListRecognizersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRecognizersFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListCustomClassesPagedResponse + extends AbstractPagedListResponse< + ListCustomClassesRequest, + ListCustomClassesResponse, + CustomClass, + ListCustomClassesPage, + ListCustomClassesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListCustomClassesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListCustomClassesPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListCustomClassesPagedResponse(ListCustomClassesPage page) { + super(page, ListCustomClassesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListCustomClassesPage + extends AbstractPage< + ListCustomClassesRequest, ListCustomClassesResponse, CustomClass, ListCustomClassesPage> { + + private ListCustomClassesPage( + PageContext context, + ListCustomClassesResponse response) { + super(context, response); + } + + private static ListCustomClassesPage createEmptyPage() { + return new ListCustomClassesPage(null, null); + } + + @Override + protected ListCustomClassesPage createPage( + PageContext context, + ListCustomClassesResponse response) { + return new ListCustomClassesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListCustomClassesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListCustomClassesRequest, + ListCustomClassesResponse, + CustomClass, + ListCustomClassesPage, + ListCustomClassesFixedSizeCollection> { + + private ListCustomClassesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListCustomClassesFixedSizeCollection createEmptyCollection() { + return new ListCustomClassesFixedSizeCollection(null, 0); + } + + @Override + protected ListCustomClassesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListCustomClassesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListPhraseSetsPagedResponse + extends AbstractPagedListResponse< + ListPhraseSetsRequest, + ListPhraseSetsResponse, + PhraseSet, + ListPhraseSetsPage, + ListPhraseSetsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListPhraseSetsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListPhraseSetsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListPhraseSetsPagedResponse(ListPhraseSetsPage page) { + super(page, ListPhraseSetsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListPhraseSetsPage + extends AbstractPage< + ListPhraseSetsRequest, ListPhraseSetsResponse, PhraseSet, ListPhraseSetsPage> { + + private ListPhraseSetsPage( + PageContext context, + ListPhraseSetsResponse response) { + super(context, response); + } + + private static ListPhraseSetsPage createEmptyPage() { + return new ListPhraseSetsPage(null, null); + } + + @Override + protected ListPhraseSetsPage createPage( + PageContext context, + ListPhraseSetsResponse response) { + return new ListPhraseSetsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListPhraseSetsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListPhraseSetsRequest, + ListPhraseSetsResponse, + PhraseSet, + ListPhraseSetsPage, + ListPhraseSetsFixedSizeCollection> { + + private ListPhraseSetsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListPhraseSetsFixedSizeCollection createEmptyCollection() { + return new ListPhraseSetsFixedSizeCollection(null, 0); + } + + @Override + protected ListPhraseSetsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListPhraseSetsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechSettings.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechSettings.java new file mode 100644 index 000000000000..2feefaefd6e9 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/SpeechSettings.java @@ -0,0 +1,608 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import static com.google.cloud.speech.v2.SpeechClient.ListCustomClassesPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListPhraseSetsPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListRecognizersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.speech.v2.stub.SpeechStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link SpeechClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (speech.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getRecognizer to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SpeechSettings.Builder speechSettingsBuilder = SpeechSettings.newBuilder();
+ * speechSettingsBuilder
+ *     .getRecognizerSettings()
+ *     .setRetrySettings(
+ *         speechSettingsBuilder.getRecognizerSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * SpeechSettings speechSettings = speechSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class SpeechSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createRecognizer. */ + public UnaryCallSettings createRecognizerSettings() { + return ((SpeechStubSettings) getStubSettings()).createRecognizerSettings(); + } + + /** Returns the object with the settings used for calls to createRecognizer. */ + public OperationCallSettings + createRecognizerOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).createRecognizerOperationSettings(); + } + + /** Returns the object with the settings used for calls to listRecognizers. */ + public PagedCallSettings< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse> + listRecognizersSettings() { + return ((SpeechStubSettings) getStubSettings()).listRecognizersSettings(); + } + + /** Returns the object with the settings used for calls to getRecognizer. */ + public UnaryCallSettings getRecognizerSettings() { + return ((SpeechStubSettings) getStubSettings()).getRecognizerSettings(); + } + + /** Returns the object with the settings used for calls to updateRecognizer. */ + public UnaryCallSettings updateRecognizerSettings() { + return ((SpeechStubSettings) getStubSettings()).updateRecognizerSettings(); + } + + /** Returns the object with the settings used for calls to updateRecognizer. */ + public OperationCallSettings + updateRecognizerOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).updateRecognizerOperationSettings(); + } + + /** Returns the object with the settings used for calls to deleteRecognizer. */ + public UnaryCallSettings deleteRecognizerSettings() { + return ((SpeechStubSettings) getStubSettings()).deleteRecognizerSettings(); + } + + /** Returns the object with the settings used for calls to deleteRecognizer. */ + public OperationCallSettings + deleteRecognizerOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).deleteRecognizerOperationSettings(); + } + + /** Returns the object with the settings used for calls to undeleteRecognizer. */ + public UnaryCallSettings undeleteRecognizerSettings() { + return ((SpeechStubSettings) getStubSettings()).undeleteRecognizerSettings(); + } + + /** Returns the object with the settings used for calls to undeleteRecognizer. */ + public OperationCallSettings + undeleteRecognizerOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).undeleteRecognizerOperationSettings(); + } + + /** Returns the object with the settings used for calls to recognize. */ + public UnaryCallSettings recognizeSettings() { + return ((SpeechStubSettings) getStubSettings()).recognizeSettings(); + } + + /** Returns the object with the settings used for calls to streamingRecognize. */ + public StreamingCallSettings + streamingRecognizeSettings() { + return ((SpeechStubSettings) getStubSettings()).streamingRecognizeSettings(); + } + + /** Returns the object with the settings used for calls to batchRecognize. */ + public UnaryCallSettings batchRecognizeSettings() { + return ((SpeechStubSettings) getStubSettings()).batchRecognizeSettings(); + } + + /** Returns the object with the settings used for calls to batchRecognize. */ + public OperationCallSettings + batchRecognizeOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).batchRecognizeOperationSettings(); + } + + /** Returns the object with the settings used for calls to getConfig. */ + public UnaryCallSettings getConfigSettings() { + return ((SpeechStubSettings) getStubSettings()).getConfigSettings(); + } + + /** Returns the object with the settings used for calls to updateConfig. */ + public UnaryCallSettings updateConfigSettings() { + return ((SpeechStubSettings) getStubSettings()).updateConfigSettings(); + } + + /** Returns the object with the settings used for calls to createCustomClass. */ + public UnaryCallSettings createCustomClassSettings() { + return ((SpeechStubSettings) getStubSettings()).createCustomClassSettings(); + } + + /** Returns the object with the settings used for calls to createCustomClass. */ + public OperationCallSettings + createCustomClassOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).createCustomClassOperationSettings(); + } + + /** Returns the object with the settings used for calls to listCustomClasses. */ + public PagedCallSettings< + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> + listCustomClassesSettings() { + return ((SpeechStubSettings) getStubSettings()).listCustomClassesSettings(); + } + + /** Returns the object with the settings used for calls to getCustomClass. */ + public UnaryCallSettings getCustomClassSettings() { + return ((SpeechStubSettings) getStubSettings()).getCustomClassSettings(); + } + + /** Returns the object with the settings used for calls to updateCustomClass. */ + public UnaryCallSettings updateCustomClassSettings() { + return ((SpeechStubSettings) getStubSettings()).updateCustomClassSettings(); + } + + /** Returns the object with the settings used for calls to updateCustomClass. */ + public OperationCallSettings + updateCustomClassOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).updateCustomClassOperationSettings(); + } + + /** Returns the object with the settings used for calls to deleteCustomClass. */ + public UnaryCallSettings deleteCustomClassSettings() { + return ((SpeechStubSettings) getStubSettings()).deleteCustomClassSettings(); + } + + /** Returns the object with the settings used for calls to deleteCustomClass. */ + public OperationCallSettings + deleteCustomClassOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).deleteCustomClassOperationSettings(); + } + + /** Returns the object with the settings used for calls to undeleteCustomClass. */ + public UnaryCallSettings undeleteCustomClassSettings() { + return ((SpeechStubSettings) getStubSettings()).undeleteCustomClassSettings(); + } + + /** Returns the object with the settings used for calls to undeleteCustomClass. */ + public OperationCallSettings + undeleteCustomClassOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).undeleteCustomClassOperationSettings(); + } + + /** Returns the object with the settings used for calls to createPhraseSet. */ + public UnaryCallSettings createPhraseSetSettings() { + return ((SpeechStubSettings) getStubSettings()).createPhraseSetSettings(); + } + + /** Returns the object with the settings used for calls to createPhraseSet. */ + public OperationCallSettings + createPhraseSetOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).createPhraseSetOperationSettings(); + } + + /** Returns the object with the settings used for calls to listPhraseSets. */ + public PagedCallSettings< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse> + listPhraseSetsSettings() { + return ((SpeechStubSettings) getStubSettings()).listPhraseSetsSettings(); + } + + /** Returns the object with the settings used for calls to getPhraseSet. */ + public UnaryCallSettings getPhraseSetSettings() { + return ((SpeechStubSettings) getStubSettings()).getPhraseSetSettings(); + } + + /** Returns the object with the settings used for calls to updatePhraseSet. */ + public UnaryCallSettings updatePhraseSetSettings() { + return ((SpeechStubSettings) getStubSettings()).updatePhraseSetSettings(); + } + + /** Returns the object with the settings used for calls to updatePhraseSet. */ + public OperationCallSettings + updatePhraseSetOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).updatePhraseSetOperationSettings(); + } + + /** Returns the object with the settings used for calls to deletePhraseSet. */ + public UnaryCallSettings deletePhraseSetSettings() { + return ((SpeechStubSettings) getStubSettings()).deletePhraseSetSettings(); + } + + /** Returns the object with the settings used for calls to deletePhraseSet. */ + public OperationCallSettings + deletePhraseSetOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).deletePhraseSetOperationSettings(); + } + + /** Returns the object with the settings used for calls to undeletePhraseSet. */ + public UnaryCallSettings undeletePhraseSetSettings() { + return ((SpeechStubSettings) getStubSettings()).undeletePhraseSetSettings(); + } + + /** Returns the object with the settings used for calls to undeletePhraseSet. */ + public OperationCallSettings + undeletePhraseSetOperationSettings() { + return ((SpeechStubSettings) getStubSettings()).undeletePhraseSetOperationSettings(); + } + + public static final SpeechSettings create(SpeechStubSettings stub) throws IOException { + return new SpeechSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return SpeechStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return SpeechStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return SpeechStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return SpeechStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return SpeechStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SpeechStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return SpeechStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SpeechStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SpeechSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for SpeechSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(SpeechStubSettings.newBuilder(clientContext)); + } + + protected Builder(SpeechSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(SpeechStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(SpeechStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(SpeechStubSettings.newHttpJsonBuilder()); + } + + public SpeechStubSettings.Builder getStubSettingsBuilder() { + return ((SpeechStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createRecognizer. */ + public UnaryCallSettings.Builder + createRecognizerSettings() { + return getStubSettingsBuilder().createRecognizerSettings(); + } + + /** Returns the builder for the settings used for calls to createRecognizer. */ + public OperationCallSettings.Builder + createRecognizerOperationSettings() { + return getStubSettingsBuilder().createRecognizerOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listRecognizers. */ + public PagedCallSettings.Builder< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse> + listRecognizersSettings() { + return getStubSettingsBuilder().listRecognizersSettings(); + } + + /** Returns the builder for the settings used for calls to getRecognizer. */ + public UnaryCallSettings.Builder getRecognizerSettings() { + return getStubSettingsBuilder().getRecognizerSettings(); + } + + /** Returns the builder for the settings used for calls to updateRecognizer. */ + public UnaryCallSettings.Builder + updateRecognizerSettings() { + return getStubSettingsBuilder().updateRecognizerSettings(); + } + + /** Returns the builder for the settings used for calls to updateRecognizer. */ + public OperationCallSettings.Builder + updateRecognizerOperationSettings() { + return getStubSettingsBuilder().updateRecognizerOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deleteRecognizer. */ + public UnaryCallSettings.Builder + deleteRecognizerSettings() { + return getStubSettingsBuilder().deleteRecognizerSettings(); + } + + /** Returns the builder for the settings used for calls to deleteRecognizer. */ + public OperationCallSettings.Builder + deleteRecognizerOperationSettings() { + return getStubSettingsBuilder().deleteRecognizerOperationSettings(); + } + + /** Returns the builder for the settings used for calls to undeleteRecognizer. */ + public UnaryCallSettings.Builder + undeleteRecognizerSettings() { + return getStubSettingsBuilder().undeleteRecognizerSettings(); + } + + /** Returns the builder for the settings used for calls to undeleteRecognizer. */ + public OperationCallSettings.Builder + undeleteRecognizerOperationSettings() { + return getStubSettingsBuilder().undeleteRecognizerOperationSettings(); + } + + /** Returns the builder for the settings used for calls to recognize. */ + public UnaryCallSettings.Builder recognizeSettings() { + return getStubSettingsBuilder().recognizeSettings(); + } + + /** Returns the builder for the settings used for calls to streamingRecognize. */ + public StreamingCallSettings.Builder + streamingRecognizeSettings() { + return getStubSettingsBuilder().streamingRecognizeSettings(); + } + + /** Returns the builder for the settings used for calls to batchRecognize. */ + public UnaryCallSettings.Builder batchRecognizeSettings() { + return getStubSettingsBuilder().batchRecognizeSettings(); + } + + /** Returns the builder for the settings used for calls to batchRecognize. */ + public OperationCallSettings.Builder< + BatchRecognizeRequest, BatchRecognizeResponse, OperationMetadata> + batchRecognizeOperationSettings() { + return getStubSettingsBuilder().batchRecognizeOperationSettings(); + } + + /** Returns the builder for the settings used for calls to getConfig. */ + public UnaryCallSettings.Builder getConfigSettings() { + return getStubSettingsBuilder().getConfigSettings(); + } + + /** Returns the builder for the settings used for calls to updateConfig. */ + public UnaryCallSettings.Builder updateConfigSettings() { + return getStubSettingsBuilder().updateConfigSettings(); + } + + /** Returns the builder for the settings used for calls to createCustomClass. */ + public UnaryCallSettings.Builder + createCustomClassSettings() { + return getStubSettingsBuilder().createCustomClassSettings(); + } + + /** Returns the builder for the settings used for calls to createCustomClass. */ + public OperationCallSettings.Builder + createCustomClassOperationSettings() { + return getStubSettingsBuilder().createCustomClassOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listCustomClasses. */ + public PagedCallSettings.Builder< + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> + listCustomClassesSettings() { + return getStubSettingsBuilder().listCustomClassesSettings(); + } + + /** Returns the builder for the settings used for calls to getCustomClass. */ + public UnaryCallSettings.Builder getCustomClassSettings() { + return getStubSettingsBuilder().getCustomClassSettings(); + } + + /** Returns the builder for the settings used for calls to updateCustomClass. */ + public UnaryCallSettings.Builder + updateCustomClassSettings() { + return getStubSettingsBuilder().updateCustomClassSettings(); + } + + /** Returns the builder for the settings used for calls to updateCustomClass. */ + public OperationCallSettings.Builder + updateCustomClassOperationSettings() { + return getStubSettingsBuilder().updateCustomClassOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deleteCustomClass. */ + public UnaryCallSettings.Builder + deleteCustomClassSettings() { + return getStubSettingsBuilder().deleteCustomClassSettings(); + } + + /** Returns the builder for the settings used for calls to deleteCustomClass. */ + public OperationCallSettings.Builder + deleteCustomClassOperationSettings() { + return getStubSettingsBuilder().deleteCustomClassOperationSettings(); + } + + /** Returns the builder for the settings used for calls to undeleteCustomClass. */ + public UnaryCallSettings.Builder + undeleteCustomClassSettings() { + return getStubSettingsBuilder().undeleteCustomClassSettings(); + } + + /** Returns the builder for the settings used for calls to undeleteCustomClass. */ + public OperationCallSettings.Builder + undeleteCustomClassOperationSettings() { + return getStubSettingsBuilder().undeleteCustomClassOperationSettings(); + } + + /** Returns the builder for the settings used for calls to createPhraseSet. */ + public UnaryCallSettings.Builder createPhraseSetSettings() { + return getStubSettingsBuilder().createPhraseSetSettings(); + } + + /** Returns the builder for the settings used for calls to createPhraseSet. */ + public OperationCallSettings.Builder + createPhraseSetOperationSettings() { + return getStubSettingsBuilder().createPhraseSetOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listPhraseSets. */ + public PagedCallSettings.Builder< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse> + listPhraseSetsSettings() { + return getStubSettingsBuilder().listPhraseSetsSettings(); + } + + /** Returns the builder for the settings used for calls to getPhraseSet. */ + public UnaryCallSettings.Builder getPhraseSetSettings() { + return getStubSettingsBuilder().getPhraseSetSettings(); + } + + /** Returns the builder for the settings used for calls to updatePhraseSet. */ + public UnaryCallSettings.Builder updatePhraseSetSettings() { + return getStubSettingsBuilder().updatePhraseSetSettings(); + } + + /** Returns the builder for the settings used for calls to updatePhraseSet. */ + public OperationCallSettings.Builder + updatePhraseSetOperationSettings() { + return getStubSettingsBuilder().updatePhraseSetOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deletePhraseSet. */ + public UnaryCallSettings.Builder deletePhraseSetSettings() { + return getStubSettingsBuilder().deletePhraseSetSettings(); + } + + /** Returns the builder for the settings used for calls to deletePhraseSet. */ + public OperationCallSettings.Builder + deletePhraseSetOperationSettings() { + return getStubSettingsBuilder().deletePhraseSetOperationSettings(); + } + + /** Returns the builder for the settings used for calls to undeletePhraseSet. */ + public UnaryCallSettings.Builder + undeletePhraseSetSettings() { + return getStubSettingsBuilder().undeletePhraseSetSettings(); + } + + /** Returns the builder for the settings used for calls to undeletePhraseSet. */ + public OperationCallSettings.Builder + undeletePhraseSetOperationSettings() { + return getStubSettingsBuilder().undeletePhraseSetOperationSettings(); + } + + @Override + public SpeechSettings build() throws IOException { + return new SpeechSettings(this); + } + } +} diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/gapic_metadata.json b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/gapic_metadata.json new file mode 100644 index 000000000000..d399668ee435 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/gapic_metadata.json @@ -0,0 +1,87 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.cloud.speech.v2", + "libraryPackage": "com.google.cloud.speech.v2", + "services": { + "Speech": { + "clients": { + "grpc": { + "libraryClient": "SpeechClient", + "rpcs": { + "BatchRecognize": { + "methods": ["batchRecognizeAsync", "batchRecognizeAsync", "batchRecognizeAsync", "batchRecognizeOperationCallable", "batchRecognizeCallable"] + }, + "CreateCustomClass": { + "methods": ["createCustomClassAsync", "createCustomClassAsync", "createCustomClassAsync", "createCustomClassOperationCallable", "createCustomClassCallable"] + }, + "CreatePhraseSet": { + "methods": ["createPhraseSetAsync", "createPhraseSetAsync", "createPhraseSetAsync", "createPhraseSetOperationCallable", "createPhraseSetCallable"] + }, + "CreateRecognizer": { + "methods": ["createRecognizerAsync", "createRecognizerAsync", "createRecognizerAsync", "createRecognizerOperationCallable", "createRecognizerCallable"] + }, + "DeleteCustomClass": { + "methods": ["deleteCustomClassAsync", "deleteCustomClassAsync", "deleteCustomClassAsync", "deleteCustomClassOperationCallable", "deleteCustomClassCallable"] + }, + "DeletePhraseSet": { + "methods": ["deletePhraseSetAsync", "deletePhraseSetAsync", "deletePhraseSetAsync", "deletePhraseSetOperationCallable", "deletePhraseSetCallable"] + }, + "DeleteRecognizer": { + "methods": ["deleteRecognizerAsync", "deleteRecognizerAsync", "deleteRecognizerAsync", "deleteRecognizerOperationCallable", "deleteRecognizerCallable"] + }, + "GetConfig": { + "methods": ["getConfig", "getConfig", "getConfig", "getConfigCallable"] + }, + "GetCustomClass": { + "methods": ["getCustomClass", "getCustomClass", "getCustomClass", "getCustomClassCallable"] + }, + "GetPhraseSet": { + "methods": ["getPhraseSet", "getPhraseSet", "getPhraseSet", "getPhraseSetCallable"] + }, + "GetRecognizer": { + "methods": ["getRecognizer", "getRecognizer", "getRecognizer", "getRecognizerCallable"] + }, + "ListCustomClasses": { + "methods": ["listCustomClasses", "listCustomClasses", "listCustomClasses", "listCustomClassesPagedCallable", "listCustomClassesCallable"] + }, + "ListPhraseSets": { + "methods": ["listPhraseSets", "listPhraseSets", "listPhraseSets", "listPhraseSetsPagedCallable", "listPhraseSetsCallable"] + }, + "ListRecognizers": { + "methods": ["listRecognizers", "listRecognizers", "listRecognizers", "listRecognizersPagedCallable", "listRecognizersCallable"] + }, + "Recognize": { + "methods": ["recognize", "recognize", "recognize", "recognize", "recognize", "recognizeCallable"] + }, + "StreamingRecognize": { + "methods": ["streamingRecognizeCallable"] + }, + "UndeleteCustomClass": { + "methods": ["undeleteCustomClassAsync", "undeleteCustomClassAsync", "undeleteCustomClassAsync", "undeleteCustomClassOperationCallable", "undeleteCustomClassCallable"] + }, + "UndeletePhraseSet": { + "methods": ["undeletePhraseSetAsync", "undeletePhraseSetAsync", "undeletePhraseSetAsync", "undeletePhraseSetOperationCallable", "undeletePhraseSetCallable"] + }, + "UndeleteRecognizer": { + "methods": ["undeleteRecognizerAsync", "undeleteRecognizerAsync", "undeleteRecognizerAsync", "undeleteRecognizerOperationCallable", "undeleteRecognizerCallable"] + }, + "UpdateConfig": { + "methods": ["updateConfig", "updateConfig", "updateConfigCallable"] + }, + "UpdateCustomClass": { + "methods": ["updateCustomClassAsync", "updateCustomClassAsync", "updateCustomClassOperationCallable", "updateCustomClassCallable"] + }, + "UpdatePhraseSet": { + "methods": ["updatePhraseSetAsync", "updatePhraseSetAsync", "updatePhraseSetOperationCallable", "updatePhraseSetCallable"] + }, + "UpdateRecognizer": { + "methods": ["updateRecognizerAsync", "updateRecognizerAsync", "updateRecognizerOperationCallable", "updateRecognizerCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/package-info.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/package-info.java new file mode 100644 index 000000000000..6f7101f8eb21 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/package-info.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to Cloud Speech-to-Text API + * + *

The interfaces provided are listed below, along with usage samples. + * + *

======================= SpeechClient ======================= + * + *

Service Description: Enables speech transcription and resource management. + * + *

Sample for SpeechClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (SpeechClient speechClient = SpeechClient.create()) {
+ *   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
+ *   Recognizer response = speechClient.getRecognizer(name);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.cloud.speech.v2; + +import javax.annotation.Generated; diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechCallableFactory.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechCallableFactory.java new file mode 100644 index 000000000000..16b2e8aa8760 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the Speech service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcSpeechCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechStub.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechStub.java new file mode 100644 index 000000000000..00d92d8d8432 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/GrpcSpeechStub.java @@ -0,0 +1,1069 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.stub; + +import static com.google.cloud.speech.v2.SpeechClient.ListCustomClassesPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListPhraseSetsPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListRecognizersPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.speech.v2.BatchRecognizeRequest; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.CreateCustomClassRequest; +import com.google.cloud.speech.v2.CreatePhraseSetRequest; +import com.google.cloud.speech.v2.CreateRecognizerRequest; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.DeleteCustomClassRequest; +import com.google.cloud.speech.v2.DeletePhraseSetRequest; +import com.google.cloud.speech.v2.DeleteRecognizerRequest; +import com.google.cloud.speech.v2.GetConfigRequest; +import com.google.cloud.speech.v2.GetCustomClassRequest; +import com.google.cloud.speech.v2.GetPhraseSetRequest; +import com.google.cloud.speech.v2.GetRecognizerRequest; +import com.google.cloud.speech.v2.ListCustomClassesRequest; +import com.google.cloud.speech.v2.ListCustomClassesResponse; +import com.google.cloud.speech.v2.ListPhraseSetsRequest; +import com.google.cloud.speech.v2.ListPhraseSetsResponse; +import com.google.cloud.speech.v2.ListRecognizersRequest; +import com.google.cloud.speech.v2.ListRecognizersResponse; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.RecognizeRequest; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.StreamingRecognizeRequest; +import com.google.cloud.speech.v2.StreamingRecognizeResponse; +import com.google.cloud.speech.v2.UndeleteCustomClassRequest; +import com.google.cloud.speech.v2.UndeletePhraseSetRequest; +import com.google.cloud.speech.v2.UndeleteRecognizerRequest; +import com.google.cloud.speech.v2.UpdateConfigRequest; +import com.google.cloud.speech.v2.UpdateCustomClassRequest; +import com.google.cloud.speech.v2.UpdatePhraseSetRequest; +import com.google.cloud.speech.v2.UpdateRecognizerRequest; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the Speech service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcSpeechStub extends SpeechStub { + private static final MethodDescriptor + createRecognizerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/CreateRecognizer") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateRecognizerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listRecognizersMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/ListRecognizers") + .setRequestMarshaller( + ProtoUtils.marshaller(ListRecognizersRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListRecognizersResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + getRecognizerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/GetRecognizer") + .setRequestMarshaller( + ProtoUtils.marshaller(GetRecognizerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Recognizer.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateRecognizerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/UpdateRecognizer") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateRecognizerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteRecognizerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/DeleteRecognizer") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteRecognizerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + undeleteRecognizerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/UndeleteRecognizer") + .setRequestMarshaller( + ProtoUtils.marshaller(UndeleteRecognizerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + recognizeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/Recognize") + .setRequestMarshaller(ProtoUtils.marshaller(RecognizeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(RecognizeResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + streamingRecognizeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName("google.cloud.speech.v2.Speech/StreamingRecognize") + .setRequestMarshaller( + ProtoUtils.marshaller(StreamingRecognizeRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(StreamingRecognizeResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + batchRecognizeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/BatchRecognize") + .setRequestMarshaller( + ProtoUtils.marshaller(BatchRecognizeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/GetConfig") + .setRequestMarshaller(ProtoUtils.marshaller(GetConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Config.getDefaultInstance())) + .build(); + + private static final MethodDescriptor updateConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/UpdateConfig") + .setRequestMarshaller(ProtoUtils.marshaller(UpdateConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Config.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + createCustomClassMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/CreateCustomClass") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateCustomClassRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listCustomClassesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/ListCustomClasses") + .setRequestMarshaller( + ProtoUtils.marshaller(ListCustomClassesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListCustomClassesResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + getCustomClassMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/GetCustomClass") + .setRequestMarshaller( + ProtoUtils.marshaller(GetCustomClassRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CustomClass.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateCustomClassMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/UpdateCustomClass") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateCustomClassRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteCustomClassMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/DeleteCustomClass") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteCustomClassRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + undeleteCustomClassMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/UndeleteCustomClass") + .setRequestMarshaller( + ProtoUtils.marshaller(UndeleteCustomClassRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + createPhraseSetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/CreatePhraseSet") + .setRequestMarshaller( + ProtoUtils.marshaller(CreatePhraseSetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listPhraseSetsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/ListPhraseSets") + .setRequestMarshaller( + ProtoUtils.marshaller(ListPhraseSetsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListPhraseSetsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + getPhraseSetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/GetPhraseSet") + .setRequestMarshaller(ProtoUtils.marshaller(GetPhraseSetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(PhraseSet.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updatePhraseSetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/UpdatePhraseSet") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdatePhraseSetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deletePhraseSetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/DeletePhraseSet") + .setRequestMarshaller( + ProtoUtils.marshaller(DeletePhraseSetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + undeletePhraseSetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.speech.v2.Speech/UndeletePhraseSet") + .setRequestMarshaller( + ProtoUtils.marshaller(UndeletePhraseSetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final UnaryCallable createRecognizerCallable; + private final OperationCallable + createRecognizerOperationCallable; + private final UnaryCallable + listRecognizersCallable; + private final UnaryCallable + listRecognizersPagedCallable; + private final UnaryCallable getRecognizerCallable; + private final UnaryCallable updateRecognizerCallable; + private final OperationCallable + updateRecognizerOperationCallable; + private final UnaryCallable deleteRecognizerCallable; + private final OperationCallable + deleteRecognizerOperationCallable; + private final UnaryCallable undeleteRecognizerCallable; + private final OperationCallable + undeleteRecognizerOperationCallable; + private final UnaryCallable recognizeCallable; + private final BidiStreamingCallable + streamingRecognizeCallable; + private final UnaryCallable batchRecognizeCallable; + private final OperationCallable + batchRecognizeOperationCallable; + private final UnaryCallable getConfigCallable; + private final UnaryCallable updateConfigCallable; + private final UnaryCallable createCustomClassCallable; + private final OperationCallable + createCustomClassOperationCallable; + private final UnaryCallable + listCustomClassesCallable; + private final UnaryCallable + listCustomClassesPagedCallable; + private final UnaryCallable getCustomClassCallable; + private final UnaryCallable updateCustomClassCallable; + private final OperationCallable + updateCustomClassOperationCallable; + private final UnaryCallable deleteCustomClassCallable; + private final OperationCallable + deleteCustomClassOperationCallable; + private final UnaryCallable undeleteCustomClassCallable; + private final OperationCallable + undeleteCustomClassOperationCallable; + private final UnaryCallable createPhraseSetCallable; + private final OperationCallable + createPhraseSetOperationCallable; + private final UnaryCallable listPhraseSetsCallable; + private final UnaryCallable + listPhraseSetsPagedCallable; + private final UnaryCallable getPhraseSetCallable; + private final UnaryCallable updatePhraseSetCallable; + private final OperationCallable + updatePhraseSetOperationCallable; + private final UnaryCallable deletePhraseSetCallable; + private final OperationCallable + deletePhraseSetOperationCallable; + private final UnaryCallable undeletePhraseSetCallable; + private final OperationCallable + undeletePhraseSetOperationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcSpeechStub create(SpeechStubSettings settings) throws IOException { + return new GrpcSpeechStub(settings, ClientContext.create(settings)); + } + + public static final GrpcSpeechStub create(ClientContext clientContext) throws IOException { + return new GrpcSpeechStub(SpeechStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcSpeechStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcSpeechStub( + SpeechStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcSpeechStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected GrpcSpeechStub(SpeechStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcSpeechCallableFactory()); + } + + /** + * Constructs an instance of GrpcSpeechStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected GrpcSpeechStub( + SpeechStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createRecognizerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createRecognizerMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings + listRecognizersTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listRecognizersMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings getRecognizerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getRecognizerMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings updateRecognizerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateRecognizerMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("recognizer.name", String.valueOf(request.getRecognizer().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteRecognizerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteRecognizerMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings undeleteRecognizerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(undeleteRecognizerMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings recognizeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(recognizeMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("recognizer", String.valueOf(request.getRecognizer())); + return params.build(); + }) + .build(); + GrpcCallSettings + streamingRecognizeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(streamingRecognizeMethodDescriptor) + .build(); + GrpcCallSettings batchRecognizeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(batchRecognizeMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("recognizer", String.valueOf(request.getRecognizer())); + return params.build(); + }) + .build(); + GrpcCallSettings getConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings updateConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("config.name", String.valueOf(request.getConfig().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings createCustomClassTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createCustomClassMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings + listCustomClassesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listCustomClassesMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings getCustomClassTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getCustomClassMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings updateCustomClassTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateCustomClassMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "custom_class.name", String.valueOf(request.getCustomClass().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteCustomClassTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteCustomClassMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings undeleteCustomClassTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(undeleteCustomClassMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings createPhraseSetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createPhraseSetMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings + listPhraseSetsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listPhraseSetsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings getPhraseSetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getPhraseSetMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings updatePhraseSetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updatePhraseSetMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("phrase_set.name", String.valueOf(request.getPhraseSet().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings deletePhraseSetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deletePhraseSetMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings undeletePhraseSetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(undeletePhraseSetMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + + this.createRecognizerCallable = + callableFactory.createUnaryCallable( + createRecognizerTransportSettings, settings.createRecognizerSettings(), clientContext); + this.createRecognizerOperationCallable = + callableFactory.createOperationCallable( + createRecognizerTransportSettings, + settings.createRecognizerOperationSettings(), + clientContext, + operationsStub); + this.listRecognizersCallable = + callableFactory.createUnaryCallable( + listRecognizersTransportSettings, settings.listRecognizersSettings(), clientContext); + this.listRecognizersPagedCallable = + callableFactory.createPagedCallable( + listRecognizersTransportSettings, settings.listRecognizersSettings(), clientContext); + this.getRecognizerCallable = + callableFactory.createUnaryCallable( + getRecognizerTransportSettings, settings.getRecognizerSettings(), clientContext); + this.updateRecognizerCallable = + callableFactory.createUnaryCallable( + updateRecognizerTransportSettings, settings.updateRecognizerSettings(), clientContext); + this.updateRecognizerOperationCallable = + callableFactory.createOperationCallable( + updateRecognizerTransportSettings, + settings.updateRecognizerOperationSettings(), + clientContext, + operationsStub); + this.deleteRecognizerCallable = + callableFactory.createUnaryCallable( + deleteRecognizerTransportSettings, settings.deleteRecognizerSettings(), clientContext); + this.deleteRecognizerOperationCallable = + callableFactory.createOperationCallable( + deleteRecognizerTransportSettings, + settings.deleteRecognizerOperationSettings(), + clientContext, + operationsStub); + this.undeleteRecognizerCallable = + callableFactory.createUnaryCallable( + undeleteRecognizerTransportSettings, + settings.undeleteRecognizerSettings(), + clientContext); + this.undeleteRecognizerOperationCallable = + callableFactory.createOperationCallable( + undeleteRecognizerTransportSettings, + settings.undeleteRecognizerOperationSettings(), + clientContext, + operationsStub); + this.recognizeCallable = + callableFactory.createUnaryCallable( + recognizeTransportSettings, settings.recognizeSettings(), clientContext); + this.streamingRecognizeCallable = + callableFactory.createBidiStreamingCallable( + streamingRecognizeTransportSettings, + settings.streamingRecognizeSettings(), + clientContext); + this.batchRecognizeCallable = + callableFactory.createUnaryCallable( + batchRecognizeTransportSettings, settings.batchRecognizeSettings(), clientContext); + this.batchRecognizeOperationCallable = + callableFactory.createOperationCallable( + batchRecognizeTransportSettings, + settings.batchRecognizeOperationSettings(), + clientContext, + operationsStub); + this.getConfigCallable = + callableFactory.createUnaryCallable( + getConfigTransportSettings, settings.getConfigSettings(), clientContext); + this.updateConfigCallable = + callableFactory.createUnaryCallable( + updateConfigTransportSettings, settings.updateConfigSettings(), clientContext); + this.createCustomClassCallable = + callableFactory.createUnaryCallable( + createCustomClassTransportSettings, + settings.createCustomClassSettings(), + clientContext); + this.createCustomClassOperationCallable = + callableFactory.createOperationCallable( + createCustomClassTransportSettings, + settings.createCustomClassOperationSettings(), + clientContext, + operationsStub); + this.listCustomClassesCallable = + callableFactory.createUnaryCallable( + listCustomClassesTransportSettings, + settings.listCustomClassesSettings(), + clientContext); + this.listCustomClassesPagedCallable = + callableFactory.createPagedCallable( + listCustomClassesTransportSettings, + settings.listCustomClassesSettings(), + clientContext); + this.getCustomClassCallable = + callableFactory.createUnaryCallable( + getCustomClassTransportSettings, settings.getCustomClassSettings(), clientContext); + this.updateCustomClassCallable = + callableFactory.createUnaryCallable( + updateCustomClassTransportSettings, + settings.updateCustomClassSettings(), + clientContext); + this.updateCustomClassOperationCallable = + callableFactory.createOperationCallable( + updateCustomClassTransportSettings, + settings.updateCustomClassOperationSettings(), + clientContext, + operationsStub); + this.deleteCustomClassCallable = + callableFactory.createUnaryCallable( + deleteCustomClassTransportSettings, + settings.deleteCustomClassSettings(), + clientContext); + this.deleteCustomClassOperationCallable = + callableFactory.createOperationCallable( + deleteCustomClassTransportSettings, + settings.deleteCustomClassOperationSettings(), + clientContext, + operationsStub); + this.undeleteCustomClassCallable = + callableFactory.createUnaryCallable( + undeleteCustomClassTransportSettings, + settings.undeleteCustomClassSettings(), + clientContext); + this.undeleteCustomClassOperationCallable = + callableFactory.createOperationCallable( + undeleteCustomClassTransportSettings, + settings.undeleteCustomClassOperationSettings(), + clientContext, + operationsStub); + this.createPhraseSetCallable = + callableFactory.createUnaryCallable( + createPhraseSetTransportSettings, settings.createPhraseSetSettings(), clientContext); + this.createPhraseSetOperationCallable = + callableFactory.createOperationCallable( + createPhraseSetTransportSettings, + settings.createPhraseSetOperationSettings(), + clientContext, + operationsStub); + this.listPhraseSetsCallable = + callableFactory.createUnaryCallable( + listPhraseSetsTransportSettings, settings.listPhraseSetsSettings(), clientContext); + this.listPhraseSetsPagedCallable = + callableFactory.createPagedCallable( + listPhraseSetsTransportSettings, settings.listPhraseSetsSettings(), clientContext); + this.getPhraseSetCallable = + callableFactory.createUnaryCallable( + getPhraseSetTransportSettings, settings.getPhraseSetSettings(), clientContext); + this.updatePhraseSetCallable = + callableFactory.createUnaryCallable( + updatePhraseSetTransportSettings, settings.updatePhraseSetSettings(), clientContext); + this.updatePhraseSetOperationCallable = + callableFactory.createOperationCallable( + updatePhraseSetTransportSettings, + settings.updatePhraseSetOperationSettings(), + clientContext, + operationsStub); + this.deletePhraseSetCallable = + callableFactory.createUnaryCallable( + deletePhraseSetTransportSettings, settings.deletePhraseSetSettings(), clientContext); + this.deletePhraseSetOperationCallable = + callableFactory.createOperationCallable( + deletePhraseSetTransportSettings, + settings.deletePhraseSetOperationSettings(), + clientContext, + operationsStub); + this.undeletePhraseSetCallable = + callableFactory.createUnaryCallable( + undeletePhraseSetTransportSettings, + settings.undeletePhraseSetSettings(), + clientContext); + this.undeletePhraseSetOperationCallable = + callableFactory.createOperationCallable( + undeletePhraseSetTransportSettings, + settings.undeletePhraseSetOperationSettings(), + clientContext, + operationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createRecognizerCallable() { + return createRecognizerCallable; + } + + @Override + public OperationCallable + createRecognizerOperationCallable() { + return createRecognizerOperationCallable; + } + + @Override + public UnaryCallable listRecognizersCallable() { + return listRecognizersCallable; + } + + @Override + public UnaryCallable + listRecognizersPagedCallable() { + return listRecognizersPagedCallable; + } + + @Override + public UnaryCallable getRecognizerCallable() { + return getRecognizerCallable; + } + + @Override + public UnaryCallable updateRecognizerCallable() { + return updateRecognizerCallable; + } + + @Override + public OperationCallable + updateRecognizerOperationCallable() { + return updateRecognizerOperationCallable; + } + + @Override + public UnaryCallable deleteRecognizerCallable() { + return deleteRecognizerCallable; + } + + @Override + public OperationCallable + deleteRecognizerOperationCallable() { + return deleteRecognizerOperationCallable; + } + + @Override + public UnaryCallable undeleteRecognizerCallable() { + return undeleteRecognizerCallable; + } + + @Override + public OperationCallable + undeleteRecognizerOperationCallable() { + return undeleteRecognizerOperationCallable; + } + + @Override + public UnaryCallable recognizeCallable() { + return recognizeCallable; + } + + @Override + public BidiStreamingCallable + streamingRecognizeCallable() { + return streamingRecognizeCallable; + } + + @Override + public UnaryCallable batchRecognizeCallable() { + return batchRecognizeCallable; + } + + @Override + public OperationCallable + batchRecognizeOperationCallable() { + return batchRecognizeOperationCallable; + } + + @Override + public UnaryCallable getConfigCallable() { + return getConfigCallable; + } + + @Override + public UnaryCallable updateConfigCallable() { + return updateConfigCallable; + } + + @Override + public UnaryCallable createCustomClassCallable() { + return createCustomClassCallable; + } + + @Override + public OperationCallable + createCustomClassOperationCallable() { + return createCustomClassOperationCallable; + } + + @Override + public UnaryCallable + listCustomClassesCallable() { + return listCustomClassesCallable; + } + + @Override + public UnaryCallable + listCustomClassesPagedCallable() { + return listCustomClassesPagedCallable; + } + + @Override + public UnaryCallable getCustomClassCallable() { + return getCustomClassCallable; + } + + @Override + public UnaryCallable updateCustomClassCallable() { + return updateCustomClassCallable; + } + + @Override + public OperationCallable + updateCustomClassOperationCallable() { + return updateCustomClassOperationCallable; + } + + @Override + public UnaryCallable deleteCustomClassCallable() { + return deleteCustomClassCallable; + } + + @Override + public OperationCallable + deleteCustomClassOperationCallable() { + return deleteCustomClassOperationCallable; + } + + @Override + public UnaryCallable undeleteCustomClassCallable() { + return undeleteCustomClassCallable; + } + + @Override + public OperationCallable + undeleteCustomClassOperationCallable() { + return undeleteCustomClassOperationCallable; + } + + @Override + public UnaryCallable createPhraseSetCallable() { + return createPhraseSetCallable; + } + + @Override + public OperationCallable + createPhraseSetOperationCallable() { + return createPhraseSetOperationCallable; + } + + @Override + public UnaryCallable listPhraseSetsCallable() { + return listPhraseSetsCallable; + } + + @Override + public UnaryCallable + listPhraseSetsPagedCallable() { + return listPhraseSetsPagedCallable; + } + + @Override + public UnaryCallable getPhraseSetCallable() { + return getPhraseSetCallable; + } + + @Override + public UnaryCallable updatePhraseSetCallable() { + return updatePhraseSetCallable; + } + + @Override + public OperationCallable + updatePhraseSetOperationCallable() { + return updatePhraseSetOperationCallable; + } + + @Override + public UnaryCallable deletePhraseSetCallable() { + return deletePhraseSetCallable; + } + + @Override + public OperationCallable + deletePhraseSetOperationCallable() { + return deletePhraseSetOperationCallable; + } + + @Override + public UnaryCallable undeletePhraseSetCallable() { + return undeletePhraseSetCallable; + } + + @Override + public OperationCallable + undeletePhraseSetOperationCallable() { + return undeletePhraseSetOperationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechCallableFactory.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechCallableFactory.java new file mode 100644 index 000000000000..e52e10e481d8 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Speech service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonSpeechCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechStub.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechStub.java new file mode 100644 index 000000000000..c9914f783f48 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/HttpJsonSpeechStub.java @@ -0,0 +1,1615 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.stub; + +import static com.google.cloud.speech.v2.SpeechClient.ListCustomClassesPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListPhraseSetsPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListRecognizersPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.speech.v2.BatchRecognizeRequest; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.CreateCustomClassRequest; +import com.google.cloud.speech.v2.CreatePhraseSetRequest; +import com.google.cloud.speech.v2.CreateRecognizerRequest; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.DeleteCustomClassRequest; +import com.google.cloud.speech.v2.DeletePhraseSetRequest; +import com.google.cloud.speech.v2.DeleteRecognizerRequest; +import com.google.cloud.speech.v2.GetConfigRequest; +import com.google.cloud.speech.v2.GetCustomClassRequest; +import com.google.cloud.speech.v2.GetPhraseSetRequest; +import com.google.cloud.speech.v2.GetRecognizerRequest; +import com.google.cloud.speech.v2.ListCustomClassesRequest; +import com.google.cloud.speech.v2.ListCustomClassesResponse; +import com.google.cloud.speech.v2.ListPhraseSetsRequest; +import com.google.cloud.speech.v2.ListPhraseSetsResponse; +import com.google.cloud.speech.v2.ListRecognizersRequest; +import com.google.cloud.speech.v2.ListRecognizersResponse; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.RecognizeRequest; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.UndeleteCustomClassRequest; +import com.google.cloud.speech.v2.UndeletePhraseSetRequest; +import com.google.cloud.speech.v2.UndeleteRecognizerRequest; +import com.google.cloud.speech.v2.UpdateConfigRequest; +import com.google.cloud.speech.v2.UpdateCustomClassRequest; +import com.google.cloud.speech.v2.UpdatePhraseSetRequest; +import com.google.cloud.speech.v2.UpdateRecognizerRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Speech service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonSpeechStub extends SpeechStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(OperationMetadata.getDescriptor()) + .add(CustomClass.getDescriptor()) + .add(Recognizer.getDescriptor()) + .add(PhraseSet.getDescriptor()) + .add(BatchRecognizeResponse.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createRecognizerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/CreateRecognizer") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/recognizers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "recognizerId", request.getRecognizerId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("recognizer", request.getRecognizer(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateRecognizerRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listRecognizersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/ListRecognizers") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/recognizers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListRecognizersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getRecognizerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/GetRecognizer") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/recognizers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Recognizer.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateRecognizerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/UpdateRecognizer") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{recognizer.name=projects/*/locations/*/recognizers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "recognizer.name", request.getRecognizer().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("recognizer", request.getRecognizer(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateRecognizerRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteRecognizerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/DeleteRecognizer") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/recognizers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteRecognizerRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + undeleteRecognizerMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/UndeleteRecognizer") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/recognizers/*}:undelete", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UndeleteRecognizerRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + recognizeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/Recognize") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{recognizer=projects/*/locations/*/recognizers/*}:recognize", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "recognizer", request.getRecognizer()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "*", request.toBuilder().clearRecognizer().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(RecognizeResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + batchRecognizeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/BatchRecognize") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{recognizer=projects/*/locations/*/recognizers/*}:batchRecognize", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "recognizer", request.getRecognizer()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "*", request.toBuilder().clearRecognizer().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (BatchRecognizeRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor getConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/GetConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/config}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Config.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/UpdateConfig") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{config.name=projects/*/locations/*/config}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "config.name", request.getConfig().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("config", request.getConfig(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Config.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createCustomClassMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/CreateCustomClass") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/customClasses", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "customClassId", request.getCustomClassId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customClass", request.getCustomClass(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCustomClassRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listCustomClassesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/ListCustomClasses") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/customClasses", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCustomClassesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCustomClassMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/GetCustomClass") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/customClasses/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomClass.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCustomClassMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/UpdateCustomClass") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{customClass.name=projects/*/locations/*/customClasses/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "customClass.name", request.getCustomClass().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customClass", request.getCustomClass(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCustomClassRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteCustomClassMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/DeleteCustomClass") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/customClasses/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteCustomClassRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + undeleteCustomClassMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/UndeleteCustomClass") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/customClasses/*}:undelete", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UndeleteCustomClassRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createPhraseSetMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/CreatePhraseSet") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/phraseSets", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "phraseSetId", request.getPhraseSetId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("phraseSet", request.getPhraseSet(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreatePhraseSetRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listPhraseSetsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/ListPhraseSets") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/phraseSets", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPhraseSetsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getPhraseSetMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/GetPhraseSet") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/phraseSets/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PhraseSet.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updatePhraseSetMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/UpdatePhraseSet") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{phraseSet.name=projects/*/locations/*/phraseSets/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "phraseSet.name", request.getPhraseSet().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("phraseSet", request.getPhraseSet(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdatePhraseSetRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deletePhraseSetMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/DeletePhraseSet") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/phraseSets/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeletePhraseSetRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + undeletePhraseSetMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.speech.v2.Speech/UndeletePhraseSet") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/phraseSets/*}:undelete", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UndeletePhraseSetRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private final UnaryCallable createRecognizerCallable; + private final OperationCallable + createRecognizerOperationCallable; + private final UnaryCallable + listRecognizersCallable; + private final UnaryCallable + listRecognizersPagedCallable; + private final UnaryCallable getRecognizerCallable; + private final UnaryCallable updateRecognizerCallable; + private final OperationCallable + updateRecognizerOperationCallable; + private final UnaryCallable deleteRecognizerCallable; + private final OperationCallable + deleteRecognizerOperationCallable; + private final UnaryCallable undeleteRecognizerCallable; + private final OperationCallable + undeleteRecognizerOperationCallable; + private final UnaryCallable recognizeCallable; + private final UnaryCallable batchRecognizeCallable; + private final OperationCallable + batchRecognizeOperationCallable; + private final UnaryCallable getConfigCallable; + private final UnaryCallable updateConfigCallable; + private final UnaryCallable createCustomClassCallable; + private final OperationCallable + createCustomClassOperationCallable; + private final UnaryCallable + listCustomClassesCallable; + private final UnaryCallable + listCustomClassesPagedCallable; + private final UnaryCallable getCustomClassCallable; + private final UnaryCallable updateCustomClassCallable; + private final OperationCallable + updateCustomClassOperationCallable; + private final UnaryCallable deleteCustomClassCallable; + private final OperationCallable + deleteCustomClassOperationCallable; + private final UnaryCallable undeleteCustomClassCallable; + private final OperationCallable + undeleteCustomClassOperationCallable; + private final UnaryCallable createPhraseSetCallable; + private final OperationCallable + createPhraseSetOperationCallable; + private final UnaryCallable listPhraseSetsCallable; + private final UnaryCallable + listPhraseSetsPagedCallable; + private final UnaryCallable getPhraseSetCallable; + private final UnaryCallable updatePhraseSetCallable; + private final OperationCallable + updatePhraseSetOperationCallable; + private final UnaryCallable deletePhraseSetCallable; + private final OperationCallable + deletePhraseSetOperationCallable; + private final UnaryCallable undeletePhraseSetCallable; + private final OperationCallable + undeletePhraseSetOperationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSpeechStub create(SpeechStubSettings settings) throws IOException { + return new HttpJsonSpeechStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSpeechStub create(ClientContext clientContext) throws IOException { + return new HttpJsonSpeechStub(SpeechStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonSpeechStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSpeechStub( + SpeechStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSpeechStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSpeechStub(SpeechStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonSpeechCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSpeechStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSpeechStub( + SpeechStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings createRecognizerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createRecognizerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listRecognizersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listRecognizersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getRecognizerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getRecognizerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateRecognizerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateRecognizerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteRecognizerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteRecognizerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings undeleteRecognizerTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(undeleteRecognizerMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings recognizeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(recognizeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings batchRecognizeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(batchRecognizeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createCustomClassTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCustomClassMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCustomClassesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listCustomClassesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getCustomClassTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCustomClassMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateCustomClassTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCustomClassMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteCustomClassTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCustomClassMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + undeleteCustomClassTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(undeleteCustomClassMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createPhraseSetTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createPhraseSetMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPhraseSetsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listPhraseSetsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getPhraseSetTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPhraseSetMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updatePhraseSetTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updatePhraseSetMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deletePhraseSetTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePhraseSetMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings undeletePhraseSetTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(undeletePhraseSetMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createRecognizerCallable = + callableFactory.createUnaryCallable( + createRecognizerTransportSettings, settings.createRecognizerSettings(), clientContext); + this.createRecognizerOperationCallable = + callableFactory.createOperationCallable( + createRecognizerTransportSettings, + settings.createRecognizerOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listRecognizersCallable = + callableFactory.createUnaryCallable( + listRecognizersTransportSettings, settings.listRecognizersSettings(), clientContext); + this.listRecognizersPagedCallable = + callableFactory.createPagedCallable( + listRecognizersTransportSettings, settings.listRecognizersSettings(), clientContext); + this.getRecognizerCallable = + callableFactory.createUnaryCallable( + getRecognizerTransportSettings, settings.getRecognizerSettings(), clientContext); + this.updateRecognizerCallable = + callableFactory.createUnaryCallable( + updateRecognizerTransportSettings, settings.updateRecognizerSettings(), clientContext); + this.updateRecognizerOperationCallable = + callableFactory.createOperationCallable( + updateRecognizerTransportSettings, + settings.updateRecognizerOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteRecognizerCallable = + callableFactory.createUnaryCallable( + deleteRecognizerTransportSettings, settings.deleteRecognizerSettings(), clientContext); + this.deleteRecognizerOperationCallable = + callableFactory.createOperationCallable( + deleteRecognizerTransportSettings, + settings.deleteRecognizerOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.undeleteRecognizerCallable = + callableFactory.createUnaryCallable( + undeleteRecognizerTransportSettings, + settings.undeleteRecognizerSettings(), + clientContext); + this.undeleteRecognizerOperationCallable = + callableFactory.createOperationCallable( + undeleteRecognizerTransportSettings, + settings.undeleteRecognizerOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.recognizeCallable = + callableFactory.createUnaryCallable( + recognizeTransportSettings, settings.recognizeSettings(), clientContext); + this.batchRecognizeCallable = + callableFactory.createUnaryCallable( + batchRecognizeTransportSettings, settings.batchRecognizeSettings(), clientContext); + this.batchRecognizeOperationCallable = + callableFactory.createOperationCallable( + batchRecognizeTransportSettings, + settings.batchRecognizeOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getConfigCallable = + callableFactory.createUnaryCallable( + getConfigTransportSettings, settings.getConfigSettings(), clientContext); + this.updateConfigCallable = + callableFactory.createUnaryCallable( + updateConfigTransportSettings, settings.updateConfigSettings(), clientContext); + this.createCustomClassCallable = + callableFactory.createUnaryCallable( + createCustomClassTransportSettings, + settings.createCustomClassSettings(), + clientContext); + this.createCustomClassOperationCallable = + callableFactory.createOperationCallable( + createCustomClassTransportSettings, + settings.createCustomClassOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listCustomClassesCallable = + callableFactory.createUnaryCallable( + listCustomClassesTransportSettings, + settings.listCustomClassesSettings(), + clientContext); + this.listCustomClassesPagedCallable = + callableFactory.createPagedCallable( + listCustomClassesTransportSettings, + settings.listCustomClassesSettings(), + clientContext); + this.getCustomClassCallable = + callableFactory.createUnaryCallable( + getCustomClassTransportSettings, settings.getCustomClassSettings(), clientContext); + this.updateCustomClassCallable = + callableFactory.createUnaryCallable( + updateCustomClassTransportSettings, + settings.updateCustomClassSettings(), + clientContext); + this.updateCustomClassOperationCallable = + callableFactory.createOperationCallable( + updateCustomClassTransportSettings, + settings.updateCustomClassOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteCustomClassCallable = + callableFactory.createUnaryCallable( + deleteCustomClassTransportSettings, + settings.deleteCustomClassSettings(), + clientContext); + this.deleteCustomClassOperationCallable = + callableFactory.createOperationCallable( + deleteCustomClassTransportSettings, + settings.deleteCustomClassOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.undeleteCustomClassCallable = + callableFactory.createUnaryCallable( + undeleteCustomClassTransportSettings, + settings.undeleteCustomClassSettings(), + clientContext); + this.undeleteCustomClassOperationCallable = + callableFactory.createOperationCallable( + undeleteCustomClassTransportSettings, + settings.undeleteCustomClassOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createPhraseSetCallable = + callableFactory.createUnaryCallable( + createPhraseSetTransportSettings, settings.createPhraseSetSettings(), clientContext); + this.createPhraseSetOperationCallable = + callableFactory.createOperationCallable( + createPhraseSetTransportSettings, + settings.createPhraseSetOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listPhraseSetsCallable = + callableFactory.createUnaryCallable( + listPhraseSetsTransportSettings, settings.listPhraseSetsSettings(), clientContext); + this.listPhraseSetsPagedCallable = + callableFactory.createPagedCallable( + listPhraseSetsTransportSettings, settings.listPhraseSetsSettings(), clientContext); + this.getPhraseSetCallable = + callableFactory.createUnaryCallable( + getPhraseSetTransportSettings, settings.getPhraseSetSettings(), clientContext); + this.updatePhraseSetCallable = + callableFactory.createUnaryCallable( + updatePhraseSetTransportSettings, settings.updatePhraseSetSettings(), clientContext); + this.updatePhraseSetOperationCallable = + callableFactory.createOperationCallable( + updatePhraseSetTransportSettings, + settings.updatePhraseSetOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deletePhraseSetCallable = + callableFactory.createUnaryCallable( + deletePhraseSetTransportSettings, settings.deletePhraseSetSettings(), clientContext); + this.deletePhraseSetOperationCallable = + callableFactory.createOperationCallable( + deletePhraseSetTransportSettings, + settings.deletePhraseSetOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.undeletePhraseSetCallable = + callableFactory.createUnaryCallable( + undeletePhraseSetTransportSettings, + settings.undeletePhraseSetSettings(), + clientContext); + this.undeletePhraseSetOperationCallable = + callableFactory.createOperationCallable( + undeletePhraseSetTransportSettings, + settings.undeletePhraseSetOperationSettings(), + clientContext, + httpJsonOperationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createRecognizerMethodDescriptor); + methodDescriptors.add(listRecognizersMethodDescriptor); + methodDescriptors.add(getRecognizerMethodDescriptor); + methodDescriptors.add(updateRecognizerMethodDescriptor); + methodDescriptors.add(deleteRecognizerMethodDescriptor); + methodDescriptors.add(undeleteRecognizerMethodDescriptor); + methodDescriptors.add(recognizeMethodDescriptor); + methodDescriptors.add(batchRecognizeMethodDescriptor); + methodDescriptors.add(getConfigMethodDescriptor); + methodDescriptors.add(updateConfigMethodDescriptor); + methodDescriptors.add(createCustomClassMethodDescriptor); + methodDescriptors.add(listCustomClassesMethodDescriptor); + methodDescriptors.add(getCustomClassMethodDescriptor); + methodDescriptors.add(updateCustomClassMethodDescriptor); + methodDescriptors.add(deleteCustomClassMethodDescriptor); + methodDescriptors.add(undeleteCustomClassMethodDescriptor); + methodDescriptors.add(createPhraseSetMethodDescriptor); + methodDescriptors.add(listPhraseSetsMethodDescriptor); + methodDescriptors.add(getPhraseSetMethodDescriptor); + methodDescriptors.add(updatePhraseSetMethodDescriptor); + methodDescriptors.add(deletePhraseSetMethodDescriptor); + methodDescriptors.add(undeletePhraseSetMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createRecognizerCallable() { + return createRecognizerCallable; + } + + @Override + public OperationCallable + createRecognizerOperationCallable() { + return createRecognizerOperationCallable; + } + + @Override + public UnaryCallable listRecognizersCallable() { + return listRecognizersCallable; + } + + @Override + public UnaryCallable + listRecognizersPagedCallable() { + return listRecognizersPagedCallable; + } + + @Override + public UnaryCallable getRecognizerCallable() { + return getRecognizerCallable; + } + + @Override + public UnaryCallable updateRecognizerCallable() { + return updateRecognizerCallable; + } + + @Override + public OperationCallable + updateRecognizerOperationCallable() { + return updateRecognizerOperationCallable; + } + + @Override + public UnaryCallable deleteRecognizerCallable() { + return deleteRecognizerCallable; + } + + @Override + public OperationCallable + deleteRecognizerOperationCallable() { + return deleteRecognizerOperationCallable; + } + + @Override + public UnaryCallable undeleteRecognizerCallable() { + return undeleteRecognizerCallable; + } + + @Override + public OperationCallable + undeleteRecognizerOperationCallable() { + return undeleteRecognizerOperationCallable; + } + + @Override + public UnaryCallable recognizeCallable() { + return recognizeCallable; + } + + @Override + public UnaryCallable batchRecognizeCallable() { + return batchRecognizeCallable; + } + + @Override + public OperationCallable + batchRecognizeOperationCallable() { + return batchRecognizeOperationCallable; + } + + @Override + public UnaryCallable getConfigCallable() { + return getConfigCallable; + } + + @Override + public UnaryCallable updateConfigCallable() { + return updateConfigCallable; + } + + @Override + public UnaryCallable createCustomClassCallable() { + return createCustomClassCallable; + } + + @Override + public OperationCallable + createCustomClassOperationCallable() { + return createCustomClassOperationCallable; + } + + @Override + public UnaryCallable + listCustomClassesCallable() { + return listCustomClassesCallable; + } + + @Override + public UnaryCallable + listCustomClassesPagedCallable() { + return listCustomClassesPagedCallable; + } + + @Override + public UnaryCallable getCustomClassCallable() { + return getCustomClassCallable; + } + + @Override + public UnaryCallable updateCustomClassCallable() { + return updateCustomClassCallable; + } + + @Override + public OperationCallable + updateCustomClassOperationCallable() { + return updateCustomClassOperationCallable; + } + + @Override + public UnaryCallable deleteCustomClassCallable() { + return deleteCustomClassCallable; + } + + @Override + public OperationCallable + deleteCustomClassOperationCallable() { + return deleteCustomClassOperationCallable; + } + + @Override + public UnaryCallable undeleteCustomClassCallable() { + return undeleteCustomClassCallable; + } + + @Override + public OperationCallable + undeleteCustomClassOperationCallable() { + return undeleteCustomClassOperationCallable; + } + + @Override + public UnaryCallable createPhraseSetCallable() { + return createPhraseSetCallable; + } + + @Override + public OperationCallable + createPhraseSetOperationCallable() { + return createPhraseSetOperationCallable; + } + + @Override + public UnaryCallable listPhraseSetsCallable() { + return listPhraseSetsCallable; + } + + @Override + public UnaryCallable + listPhraseSetsPagedCallable() { + return listPhraseSetsPagedCallable; + } + + @Override + public UnaryCallable getPhraseSetCallable() { + return getPhraseSetCallable; + } + + @Override + public UnaryCallable updatePhraseSetCallable() { + return updatePhraseSetCallable; + } + + @Override + public OperationCallable + updatePhraseSetOperationCallable() { + return updatePhraseSetOperationCallable; + } + + @Override + public UnaryCallable deletePhraseSetCallable() { + return deletePhraseSetCallable; + } + + @Override + public OperationCallable + deletePhraseSetOperationCallable() { + return deletePhraseSetOperationCallable; + } + + @Override + public UnaryCallable undeletePhraseSetCallable() { + return undeletePhraseSetCallable; + } + + @Override + public OperationCallable + undeletePhraseSetOperationCallable() { + return undeletePhraseSetOperationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStub.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStub.java new file mode 100644 index 000000000000..fb1916221063 --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStub.java @@ -0,0 +1,264 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.stub; + +import static com.google.cloud.speech.v2.SpeechClient.ListCustomClassesPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListPhraseSetsPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListRecognizersPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.speech.v2.BatchRecognizeRequest; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.CreateCustomClassRequest; +import com.google.cloud.speech.v2.CreatePhraseSetRequest; +import com.google.cloud.speech.v2.CreateRecognizerRequest; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.DeleteCustomClassRequest; +import com.google.cloud.speech.v2.DeletePhraseSetRequest; +import com.google.cloud.speech.v2.DeleteRecognizerRequest; +import com.google.cloud.speech.v2.GetConfigRequest; +import com.google.cloud.speech.v2.GetCustomClassRequest; +import com.google.cloud.speech.v2.GetPhraseSetRequest; +import com.google.cloud.speech.v2.GetRecognizerRequest; +import com.google.cloud.speech.v2.ListCustomClassesRequest; +import com.google.cloud.speech.v2.ListCustomClassesResponse; +import com.google.cloud.speech.v2.ListPhraseSetsRequest; +import com.google.cloud.speech.v2.ListPhraseSetsResponse; +import com.google.cloud.speech.v2.ListRecognizersRequest; +import com.google.cloud.speech.v2.ListRecognizersResponse; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.RecognizeRequest; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.StreamingRecognizeRequest; +import com.google.cloud.speech.v2.StreamingRecognizeResponse; +import com.google.cloud.speech.v2.UndeleteCustomClassRequest; +import com.google.cloud.speech.v2.UndeletePhraseSetRequest; +import com.google.cloud.speech.v2.UndeleteRecognizerRequest; +import com.google.cloud.speech.v2.UpdateConfigRequest; +import com.google.cloud.speech.v2.UpdateCustomClassRequest; +import com.google.cloud.speech.v2.UpdatePhraseSetRequest; +import com.google.cloud.speech.v2.UpdateRecognizerRequest; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Speech service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class SpeechStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public OperationCallable + createRecognizerOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createRecognizerOperationCallable()"); + } + + public UnaryCallable createRecognizerCallable() { + throw new UnsupportedOperationException("Not implemented: createRecognizerCallable()"); + } + + public UnaryCallable + listRecognizersPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listRecognizersPagedCallable()"); + } + + public UnaryCallable listRecognizersCallable() { + throw new UnsupportedOperationException("Not implemented: listRecognizersCallable()"); + } + + public UnaryCallable getRecognizerCallable() { + throw new UnsupportedOperationException("Not implemented: getRecognizerCallable()"); + } + + public OperationCallable + updateRecognizerOperationCallable() { + throw new UnsupportedOperationException("Not implemented: updateRecognizerOperationCallable()"); + } + + public UnaryCallable updateRecognizerCallable() { + throw new UnsupportedOperationException("Not implemented: updateRecognizerCallable()"); + } + + public OperationCallable + deleteRecognizerOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteRecognizerOperationCallable()"); + } + + public UnaryCallable deleteRecognizerCallable() { + throw new UnsupportedOperationException("Not implemented: deleteRecognizerCallable()"); + } + + public OperationCallable + undeleteRecognizerOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: undeleteRecognizerOperationCallable()"); + } + + public UnaryCallable undeleteRecognizerCallable() { + throw new UnsupportedOperationException("Not implemented: undeleteRecognizerCallable()"); + } + + public UnaryCallable recognizeCallable() { + throw new UnsupportedOperationException("Not implemented: recognizeCallable()"); + } + + public BidiStreamingCallable + streamingRecognizeCallable() { + throw new UnsupportedOperationException("Not implemented: streamingRecognizeCallable()"); + } + + public OperationCallable + batchRecognizeOperationCallable() { + throw new UnsupportedOperationException("Not implemented: batchRecognizeOperationCallable()"); + } + + public UnaryCallable batchRecognizeCallable() { + throw new UnsupportedOperationException("Not implemented: batchRecognizeCallable()"); + } + + public UnaryCallable getConfigCallable() { + throw new UnsupportedOperationException("Not implemented: getConfigCallable()"); + } + + public UnaryCallable updateConfigCallable() { + throw new UnsupportedOperationException("Not implemented: updateConfigCallable()"); + } + + public OperationCallable + createCustomClassOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: createCustomClassOperationCallable()"); + } + + public UnaryCallable createCustomClassCallable() { + throw new UnsupportedOperationException("Not implemented: createCustomClassCallable()"); + } + + public UnaryCallable + listCustomClassesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listCustomClassesPagedCallable()"); + } + + public UnaryCallable + listCustomClassesCallable() { + throw new UnsupportedOperationException("Not implemented: listCustomClassesCallable()"); + } + + public UnaryCallable getCustomClassCallable() { + throw new UnsupportedOperationException("Not implemented: getCustomClassCallable()"); + } + + public OperationCallable + updateCustomClassOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: updateCustomClassOperationCallable()"); + } + + public UnaryCallable updateCustomClassCallable() { + throw new UnsupportedOperationException("Not implemented: updateCustomClassCallable()"); + } + + public OperationCallable + deleteCustomClassOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteCustomClassOperationCallable()"); + } + + public UnaryCallable deleteCustomClassCallable() { + throw new UnsupportedOperationException("Not implemented: deleteCustomClassCallable()"); + } + + public OperationCallable + undeleteCustomClassOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: undeleteCustomClassOperationCallable()"); + } + + public UnaryCallable undeleteCustomClassCallable() { + throw new UnsupportedOperationException("Not implemented: undeleteCustomClassCallable()"); + } + + public OperationCallable + createPhraseSetOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createPhraseSetOperationCallable()"); + } + + public UnaryCallable createPhraseSetCallable() { + throw new UnsupportedOperationException("Not implemented: createPhraseSetCallable()"); + } + + public UnaryCallable + listPhraseSetsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listPhraseSetsPagedCallable()"); + } + + public UnaryCallable listPhraseSetsCallable() { + throw new UnsupportedOperationException("Not implemented: listPhraseSetsCallable()"); + } + + public UnaryCallable getPhraseSetCallable() { + throw new UnsupportedOperationException("Not implemented: getPhraseSetCallable()"); + } + + public OperationCallable + updatePhraseSetOperationCallable() { + throw new UnsupportedOperationException("Not implemented: updatePhraseSetOperationCallable()"); + } + + public UnaryCallable updatePhraseSetCallable() { + throw new UnsupportedOperationException("Not implemented: updatePhraseSetCallable()"); + } + + public OperationCallable + deletePhraseSetOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deletePhraseSetOperationCallable()"); + } + + public UnaryCallable deletePhraseSetCallable() { + throw new UnsupportedOperationException("Not implemented: deletePhraseSetCallable()"); + } + + public OperationCallable + undeletePhraseSetOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: undeletePhraseSetOperationCallable()"); + } + + public UnaryCallable undeletePhraseSetCallable() { + throw new UnsupportedOperationException("Not implemented: undeletePhraseSetCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStubSettings.java b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStubSettings.java new file mode 100644 index 000000000000..18a055d2b0ce --- /dev/null +++ b/java-speech/google-cloud-speech/src/main/java/com/google/cloud/speech/v2/stub/SpeechStubSettings.java @@ -0,0 +1,1681 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.stub; + +import static com.google.cloud.speech.v2.SpeechClient.ListCustomClassesPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListPhraseSetsPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListRecognizersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.speech.v2.BatchRecognizeRequest; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.CreateCustomClassRequest; +import com.google.cloud.speech.v2.CreatePhraseSetRequest; +import com.google.cloud.speech.v2.CreateRecognizerRequest; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.DeleteCustomClassRequest; +import com.google.cloud.speech.v2.DeletePhraseSetRequest; +import com.google.cloud.speech.v2.DeleteRecognizerRequest; +import com.google.cloud.speech.v2.GetConfigRequest; +import com.google.cloud.speech.v2.GetCustomClassRequest; +import com.google.cloud.speech.v2.GetPhraseSetRequest; +import com.google.cloud.speech.v2.GetRecognizerRequest; +import com.google.cloud.speech.v2.ListCustomClassesRequest; +import com.google.cloud.speech.v2.ListCustomClassesResponse; +import com.google.cloud.speech.v2.ListPhraseSetsRequest; +import com.google.cloud.speech.v2.ListPhraseSetsResponse; +import com.google.cloud.speech.v2.ListRecognizersRequest; +import com.google.cloud.speech.v2.ListRecognizersResponse; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.RecognizeRequest; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.StreamingRecognizeRequest; +import com.google.cloud.speech.v2.StreamingRecognizeResponse; +import com.google.cloud.speech.v2.UndeleteCustomClassRequest; +import com.google.cloud.speech.v2.UndeletePhraseSetRequest; +import com.google.cloud.speech.v2.UndeleteRecognizerRequest; +import com.google.cloud.speech.v2.UpdateConfigRequest; +import com.google.cloud.speech.v2.UpdateCustomClassRequest; +import com.google.cloud.speech.v2.UpdatePhraseSetRequest; +import com.google.cloud.speech.v2.UpdateRecognizerRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link SpeechStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (speech.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getRecognizer to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SpeechStubSettings.Builder speechSettingsBuilder = SpeechStubSettings.newBuilder();
+ * speechSettingsBuilder
+ *     .getRecognizerSettings()
+ *     .setRetrySettings(
+ *         speechSettingsBuilder.getRecognizerSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * SpeechStubSettings speechSettings = speechSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class SpeechStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings createRecognizerSettings; + private final OperationCallSettings + createRecognizerOperationSettings; + private final PagedCallSettings< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse> + listRecognizersSettings; + private final UnaryCallSettings getRecognizerSettings; + private final UnaryCallSettings updateRecognizerSettings; + private final OperationCallSettings + updateRecognizerOperationSettings; + private final UnaryCallSettings deleteRecognizerSettings; + private final OperationCallSettings + deleteRecognizerOperationSettings; + private final UnaryCallSettings undeleteRecognizerSettings; + private final OperationCallSettings + undeleteRecognizerOperationSettings; + private final UnaryCallSettings recognizeSettings; + private final StreamingCallSettings + streamingRecognizeSettings; + private final UnaryCallSettings batchRecognizeSettings; + private final OperationCallSettings< + BatchRecognizeRequest, BatchRecognizeResponse, OperationMetadata> + batchRecognizeOperationSettings; + private final UnaryCallSettings getConfigSettings; + private final UnaryCallSettings updateConfigSettings; + private final UnaryCallSettings createCustomClassSettings; + private final OperationCallSettings + createCustomClassOperationSettings; + private final PagedCallSettings< + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> + listCustomClassesSettings; + private final UnaryCallSettings getCustomClassSettings; + private final UnaryCallSettings updateCustomClassSettings; + private final OperationCallSettings + updateCustomClassOperationSettings; + private final UnaryCallSettings deleteCustomClassSettings; + private final OperationCallSettings + deleteCustomClassOperationSettings; + private final UnaryCallSettings + undeleteCustomClassSettings; + private final OperationCallSettings + undeleteCustomClassOperationSettings; + private final UnaryCallSettings createPhraseSetSettings; + private final OperationCallSettings + createPhraseSetOperationSettings; + private final PagedCallSettings< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse> + listPhraseSetsSettings; + private final UnaryCallSettings getPhraseSetSettings; + private final UnaryCallSettings updatePhraseSetSettings; + private final OperationCallSettings + updatePhraseSetOperationSettings; + private final UnaryCallSettings deletePhraseSetSettings; + private final OperationCallSettings + deletePhraseSetOperationSettings; + private final UnaryCallSettings undeletePhraseSetSettings; + private final OperationCallSettings + undeletePhraseSetOperationSettings; + + private static final PagedListDescriptor< + ListRecognizersRequest, ListRecognizersResponse, Recognizer> + LIST_RECOGNIZERS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListRecognizersRequest injectToken( + ListRecognizersRequest payload, String token) { + return ListRecognizersRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListRecognizersRequest injectPageSize( + ListRecognizersRequest payload, int pageSize) { + return ListRecognizersRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListRecognizersRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListRecognizersResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListRecognizersResponse payload) { + return payload.getRecognizersList() == null + ? ImmutableList.of() + : payload.getRecognizersList(); + } + }; + + private static final PagedListDescriptor< + ListCustomClassesRequest, ListCustomClassesResponse, CustomClass> + LIST_CUSTOM_CLASSES_PAGE_STR_DESC = + new PagedListDescriptor< + ListCustomClassesRequest, ListCustomClassesResponse, CustomClass>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListCustomClassesRequest injectToken( + ListCustomClassesRequest payload, String token) { + return ListCustomClassesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListCustomClassesRequest injectPageSize( + ListCustomClassesRequest payload, int pageSize) { + return ListCustomClassesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListCustomClassesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListCustomClassesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListCustomClassesResponse payload) { + return payload.getCustomClassesList() == null + ? ImmutableList.of() + : payload.getCustomClassesList(); + } + }; + + private static final PagedListDescriptor + LIST_PHRASE_SETS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListPhraseSetsRequest injectToken(ListPhraseSetsRequest payload, String token) { + return ListPhraseSetsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListPhraseSetsRequest injectPageSize( + ListPhraseSetsRequest payload, int pageSize) { + return ListPhraseSetsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListPhraseSetsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListPhraseSetsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListPhraseSetsResponse payload) { + return payload.getPhraseSetsList() == null + ? ImmutableList.of() + : payload.getPhraseSetsList(); + } + }; + + private static final PagedListResponseFactory< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse> + LIST_RECOGNIZERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListRecognizersRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_RECOGNIZERS_PAGE_STR_DESC, request, context); + return ListRecognizersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> + LIST_CUSTOM_CLASSES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListCustomClassesRequest, + ListCustomClassesResponse, + ListCustomClassesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListCustomClassesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_CUSTOM_CLASSES_PAGE_STR_DESC, request, context); + return ListCustomClassesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse> + LIST_PHRASE_SETS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListPhraseSetsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_PHRASE_SETS_PAGE_STR_DESC, request, context); + return ListPhraseSetsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createRecognizer. */ + public UnaryCallSettings createRecognizerSettings() { + return createRecognizerSettings; + } + + /** Returns the object with the settings used for calls to createRecognizer. */ + public OperationCallSettings + createRecognizerOperationSettings() { + return createRecognizerOperationSettings; + } + + /** Returns the object with the settings used for calls to listRecognizers. */ + public PagedCallSettings< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse> + listRecognizersSettings() { + return listRecognizersSettings; + } + + /** Returns the object with the settings used for calls to getRecognizer. */ + public UnaryCallSettings getRecognizerSettings() { + return getRecognizerSettings; + } + + /** Returns the object with the settings used for calls to updateRecognizer. */ + public UnaryCallSettings updateRecognizerSettings() { + return updateRecognizerSettings; + } + + /** Returns the object with the settings used for calls to updateRecognizer. */ + public OperationCallSettings + updateRecognizerOperationSettings() { + return updateRecognizerOperationSettings; + } + + /** Returns the object with the settings used for calls to deleteRecognizer. */ + public UnaryCallSettings deleteRecognizerSettings() { + return deleteRecognizerSettings; + } + + /** Returns the object with the settings used for calls to deleteRecognizer. */ + public OperationCallSettings + deleteRecognizerOperationSettings() { + return deleteRecognizerOperationSettings; + } + + /** Returns the object with the settings used for calls to undeleteRecognizer. */ + public UnaryCallSettings undeleteRecognizerSettings() { + return undeleteRecognizerSettings; + } + + /** Returns the object with the settings used for calls to undeleteRecognizer. */ + public OperationCallSettings + undeleteRecognizerOperationSettings() { + return undeleteRecognizerOperationSettings; + } + + /** Returns the object with the settings used for calls to recognize. */ + public UnaryCallSettings recognizeSettings() { + return recognizeSettings; + } + + /** Returns the object with the settings used for calls to streamingRecognize. */ + public StreamingCallSettings + streamingRecognizeSettings() { + return streamingRecognizeSettings; + } + + /** Returns the object with the settings used for calls to batchRecognize. */ + public UnaryCallSettings batchRecognizeSettings() { + return batchRecognizeSettings; + } + + /** Returns the object with the settings used for calls to batchRecognize. */ + public OperationCallSettings + batchRecognizeOperationSettings() { + return batchRecognizeOperationSettings; + } + + /** Returns the object with the settings used for calls to getConfig. */ + public UnaryCallSettings getConfigSettings() { + return getConfigSettings; + } + + /** Returns the object with the settings used for calls to updateConfig. */ + public UnaryCallSettings updateConfigSettings() { + return updateConfigSettings; + } + + /** Returns the object with the settings used for calls to createCustomClass. */ + public UnaryCallSettings createCustomClassSettings() { + return createCustomClassSettings; + } + + /** Returns the object with the settings used for calls to createCustomClass. */ + public OperationCallSettings + createCustomClassOperationSettings() { + return createCustomClassOperationSettings; + } + + /** Returns the object with the settings used for calls to listCustomClasses. */ + public PagedCallSettings< + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> + listCustomClassesSettings() { + return listCustomClassesSettings; + } + + /** Returns the object with the settings used for calls to getCustomClass. */ + public UnaryCallSettings getCustomClassSettings() { + return getCustomClassSettings; + } + + /** Returns the object with the settings used for calls to updateCustomClass. */ + public UnaryCallSettings updateCustomClassSettings() { + return updateCustomClassSettings; + } + + /** Returns the object with the settings used for calls to updateCustomClass. */ + public OperationCallSettings + updateCustomClassOperationSettings() { + return updateCustomClassOperationSettings; + } + + /** Returns the object with the settings used for calls to deleteCustomClass. */ + public UnaryCallSettings deleteCustomClassSettings() { + return deleteCustomClassSettings; + } + + /** Returns the object with the settings used for calls to deleteCustomClass. */ + public OperationCallSettings + deleteCustomClassOperationSettings() { + return deleteCustomClassOperationSettings; + } + + /** Returns the object with the settings used for calls to undeleteCustomClass. */ + public UnaryCallSettings undeleteCustomClassSettings() { + return undeleteCustomClassSettings; + } + + /** Returns the object with the settings used for calls to undeleteCustomClass. */ + public OperationCallSettings + undeleteCustomClassOperationSettings() { + return undeleteCustomClassOperationSettings; + } + + /** Returns the object with the settings used for calls to createPhraseSet. */ + public UnaryCallSettings createPhraseSetSettings() { + return createPhraseSetSettings; + } + + /** Returns the object with the settings used for calls to createPhraseSet. */ + public OperationCallSettings + createPhraseSetOperationSettings() { + return createPhraseSetOperationSettings; + } + + /** Returns the object with the settings used for calls to listPhraseSets. */ + public PagedCallSettings< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse> + listPhraseSetsSettings() { + return listPhraseSetsSettings; + } + + /** Returns the object with the settings used for calls to getPhraseSet. */ + public UnaryCallSettings getPhraseSetSettings() { + return getPhraseSetSettings; + } + + /** Returns the object with the settings used for calls to updatePhraseSet. */ + public UnaryCallSettings updatePhraseSetSettings() { + return updatePhraseSetSettings; + } + + /** Returns the object with the settings used for calls to updatePhraseSet. */ + public OperationCallSettings + updatePhraseSetOperationSettings() { + return updatePhraseSetOperationSettings; + } + + /** Returns the object with the settings used for calls to deletePhraseSet. */ + public UnaryCallSettings deletePhraseSetSettings() { + return deletePhraseSetSettings; + } + + /** Returns the object with the settings used for calls to deletePhraseSet. */ + public OperationCallSettings + deletePhraseSetOperationSettings() { + return deletePhraseSetOperationSettings; + } + + /** Returns the object with the settings used for calls to undeletePhraseSet. */ + public UnaryCallSettings undeletePhraseSetSettings() { + return undeletePhraseSetSettings; + } + + /** Returns the object with the settings used for calls to undeletePhraseSet. */ + public OperationCallSettings + undeletePhraseSetOperationSettings() { + return undeletePhraseSetOperationSettings; + } + + public SpeechStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcSpeechStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSpeechStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "speech.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "speech.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(SpeechStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(SpeechStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SpeechStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SpeechStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createRecognizerSettings = settingsBuilder.createRecognizerSettings().build(); + createRecognizerOperationSettings = settingsBuilder.createRecognizerOperationSettings().build(); + listRecognizersSettings = settingsBuilder.listRecognizersSettings().build(); + getRecognizerSettings = settingsBuilder.getRecognizerSettings().build(); + updateRecognizerSettings = settingsBuilder.updateRecognizerSettings().build(); + updateRecognizerOperationSettings = settingsBuilder.updateRecognizerOperationSettings().build(); + deleteRecognizerSettings = settingsBuilder.deleteRecognizerSettings().build(); + deleteRecognizerOperationSettings = settingsBuilder.deleteRecognizerOperationSettings().build(); + undeleteRecognizerSettings = settingsBuilder.undeleteRecognizerSettings().build(); + undeleteRecognizerOperationSettings = + settingsBuilder.undeleteRecognizerOperationSettings().build(); + recognizeSettings = settingsBuilder.recognizeSettings().build(); + streamingRecognizeSettings = settingsBuilder.streamingRecognizeSettings().build(); + batchRecognizeSettings = settingsBuilder.batchRecognizeSettings().build(); + batchRecognizeOperationSettings = settingsBuilder.batchRecognizeOperationSettings().build(); + getConfigSettings = settingsBuilder.getConfigSettings().build(); + updateConfigSettings = settingsBuilder.updateConfigSettings().build(); + createCustomClassSettings = settingsBuilder.createCustomClassSettings().build(); + createCustomClassOperationSettings = + settingsBuilder.createCustomClassOperationSettings().build(); + listCustomClassesSettings = settingsBuilder.listCustomClassesSettings().build(); + getCustomClassSettings = settingsBuilder.getCustomClassSettings().build(); + updateCustomClassSettings = settingsBuilder.updateCustomClassSettings().build(); + updateCustomClassOperationSettings = + settingsBuilder.updateCustomClassOperationSettings().build(); + deleteCustomClassSettings = settingsBuilder.deleteCustomClassSettings().build(); + deleteCustomClassOperationSettings = + settingsBuilder.deleteCustomClassOperationSettings().build(); + undeleteCustomClassSettings = settingsBuilder.undeleteCustomClassSettings().build(); + undeleteCustomClassOperationSettings = + settingsBuilder.undeleteCustomClassOperationSettings().build(); + createPhraseSetSettings = settingsBuilder.createPhraseSetSettings().build(); + createPhraseSetOperationSettings = settingsBuilder.createPhraseSetOperationSettings().build(); + listPhraseSetsSettings = settingsBuilder.listPhraseSetsSettings().build(); + getPhraseSetSettings = settingsBuilder.getPhraseSetSettings().build(); + updatePhraseSetSettings = settingsBuilder.updatePhraseSetSettings().build(); + updatePhraseSetOperationSettings = settingsBuilder.updatePhraseSetOperationSettings().build(); + deletePhraseSetSettings = settingsBuilder.deletePhraseSetSettings().build(); + deletePhraseSetOperationSettings = settingsBuilder.deletePhraseSetOperationSettings().build(); + undeletePhraseSetSettings = settingsBuilder.undeletePhraseSetSettings().build(); + undeletePhraseSetOperationSettings = + settingsBuilder.undeletePhraseSetOperationSettings().build(); + } + + /** Builder for SpeechStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + createRecognizerSettings; + private final OperationCallSettings.Builder< + CreateRecognizerRequest, Recognizer, OperationMetadata> + createRecognizerOperationSettings; + private final PagedCallSettings.Builder< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse> + listRecognizersSettings; + private final UnaryCallSettings.Builder getRecognizerSettings; + private final UnaryCallSettings.Builder + updateRecognizerSettings; + private final OperationCallSettings.Builder< + UpdateRecognizerRequest, Recognizer, OperationMetadata> + updateRecognizerOperationSettings; + private final UnaryCallSettings.Builder + deleteRecognizerSettings; + private final OperationCallSettings.Builder< + DeleteRecognizerRequest, Recognizer, OperationMetadata> + deleteRecognizerOperationSettings; + private final UnaryCallSettings.Builder + undeleteRecognizerSettings; + private final OperationCallSettings.Builder< + UndeleteRecognizerRequest, Recognizer, OperationMetadata> + undeleteRecognizerOperationSettings; + private final UnaryCallSettings.Builder recognizeSettings; + private final StreamingCallSettings.Builder< + StreamingRecognizeRequest, StreamingRecognizeResponse> + streamingRecognizeSettings; + private final UnaryCallSettings.Builder + batchRecognizeSettings; + private final OperationCallSettings.Builder< + BatchRecognizeRequest, BatchRecognizeResponse, OperationMetadata> + batchRecognizeOperationSettings; + private final UnaryCallSettings.Builder getConfigSettings; + private final UnaryCallSettings.Builder updateConfigSettings; + private final UnaryCallSettings.Builder + createCustomClassSettings; + private final OperationCallSettings.Builder< + CreateCustomClassRequest, CustomClass, OperationMetadata> + createCustomClassOperationSettings; + private final PagedCallSettings.Builder< + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> + listCustomClassesSettings; + private final UnaryCallSettings.Builder + getCustomClassSettings; + private final UnaryCallSettings.Builder + updateCustomClassSettings; + private final OperationCallSettings.Builder< + UpdateCustomClassRequest, CustomClass, OperationMetadata> + updateCustomClassOperationSettings; + private final UnaryCallSettings.Builder + deleteCustomClassSettings; + private final OperationCallSettings.Builder< + DeleteCustomClassRequest, CustomClass, OperationMetadata> + deleteCustomClassOperationSettings; + private final UnaryCallSettings.Builder + undeleteCustomClassSettings; + private final OperationCallSettings.Builder< + UndeleteCustomClassRequest, CustomClass, OperationMetadata> + undeleteCustomClassOperationSettings; + private final UnaryCallSettings.Builder + createPhraseSetSettings; + private final OperationCallSettings.Builder< + CreatePhraseSetRequest, PhraseSet, OperationMetadata> + createPhraseSetOperationSettings; + private final PagedCallSettings.Builder< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse> + listPhraseSetsSettings; + private final UnaryCallSettings.Builder getPhraseSetSettings; + private final UnaryCallSettings.Builder + updatePhraseSetSettings; + private final OperationCallSettings.Builder< + UpdatePhraseSetRequest, PhraseSet, OperationMetadata> + updatePhraseSetOperationSettings; + private final UnaryCallSettings.Builder + deletePhraseSetSettings; + private final OperationCallSettings.Builder< + DeletePhraseSetRequest, PhraseSet, OperationMetadata> + deletePhraseSetOperationSettings; + private final UnaryCallSettings.Builder + undeletePhraseSetSettings; + private final OperationCallSettings.Builder< + UndeletePhraseSetRequest, PhraseSet, OperationMetadata> + undeletePhraseSetOperationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(5000000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(5000000L)) + .setTotalTimeout(Duration.ofMillis(5000000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createRecognizerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createRecognizerOperationSettings = OperationCallSettings.newBuilder(); + listRecognizersSettings = PagedCallSettings.newBuilder(LIST_RECOGNIZERS_PAGE_STR_FACT); + getRecognizerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateRecognizerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateRecognizerOperationSettings = OperationCallSettings.newBuilder(); + deleteRecognizerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteRecognizerOperationSettings = OperationCallSettings.newBuilder(); + undeleteRecognizerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + undeleteRecognizerOperationSettings = OperationCallSettings.newBuilder(); + recognizeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + streamingRecognizeSettings = StreamingCallSettings.newBuilder(); + batchRecognizeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + batchRecognizeOperationSettings = OperationCallSettings.newBuilder(); + getConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createCustomClassSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createCustomClassOperationSettings = OperationCallSettings.newBuilder(); + listCustomClassesSettings = PagedCallSettings.newBuilder(LIST_CUSTOM_CLASSES_PAGE_STR_FACT); + getCustomClassSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateCustomClassSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateCustomClassOperationSettings = OperationCallSettings.newBuilder(); + deleteCustomClassSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteCustomClassOperationSettings = OperationCallSettings.newBuilder(); + undeleteCustomClassSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + undeleteCustomClassOperationSettings = OperationCallSettings.newBuilder(); + createPhraseSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createPhraseSetOperationSettings = OperationCallSettings.newBuilder(); + listPhraseSetsSettings = PagedCallSettings.newBuilder(LIST_PHRASE_SETS_PAGE_STR_FACT); + getPhraseSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updatePhraseSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updatePhraseSetOperationSettings = OperationCallSettings.newBuilder(); + deletePhraseSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deletePhraseSetOperationSettings = OperationCallSettings.newBuilder(); + undeletePhraseSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + undeletePhraseSetOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createRecognizerSettings, + listRecognizersSettings, + getRecognizerSettings, + updateRecognizerSettings, + deleteRecognizerSettings, + undeleteRecognizerSettings, + recognizeSettings, + batchRecognizeSettings, + getConfigSettings, + updateConfigSettings, + createCustomClassSettings, + listCustomClassesSettings, + getCustomClassSettings, + updateCustomClassSettings, + deleteCustomClassSettings, + undeleteCustomClassSettings, + createPhraseSetSettings, + listPhraseSetsSettings, + getPhraseSetSettings, + updatePhraseSetSettings, + deletePhraseSetSettings, + undeletePhraseSetSettings); + initDefaults(this); + } + + protected Builder(SpeechStubSettings settings) { + super(settings); + + createRecognizerSettings = settings.createRecognizerSettings.toBuilder(); + createRecognizerOperationSettings = settings.createRecognizerOperationSettings.toBuilder(); + listRecognizersSettings = settings.listRecognizersSettings.toBuilder(); + getRecognizerSettings = settings.getRecognizerSettings.toBuilder(); + updateRecognizerSettings = settings.updateRecognizerSettings.toBuilder(); + updateRecognizerOperationSettings = settings.updateRecognizerOperationSettings.toBuilder(); + deleteRecognizerSettings = settings.deleteRecognizerSettings.toBuilder(); + deleteRecognizerOperationSettings = settings.deleteRecognizerOperationSettings.toBuilder(); + undeleteRecognizerSettings = settings.undeleteRecognizerSettings.toBuilder(); + undeleteRecognizerOperationSettings = + settings.undeleteRecognizerOperationSettings.toBuilder(); + recognizeSettings = settings.recognizeSettings.toBuilder(); + streamingRecognizeSettings = settings.streamingRecognizeSettings.toBuilder(); + batchRecognizeSettings = settings.batchRecognizeSettings.toBuilder(); + batchRecognizeOperationSettings = settings.batchRecognizeOperationSettings.toBuilder(); + getConfigSettings = settings.getConfigSettings.toBuilder(); + updateConfigSettings = settings.updateConfigSettings.toBuilder(); + createCustomClassSettings = settings.createCustomClassSettings.toBuilder(); + createCustomClassOperationSettings = settings.createCustomClassOperationSettings.toBuilder(); + listCustomClassesSettings = settings.listCustomClassesSettings.toBuilder(); + getCustomClassSettings = settings.getCustomClassSettings.toBuilder(); + updateCustomClassSettings = settings.updateCustomClassSettings.toBuilder(); + updateCustomClassOperationSettings = settings.updateCustomClassOperationSettings.toBuilder(); + deleteCustomClassSettings = settings.deleteCustomClassSettings.toBuilder(); + deleteCustomClassOperationSettings = settings.deleteCustomClassOperationSettings.toBuilder(); + undeleteCustomClassSettings = settings.undeleteCustomClassSettings.toBuilder(); + undeleteCustomClassOperationSettings = + settings.undeleteCustomClassOperationSettings.toBuilder(); + createPhraseSetSettings = settings.createPhraseSetSettings.toBuilder(); + createPhraseSetOperationSettings = settings.createPhraseSetOperationSettings.toBuilder(); + listPhraseSetsSettings = settings.listPhraseSetsSettings.toBuilder(); + getPhraseSetSettings = settings.getPhraseSetSettings.toBuilder(); + updatePhraseSetSettings = settings.updatePhraseSetSettings.toBuilder(); + updatePhraseSetOperationSettings = settings.updatePhraseSetOperationSettings.toBuilder(); + deletePhraseSetSettings = settings.deletePhraseSetSettings.toBuilder(); + deletePhraseSetOperationSettings = settings.deletePhraseSetOperationSettings.toBuilder(); + undeletePhraseSetSettings = settings.undeletePhraseSetSettings.toBuilder(); + undeletePhraseSetOperationSettings = settings.undeletePhraseSetOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createRecognizerSettings, + listRecognizersSettings, + getRecognizerSettings, + updateRecognizerSettings, + deleteRecognizerSettings, + undeleteRecognizerSettings, + recognizeSettings, + batchRecognizeSettings, + getConfigSettings, + updateConfigSettings, + createCustomClassSettings, + listCustomClassesSettings, + getCustomClassSettings, + updateCustomClassSettings, + deleteCustomClassSettings, + undeleteCustomClassSettings, + createPhraseSetSettings, + listPhraseSetsSettings, + getPhraseSetSettings, + updatePhraseSetSettings, + deletePhraseSetSettings, + undeletePhraseSetSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createRecognizerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .listRecognizersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getRecognizerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateRecognizerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .deleteRecognizerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .undeleteRecognizerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .recognizeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .batchRecognizeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .createCustomClassSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .listCustomClassesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getCustomClassSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateCustomClassSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .deleteCustomClassSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .undeleteCustomClassSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .createPhraseSetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .listPhraseSetsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getPhraseSetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updatePhraseSetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .deletePhraseSetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .undeletePhraseSetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .createRecognizerOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Recognizer.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updateRecognizerOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Recognizer.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .deleteRecognizerOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Recognizer.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .undeleteRecognizerOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Recognizer.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .batchRecognizeOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(BatchRecognizeResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .createCustomClassOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(CustomClass.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updateCustomClassOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(CustomClass.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .deleteCustomClassOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(CustomClass.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .undeleteCustomClassOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(CustomClass.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .createPhraseSetOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(PhraseSet.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updatePhraseSetOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(PhraseSet.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .deletePhraseSetOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(PhraseSet.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .undeletePhraseSetOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(PhraseSet.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createRecognizer. */ + public UnaryCallSettings.Builder + createRecognizerSettings() { + return createRecognizerSettings; + } + + /** Returns the builder for the settings used for calls to createRecognizer. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createRecognizerOperationSettings() { + return createRecognizerOperationSettings; + } + + /** Returns the builder for the settings used for calls to listRecognizers. */ + public PagedCallSettings.Builder< + ListRecognizersRequest, ListRecognizersResponse, ListRecognizersPagedResponse> + listRecognizersSettings() { + return listRecognizersSettings; + } + + /** Returns the builder for the settings used for calls to getRecognizer. */ + public UnaryCallSettings.Builder getRecognizerSettings() { + return getRecognizerSettings; + } + + /** Returns the builder for the settings used for calls to updateRecognizer. */ + public UnaryCallSettings.Builder + updateRecognizerSettings() { + return updateRecognizerSettings; + } + + /** Returns the builder for the settings used for calls to updateRecognizer. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateRecognizerOperationSettings() { + return updateRecognizerOperationSettings; + } + + /** Returns the builder for the settings used for calls to deleteRecognizer. */ + public UnaryCallSettings.Builder + deleteRecognizerSettings() { + return deleteRecognizerSettings; + } + + /** Returns the builder for the settings used for calls to deleteRecognizer. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteRecognizerOperationSettings() { + return deleteRecognizerOperationSettings; + } + + /** Returns the builder for the settings used for calls to undeleteRecognizer. */ + public UnaryCallSettings.Builder + undeleteRecognizerSettings() { + return undeleteRecognizerSettings; + } + + /** Returns the builder for the settings used for calls to undeleteRecognizer. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + undeleteRecognizerOperationSettings() { + return undeleteRecognizerOperationSettings; + } + + /** Returns the builder for the settings used for calls to recognize. */ + public UnaryCallSettings.Builder recognizeSettings() { + return recognizeSettings; + } + + /** Returns the builder for the settings used for calls to streamingRecognize. */ + public StreamingCallSettings.Builder + streamingRecognizeSettings() { + return streamingRecognizeSettings; + } + + /** Returns the builder for the settings used for calls to batchRecognize. */ + public UnaryCallSettings.Builder batchRecognizeSettings() { + return batchRecognizeSettings; + } + + /** Returns the builder for the settings used for calls to batchRecognize. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + BatchRecognizeRequest, BatchRecognizeResponse, OperationMetadata> + batchRecognizeOperationSettings() { + return batchRecognizeOperationSettings; + } + + /** Returns the builder for the settings used for calls to getConfig. */ + public UnaryCallSettings.Builder getConfigSettings() { + return getConfigSettings; + } + + /** Returns the builder for the settings used for calls to updateConfig. */ + public UnaryCallSettings.Builder updateConfigSettings() { + return updateConfigSettings; + } + + /** Returns the builder for the settings used for calls to createCustomClass. */ + public UnaryCallSettings.Builder + createCustomClassSettings() { + return createCustomClassSettings; + } + + /** Returns the builder for the settings used for calls to createCustomClass. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createCustomClassOperationSettings() { + return createCustomClassOperationSettings; + } + + /** Returns the builder for the settings used for calls to listCustomClasses. */ + public PagedCallSettings.Builder< + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> + listCustomClassesSettings() { + return listCustomClassesSettings; + } + + /** Returns the builder for the settings used for calls to getCustomClass. */ + public UnaryCallSettings.Builder getCustomClassSettings() { + return getCustomClassSettings; + } + + /** Returns the builder for the settings used for calls to updateCustomClass. */ + public UnaryCallSettings.Builder + updateCustomClassSettings() { + return updateCustomClassSettings; + } + + /** Returns the builder for the settings used for calls to updateCustomClass. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateCustomClassOperationSettings() { + return updateCustomClassOperationSettings; + } + + /** Returns the builder for the settings used for calls to deleteCustomClass. */ + public UnaryCallSettings.Builder + deleteCustomClassSettings() { + return deleteCustomClassSettings; + } + + /** Returns the builder for the settings used for calls to deleteCustomClass. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteCustomClassOperationSettings() { + return deleteCustomClassOperationSettings; + } + + /** Returns the builder for the settings used for calls to undeleteCustomClass. */ + public UnaryCallSettings.Builder + undeleteCustomClassSettings() { + return undeleteCustomClassSettings; + } + + /** Returns the builder for the settings used for calls to undeleteCustomClass. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + undeleteCustomClassOperationSettings() { + return undeleteCustomClassOperationSettings; + } + + /** Returns the builder for the settings used for calls to createPhraseSet. */ + public UnaryCallSettings.Builder createPhraseSetSettings() { + return createPhraseSetSettings; + } + + /** Returns the builder for the settings used for calls to createPhraseSet. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createPhraseSetOperationSettings() { + return createPhraseSetOperationSettings; + } + + /** Returns the builder for the settings used for calls to listPhraseSets. */ + public PagedCallSettings.Builder< + ListPhraseSetsRequest, ListPhraseSetsResponse, ListPhraseSetsPagedResponse> + listPhraseSetsSettings() { + return listPhraseSetsSettings; + } + + /** Returns the builder for the settings used for calls to getPhraseSet. */ + public UnaryCallSettings.Builder getPhraseSetSettings() { + return getPhraseSetSettings; + } + + /** Returns the builder for the settings used for calls to updatePhraseSet. */ + public UnaryCallSettings.Builder updatePhraseSetSettings() { + return updatePhraseSetSettings; + } + + /** Returns the builder for the settings used for calls to updatePhraseSet. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updatePhraseSetOperationSettings() { + return updatePhraseSetOperationSettings; + } + + /** Returns the builder for the settings used for calls to deletePhraseSet. */ + public UnaryCallSettings.Builder deletePhraseSetSettings() { + return deletePhraseSetSettings; + } + + /** Returns the builder for the settings used for calls to deletePhraseSet. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deletePhraseSetOperationSettings() { + return deletePhraseSetOperationSettings; + } + + /** Returns the builder for the settings used for calls to undeletePhraseSet. */ + public UnaryCallSettings.Builder + undeletePhraseSetSettings() { + return undeletePhraseSetSettings; + } + + /** Returns the builder for the settings used for calls to undeletePhraseSet. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + undeletePhraseSetOperationSettings() { + return undeletePhraseSetOperationSettings; + } + + @Override + public SpeechStubSettings build() throws IOException { + return new SpeechStubSettings(this); + } + } +} diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeech.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeech.java new file mode 100644 index 000000000000..dca626adf7f2 --- /dev/null +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeech.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockSpeech implements MockGrpcService { + private final MockSpeechImpl serviceImpl; + + public MockSpeech() { + serviceImpl = new MockSpeechImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeechImpl.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeechImpl.java new file mode 100644 index 000000000000..b488625b70eb --- /dev/null +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/MockSpeechImpl.java @@ -0,0 +1,559 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.speech.v2.SpeechGrpc.SpeechImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockSpeechImpl extends SpeechImplBase { + private List requests; + private Queue responses; + + public MockSpeechImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createRecognizer( + CreateRecognizerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateRecognizer, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listRecognizers( + ListRecognizersRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListRecognizersResponse) { + requests.add(request); + responseObserver.onNext(((ListRecognizersResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListRecognizers, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListRecognizersResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getRecognizer( + GetRecognizerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Recognizer) { + requests.add(request); + responseObserver.onNext(((Recognizer) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetRecognizer, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Recognizer.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateRecognizer( + UpdateRecognizerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateRecognizer, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteRecognizer( + DeleteRecognizerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteRecognizer, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void undeleteRecognizer( + UndeleteRecognizerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UndeleteRecognizer, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void recognize( + RecognizeRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof RecognizeResponse) { + requests.add(request); + responseObserver.onNext(((RecognizeResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method Recognize, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + RecognizeResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public StreamObserver streamingRecognize( + final StreamObserver responseObserver) { + StreamObserver requestObserver = + new StreamObserver() { + @Override + public void onNext(StreamingRecognizeRequest value) { + requests.add(value); + final Object response = responses.remove(); + if (response instanceof StreamingRecognizeResponse) { + responseObserver.onNext(((StreamingRecognizeResponse) response)); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method StreamingRecognize, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + StreamingRecognizeResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void onError(Throwable t) { + responseObserver.onError(t); + } + + @Override + public void onCompleted() { + responseObserver.onCompleted(); + } + }; + return requestObserver; + } + + @Override + public void batchRecognize( + BatchRecognizeRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method BatchRecognize, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getConfig(GetConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Config) { + requests.add(request); + responseObserver.onNext(((Config) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Config.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateConfig(UpdateConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Config) { + requests.add(request); + responseObserver.onNext(((Config) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Config.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void createCustomClass( + CreateCustomClassRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateCustomClass, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listCustomClasses( + ListCustomClassesRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListCustomClassesResponse) { + requests.add(request); + responseObserver.onNext(((ListCustomClassesResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListCustomClasses, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListCustomClassesResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getCustomClass( + GetCustomClassRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof CustomClass) { + requests.add(request); + responseObserver.onNext(((CustomClass) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetCustomClass, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + CustomClass.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateCustomClass( + UpdateCustomClassRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateCustomClass, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteCustomClass( + DeleteCustomClassRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteCustomClass, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void undeleteCustomClass( + UndeleteCustomClassRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UndeleteCustomClass, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void createPhraseSet( + CreatePhraseSetRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreatePhraseSet, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listPhraseSets( + ListPhraseSetsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListPhraseSetsResponse) { + requests.add(request); + responseObserver.onNext(((ListPhraseSetsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListPhraseSets, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListPhraseSetsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getPhraseSet( + GetPhraseSetRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof PhraseSet) { + requests.add(request); + responseObserver.onNext(((PhraseSet) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetPhraseSet, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + PhraseSet.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updatePhraseSet( + UpdatePhraseSetRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdatePhraseSet, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deletePhraseSet( + DeletePhraseSetRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeletePhraseSet, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void undeletePhraseSet( + UndeletePhraseSetRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UndeletePhraseSet, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientHttpJsonTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientHttpJsonTest.java new file mode 100644 index 000000000000..89afc190fc4b --- /dev/null +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientHttpJsonTest.java @@ -0,0 +1,2635 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import static com.google.cloud.speech.v2.SpeechClient.ListCustomClassesPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListPhraseSetsPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListRecognizersPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.speech.v2.stub.HttpJsonSpeechStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SpeechClientHttpJsonTest { + private static MockHttpService mockService; + private static SpeechClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonSpeechStub.getMethodDescriptors(), SpeechSettings.getDefaultEndpoint()); + SpeechSettings settings = + SpeechSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + SpeechSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SpeechClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + + Recognizer actualResponse = + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createRecognizerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + + Recognizer actualResponse = + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createRecognizerExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listRecognizersTest() throws Exception { + Recognizer responsesElement = Recognizer.newBuilder().build(); + ListRecognizersResponse expectedResponse = + ListRecognizersResponse.newBuilder() + .setNextPageToken("") + .addAllRecognizers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRecognizersPagedResponse pagedListResponse = client.listRecognizers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRecognizersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRecognizersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listRecognizers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRecognizersTest2() throws Exception { + Recognizer responsesElement = Recognizer.newBuilder().build(); + ListRecognizersResponse expectedResponse = + ListRecognizersResponse.newBuilder() + .setNextPageToken("") + .addAllRecognizers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListRecognizersPagedResponse pagedListResponse = client.listRecognizers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRecognizersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listRecognizersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listRecognizers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockService.addResponse(expectedResponse); + + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + + Recognizer actualResponse = client.getRecognizer(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRecognizerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + client.getRecognizer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-4309/locations/location-4309/recognizers/recognizer-4309"; + + Recognizer actualResponse = client.getRecognizer(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getRecognizerExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4309/locations/location-4309/recognizers/recognizer-4309"; + client.getRecognizer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Recognizer recognizer = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Recognizer actualResponse = client.updateRecognizerAsync(recognizer, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateRecognizerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Recognizer recognizer = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRecognizerAsync(recognizer, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + + Recognizer actualResponse = client.deleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRecognizerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + client.deleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-4309/locations/location-4309/recognizers/recognizer-4309"; + + Recognizer actualResponse = client.deleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteRecognizerExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4309/locations/location-4309/recognizers/recognizer-4309"; + client.deleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeleteRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + + Recognizer actualResponse = client.undeleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeleteRecognizerExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + client.undeleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeleteRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-4309/locations/location-4309/recognizers/recognizer-4309"; + + Recognizer actualResponse = client.undeleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeleteRecognizerExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4309/locations/location-4309/recognizers/recognizer-4309"; + client.undeleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void recognizeTest() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, content); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void recognizeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + client.recognize(recognizer, config, configMask, content); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void recognizeTest2() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, uri); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void recognizeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + client.recognize(recognizer, config, configMask, uri); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void recognizeTest3() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String recognizer = "projects/project-2882/locations/location-2882/recognizers/recognizer-2882"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, content); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void recognizeExceptionTest3() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String recognizer = + "projects/project-2882/locations/location-2882/recognizers/recognizer-2882"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + client.recognize(recognizer, config, configMask, content); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void recognizeTest4() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String recognizer = "projects/project-2882/locations/location-2882/recognizers/recognizer-2882"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, uri); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void recognizeExceptionTest4() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String recognizer = + "projects/project-2882/locations/location-2882/recognizers/recognizer-2882"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + client.recognize(recognizer, config, configMask, uri); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void streamingRecognizeUnsupportedMethodTest() throws Exception { + // The streamingRecognize() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void batchRecognizeTest() throws Exception { + BatchRecognizeResponse expectedResponse = + BatchRecognizeResponse.newBuilder() + .putAllResults(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("batchRecognizeTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + + BatchRecognizeResponse actualResponse = + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void batchRecognizeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void batchRecognizeTest2() throws Exception { + BatchRecognizeResponse expectedResponse = + BatchRecognizeResponse.newBuilder() + .putAllResults(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("batchRecognizeTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String recognizer = "projects/project-2882/locations/location-2882/recognizers/recognizer-2882"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + + BatchRecognizeResponse actualResponse = + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void batchRecognizeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String recognizer = + "projects/project-2882/locations/location-2882/recognizers/recognizer-2882"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getConfigTest() throws Exception { + Config expectedResponse = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]"); + + Config actualResponse = client.getConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]"); + client.getConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConfigTest2() throws Exception { + Config expectedResponse = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-505/locations/location-505/config"; + + Config actualResponse = client.getConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-505/locations/location-505/config"; + client.getConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateConfigTest() throws Exception { + Config expectedResponse = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + Config config = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Config actualResponse = client.updateConfig(config, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Config config = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateConfig(config, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + + CustomClass actualResponse = + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createCustomClassExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + + CustomClass actualResponse = + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createCustomClassExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listCustomClassesTest() throws Exception { + CustomClass responsesElement = CustomClass.newBuilder().build(); + ListCustomClassesResponse expectedResponse = + ListCustomClassesResponse.newBuilder() + .setNextPageToken("") + .addAllCustomClasses(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCustomClassesPagedResponse pagedListResponse = client.listCustomClasses(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomClassesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listCustomClassesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listCustomClasses(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomClassesTest2() throws Exception { + CustomClass responsesElement = CustomClass.newBuilder().build(); + ListCustomClassesResponse expectedResponse = + ListCustomClassesResponse.newBuilder() + .setNextPageToken("") + .addAllCustomClasses(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListCustomClassesPagedResponse pagedListResponse = client.listCustomClasses(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomClassesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listCustomClassesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listCustomClasses(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockService.addResponse(expectedResponse); + + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + + CustomClass actualResponse = client.getCustomClass(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCustomClassExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + client.getCustomClass(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-4379/locations/location-4379/customClasses/customClasse-4379"; + + CustomClass actualResponse = client.getCustomClass(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCustomClassExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4379/locations/location-4379/customClasses/customClasse-4379"; + client.getCustomClass(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CustomClass customClass = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CustomClass actualResponse = client.updateCustomClassAsync(customClass, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCustomClassExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomClass customClass = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCustomClassAsync(customClass, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + + CustomClass actualResponse = client.deleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCustomClassExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + client.deleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-4379/locations/location-4379/customClasses/customClasse-4379"; + + CustomClass actualResponse = client.deleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCustomClassExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4379/locations/location-4379/customClasses/customClasse-4379"; + client.deleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeleteCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + + CustomClass actualResponse = client.undeleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeleteCustomClassExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + client.undeleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeleteCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-4379/locations/location-4379/customClasses/customClasse-4379"; + + CustomClass actualResponse = client.undeleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeleteCustomClassExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4379/locations/location-4379/customClasses/customClasse-4379"; + client.undeleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createPhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + + PhraseSet actualResponse = client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPhraseSetExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createPhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + + PhraseSet actualResponse = client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPhraseSetExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listPhraseSetsTest() throws Exception { + PhraseSet responsesElement = PhraseSet.newBuilder().build(); + ListPhraseSetsResponse expectedResponse = + ListPhraseSetsResponse.newBuilder() + .setNextPageToken("") + .addAllPhraseSets(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListPhraseSetsPagedResponse pagedListResponse = client.listPhraseSets(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPhraseSetsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPhraseSetsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listPhraseSets(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPhraseSetsTest2() throws Exception { + PhraseSet responsesElement = PhraseSet.newBuilder().build(); + ListPhraseSetsResponse expectedResponse = + ListPhraseSetsResponse.newBuilder() + .setNextPageToken("") + .addAllPhraseSets(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListPhraseSetsPagedResponse pagedListResponse = client.listPhraseSets(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPhraseSetsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPhraseSetsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listPhraseSets(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockService.addResponse(expectedResponse); + + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + + PhraseSet actualResponse = client.getPhraseSet(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPhraseSetExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + client.getPhraseSet(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-458/locations/location-458/phraseSets/phraseSet-458"; + + PhraseSet actualResponse = client.getPhraseSet(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPhraseSetExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-458/locations/location-458/phraseSets/phraseSet-458"; + client.getPhraseSet(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updatePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + PhraseSet phraseSet = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + PhraseSet actualResponse = client.updatePhraseSetAsync(phraseSet, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updatePhraseSetExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PhraseSet phraseSet = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updatePhraseSetAsync(phraseSet, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deletePhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + + PhraseSet actualResponse = client.deletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePhraseSetExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + client.deletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deletePhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-458/locations/location-458/phraseSets/phraseSet-458"; + + PhraseSet actualResponse = client.deletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePhraseSetExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-458/locations/location-458/phraseSets/phraseSet-458"; + client.deletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeletePhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + + PhraseSet actualResponse = client.undeletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeletePhraseSetExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + client.undeletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeletePhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-458/locations/location-458/phraseSets/phraseSet-458"; + + PhraseSet actualResponse = client.undeletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeletePhraseSetExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-458/locations/location-458/phraseSets/phraseSet-458"; + client.undeletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } +} diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientTest.java new file mode 100644 index 000000000000..12732b851c64 --- /dev/null +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v2/SpeechClientTest.java @@ -0,0 +1,2437 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import static com.google.cloud.speech.v2.SpeechClient.ListCustomClassesPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListPhraseSetsPagedResponse; +import static com.google.cloud.speech.v2.SpeechClient.ListRecognizersPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.grpc.testing.MockStreamObserver; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiStreamObserver; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +import com.google.protobuf.Duration; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SpeechClientTest { + private static MockServiceHelper mockServiceHelper; + private static MockSpeech mockSpeech; + private LocalChannelProvider channelProvider; + private SpeechClient client; + + @BeforeClass + public static void startStaticServer() { + mockSpeech = new MockSpeech(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockSpeech)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + SpeechSettings settings = + SpeechSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SpeechClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + + Recognizer actualResponse = + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateRecognizerRequest actualRequest = ((CreateRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(recognizer, actualRequest.getRecognizer()); + Assert.assertEquals(recognizerId, actualRequest.getRecognizerId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createRecognizerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String parent = "parent-995424086"; + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + + Recognizer actualResponse = + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateRecognizerRequest actualRequest = ((CreateRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(recognizer, actualRequest.getRecognizer()); + Assert.assertEquals(recognizerId, actualRequest.getRecognizerId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createRecognizerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String parent = "parent-995424086"; + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + client.createRecognizerAsync(parent, recognizer, recognizerId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listRecognizersTest() throws Exception { + Recognizer responsesElement = Recognizer.newBuilder().build(); + ListRecognizersResponse expectedResponse = + ListRecognizersResponse.newBuilder() + .setNextPageToken("") + .addAllRecognizers(Arrays.asList(responsesElement)) + .build(); + mockSpeech.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListRecognizersPagedResponse pagedListResponse = client.listRecognizers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRecognizersList().get(0), resources.get(0)); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListRecognizersRequest actualRequest = ((ListRecognizersRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listRecognizersExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listRecognizers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listRecognizersTest2() throws Exception { + Recognizer responsesElement = Recognizer.newBuilder().build(); + ListRecognizersResponse expectedResponse = + ListRecognizersResponse.newBuilder() + .setNextPageToken("") + .addAllRecognizers(Arrays.asList(responsesElement)) + .build(); + mockSpeech.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListRecognizersPagedResponse pagedListResponse = client.listRecognizers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRecognizersList().get(0), resources.get(0)); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListRecognizersRequest actualRequest = ((ListRecognizersRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listRecognizersExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String parent = "parent-995424086"; + client.listRecognizers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockSpeech.addResponse(expectedResponse); + + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + + Recognizer actualResponse = client.getRecognizer(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetRecognizerRequest actualRequest = ((GetRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getRecognizerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + client.getRecognizer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockSpeech.addResponse(expectedResponse); + + String name = "name3373707"; + + Recognizer actualResponse = client.getRecognizer(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetRecognizerRequest actualRequest = ((GetRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getRecognizerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.getRecognizer(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + Recognizer recognizer = Recognizer.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Recognizer actualResponse = client.updateRecognizerAsync(recognizer, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateRecognizerRequest actualRequest = ((UpdateRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(recognizer, actualRequest.getRecognizer()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateRecognizerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + Recognizer recognizer = Recognizer.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateRecognizerAsync(recognizer, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + + Recognizer actualResponse = client.deleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteRecognizerRequest actualRequest = ((DeleteRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteRecognizerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + client.deleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String name = "name3373707"; + + Recognizer actualResponse = client.deleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteRecognizerRequest actualRequest = ((DeleteRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteRecognizerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.deleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void undeleteRecognizerTest() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + + Recognizer actualResponse = client.undeleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UndeleteRecognizerRequest actualRequest = ((UndeleteRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void undeleteRecognizerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + client.undeleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void undeleteRecognizerTest2() throws Exception { + Recognizer expectedResponse = + Recognizer.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setModel("model104069929") + .addAllLanguageCodes(new ArrayList()) + .setDefaultRecognitionConfig(RecognitionConfig.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteRecognizerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String name = "name3373707"; + + Recognizer actualResponse = client.undeleteRecognizerAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UndeleteRecognizerRequest actualRequest = ((UndeleteRecognizerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void undeleteRecognizerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.undeleteRecognizerAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void recognizeTest() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, content); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RecognizeRequest actualRequest = ((RecognizeRequest) actualRequests.get(0)); + + Assert.assertEquals(recognizer.toString(), actualRequest.getRecognizer()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(configMask, actualRequest.getConfigMask()); + Assert.assertEquals(content, actualRequest.getContent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void recognizeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + client.recognize(recognizer, config, configMask, content); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void recognizeTest2() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, uri); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RecognizeRequest actualRequest = ((RecognizeRequest) actualRequests.get(0)); + + Assert.assertEquals(recognizer.toString(), actualRequest.getRecognizer()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(configMask, actualRequest.getConfigMask()); + Assert.assertEquals(uri, actualRequest.getUri()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void recognizeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + client.recognize(recognizer, config, configMask, uri); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void recognizeTest3() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + + String recognizer = "recognizer429853092"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, content); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RecognizeRequest actualRequest = ((RecognizeRequest) actualRequests.get(0)); + + Assert.assertEquals(recognizer, actualRequest.getRecognizer()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(configMask, actualRequest.getConfigMask()); + Assert.assertEquals(content, actualRequest.getContent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void recognizeExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String recognizer = "recognizer429853092"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + client.recognize(recognizer, config, configMask, content); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void recognizeTest4() throws Exception { + RecognizeResponse expectedResponse = + RecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + + String recognizer = "recognizer429853092"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + + RecognizeResponse actualResponse = client.recognize(recognizer, config, configMask, uri); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RecognizeRequest actualRequest = ((RecognizeRequest) actualRequests.get(0)); + + Assert.assertEquals(recognizer, actualRequest.getRecognizer()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(configMask, actualRequest.getConfigMask()); + Assert.assertEquals(uri, actualRequest.getUri()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void recognizeExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String recognizer = "recognizer429853092"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + client.recognize(recognizer, config, configMask, uri); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void streamingRecognizeTest() throws Exception { + StreamingRecognizeResponse expectedResponse = + StreamingRecognizeResponse.newBuilder() + .addAllResults(new ArrayList()) + .setSpeechEventOffset(Duration.newBuilder().build()) + .setMetadata(RecognitionResponseMetadata.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + StreamingRecognizeRequest request = + StreamingRecognizeRequest.newBuilder() + .setRecognizer(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingRecognizeCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + requestObserver.onCompleted(); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void streamingRecognizeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + StreamingRecognizeRequest request = + StreamingRecognizeRequest.newBuilder() + .setRecognizer(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingRecognizeCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void batchRecognizeTest() throws Exception { + BatchRecognizeResponse expectedResponse = + BatchRecognizeResponse.newBuilder() + .putAllResults(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("batchRecognizeTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + + BatchRecognizeResponse actualResponse = + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + BatchRecognizeRequest actualRequest = ((BatchRecognizeRequest) actualRequests.get(0)); + + Assert.assertEquals(recognizer.toString(), actualRequest.getRecognizer()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(configMask, actualRequest.getConfigMask()); + Assert.assertEquals(files, actualRequest.getFilesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void batchRecognizeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void batchRecognizeTest2() throws Exception { + BatchRecognizeResponse expectedResponse = + BatchRecognizeResponse.newBuilder() + .putAllResults(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("batchRecognizeTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String recognizer = "recognizer429853092"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + + BatchRecognizeResponse actualResponse = + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + BatchRecognizeRequest actualRequest = ((BatchRecognizeRequest) actualRequests.get(0)); + + Assert.assertEquals(recognizer, actualRequest.getRecognizer()); + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(configMask, actualRequest.getConfigMask()); + Assert.assertEquals(files, actualRequest.getFilesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void batchRecognizeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String recognizer = "recognizer429853092"; + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + client.batchRecognizeAsync(recognizer, config, configMask, files).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void getConfigTest() throws Exception { + Config expectedResponse = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + + ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]"); + + Config actualResponse = client.getConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetConfigRequest actualRequest = ((GetConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]"); + client.getConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConfigTest2() throws Exception { + Config expectedResponse = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + + String name = "name3373707"; + + Config actualResponse = client.getConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetConfigRequest actualRequest = ((GetConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.getConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateConfigTest() throws Exception { + Config expectedResponse = + Config.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setKmsKeyName("kmsKeyName412586233") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockSpeech.addResponse(expectedResponse); + + Config config = Config.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Config actualResponse = client.updateConfig(config, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateConfigRequest actualRequest = ((UpdateConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(config, actualRequest.getConfig()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + Config config = Config.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateConfig(config, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + + CustomClass actualResponse = + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateCustomClassRequest actualRequest = ((CreateCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(customClass, actualRequest.getCustomClass()); + Assert.assertEquals(customClassId, actualRequest.getCustomClassId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createCustomClassExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String parent = "parent-995424086"; + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + + CustomClass actualResponse = + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateCustomClassRequest actualRequest = ((CreateCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(customClass, actualRequest.getCustomClass()); + Assert.assertEquals(customClassId, actualRequest.getCustomClassId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createCustomClassExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String parent = "parent-995424086"; + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + client.createCustomClassAsync(parent, customClass, customClassId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listCustomClassesTest() throws Exception { + CustomClass responsesElement = CustomClass.newBuilder().build(); + ListCustomClassesResponse expectedResponse = + ListCustomClassesResponse.newBuilder() + .setNextPageToken("") + .addAllCustomClasses(Arrays.asList(responsesElement)) + .build(); + mockSpeech.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCustomClassesPagedResponse pagedListResponse = client.listCustomClasses(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomClassesList().get(0), resources.get(0)); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListCustomClassesRequest actualRequest = ((ListCustomClassesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listCustomClassesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listCustomClasses(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomClassesTest2() throws Exception { + CustomClass responsesElement = CustomClass.newBuilder().build(); + ListCustomClassesResponse expectedResponse = + ListCustomClassesResponse.newBuilder() + .setNextPageToken("") + .addAllCustomClasses(Arrays.asList(responsesElement)) + .build(); + mockSpeech.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListCustomClassesPagedResponse pagedListResponse = client.listCustomClasses(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomClassesList().get(0), resources.get(0)); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListCustomClassesRequest actualRequest = ((ListCustomClassesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listCustomClassesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String parent = "parent-995424086"; + client.listCustomClasses(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockSpeech.addResponse(expectedResponse); + + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + + CustomClass actualResponse = client.getCustomClass(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetCustomClassRequest actualRequest = ((GetCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getCustomClassExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + client.getCustomClass(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockSpeech.addResponse(expectedResponse); + + String name = "name3373707"; + + CustomClass actualResponse = client.getCustomClass(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetCustomClassRequest actualRequest = ((GetCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getCustomClassExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.getCustomClass(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + CustomClass customClass = CustomClass.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CustomClass actualResponse = client.updateCustomClassAsync(customClass, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateCustomClassRequest actualRequest = ((UpdateCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(customClass, actualRequest.getCustomClass()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateCustomClassExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + CustomClass customClass = CustomClass.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCustomClassAsync(customClass, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + + CustomClass actualResponse = client.deleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteCustomClassRequest actualRequest = ((DeleteCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteCustomClassExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + client.deleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String name = "name3373707"; + + CustomClass actualResponse = client.deleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteCustomClassRequest actualRequest = ((DeleteCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteCustomClassExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.deleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void undeleteCustomClassTest() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + + CustomClass actualResponse = client.undeleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UndeleteCustomClassRequest actualRequest = ((UndeleteCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void undeleteCustomClassExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + client.undeleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void undeleteCustomClassTest2() throws Exception { + CustomClass expectedResponse = + CustomClass.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .addAllItems(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteCustomClassTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String name = "name3373707"; + + CustomClass actualResponse = client.undeleteCustomClassAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UndeleteCustomClassRequest actualRequest = ((UndeleteCustomClassRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void undeleteCustomClassExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.undeleteCustomClassAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createPhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + + PhraseSet actualResponse = client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreatePhraseSetRequest actualRequest = ((CreatePhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(phraseSet, actualRequest.getPhraseSet()); + Assert.assertEquals(phraseSetId, actualRequest.getPhraseSetId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createPhraseSetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createPhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String parent = "parent-995424086"; + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + + PhraseSet actualResponse = client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreatePhraseSetRequest actualRequest = ((CreatePhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(phraseSet, actualRequest.getPhraseSet()); + Assert.assertEquals(phraseSetId, actualRequest.getPhraseSetId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createPhraseSetExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String parent = "parent-995424086"; + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + client.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listPhraseSetsTest() throws Exception { + PhraseSet responsesElement = PhraseSet.newBuilder().build(); + ListPhraseSetsResponse expectedResponse = + ListPhraseSetsResponse.newBuilder() + .setNextPageToken("") + .addAllPhraseSets(Arrays.asList(responsesElement)) + .build(); + mockSpeech.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListPhraseSetsPagedResponse pagedListResponse = client.listPhraseSets(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPhraseSetsList().get(0), resources.get(0)); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListPhraseSetsRequest actualRequest = ((ListPhraseSetsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listPhraseSetsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listPhraseSets(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPhraseSetsTest2() throws Exception { + PhraseSet responsesElement = PhraseSet.newBuilder().build(); + ListPhraseSetsResponse expectedResponse = + ListPhraseSetsResponse.newBuilder() + .setNextPageToken("") + .addAllPhraseSets(Arrays.asList(responsesElement)) + .build(); + mockSpeech.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListPhraseSetsPagedResponse pagedListResponse = client.listPhraseSets(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPhraseSetsList().get(0), resources.get(0)); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListPhraseSetsRequest actualRequest = ((ListPhraseSetsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listPhraseSetsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String parent = "parent-995424086"; + client.listPhraseSets(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockSpeech.addResponse(expectedResponse); + + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + + PhraseSet actualResponse = client.getPhraseSet(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetPhraseSetRequest actualRequest = ((GetPhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getPhraseSetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + client.getPhraseSet(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + mockSpeech.addResponse(expectedResponse); + + String name = "name3373707"; + + PhraseSet actualResponse = client.getPhraseSet(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetPhraseSetRequest actualRequest = ((GetPhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getPhraseSetExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.getPhraseSet(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updatePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + PhraseSet actualResponse = client.updatePhraseSetAsync(phraseSet, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdatePhraseSetRequest actualRequest = ((UpdatePhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(phraseSet, actualRequest.getPhraseSet()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updatePhraseSetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updatePhraseSetAsync(phraseSet, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deletePhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + + PhraseSet actualResponse = client.deletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeletePhraseSetRequest actualRequest = ((DeletePhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deletePhraseSetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + client.deletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deletePhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String name = "name3373707"; + + PhraseSet actualResponse = client.deletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeletePhraseSetRequest actualRequest = ((DeletePhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deletePhraseSetExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.deletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void undeletePhraseSetTest() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + + PhraseSet actualResponse = client.undeletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UndeletePhraseSetRequest actualRequest = ((UndeletePhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void undeletePhraseSetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + client.undeletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void undeletePhraseSetTest2() throws Exception { + PhraseSet expectedResponse = + PhraseSet.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setUid("uid115792") + .addAllPhrases(new ArrayList()) + .setBoost(93922211) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setReconciling(true) + .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyVersionName("kmsKeyVersionName-1798811307") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeletePhraseSetTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSpeech.addResponse(resultOperation); + + String name = "name3373707"; + + PhraseSet actualResponse = client.undeletePhraseSetAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSpeech.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UndeletePhraseSetRequest actualRequest = ((UndeletePhraseSetRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void undeletePhraseSetExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSpeech.addException(exception); + + try { + String name = "name3373707"; + client.undeletePhraseSetAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/java-speech/grpc-google-cloud-speech-v2/pom.xml b/java-speech/grpc-google-cloud-speech-v2/pom.xml new file mode 100644 index 000000000000..3481d4338a14 --- /dev/null +++ b/java-speech/grpc-google-cloud-speech-v2/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-speech-v2 + 2.5.5-SNAPSHOT + grpc-google-cloud-speech-v2 + GRPC library for google-cloud-speech + + com.google.cloud + google-cloud-speech-parent + 2.5.5-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-speech-v2 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/java-speech/grpc-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechGrpc.java b/java-speech/grpc-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechGrpc.java new file mode 100644 index 000000000000..f70343dfe149 --- /dev/null +++ b/java-speech/grpc-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechGrpc.java @@ -0,0 +1,2830 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.speech.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Enables speech transcription and resource management.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/speech/v2/cloud_speech.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class SpeechGrpc { + + private SpeechGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.speech.v2.Speech"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreateRecognizerRequest, com.google.longrunning.Operation> + getCreateRecognizerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateRecognizer", + requestType = com.google.cloud.speech.v2.CreateRecognizerRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreateRecognizerRequest, com.google.longrunning.Operation> + getCreateRecognizerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreateRecognizerRequest, com.google.longrunning.Operation> + getCreateRecognizerMethod; + if ((getCreateRecognizerMethod = SpeechGrpc.getCreateRecognizerMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getCreateRecognizerMethod = SpeechGrpc.getCreateRecognizerMethod) == null) { + SpeechGrpc.getCreateRecognizerMethod = + getCreateRecognizerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateRecognizer")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.CreateRecognizerRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("CreateRecognizer")) + .build(); + } + } + } + return getCreateRecognizerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListRecognizersRequest, + com.google.cloud.speech.v2.ListRecognizersResponse> + getListRecognizersMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListRecognizers", + requestType = com.google.cloud.speech.v2.ListRecognizersRequest.class, + responseType = com.google.cloud.speech.v2.ListRecognizersResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListRecognizersRequest, + com.google.cloud.speech.v2.ListRecognizersResponse> + getListRecognizersMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListRecognizersRequest, + com.google.cloud.speech.v2.ListRecognizersResponse> + getListRecognizersMethod; + if ((getListRecognizersMethod = SpeechGrpc.getListRecognizersMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getListRecognizersMethod = SpeechGrpc.getListRecognizersMethod) == null) { + SpeechGrpc.getListRecognizersMethod = + getListRecognizersMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListRecognizers")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.ListRecognizersRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.ListRecognizersResponse + .getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("ListRecognizers")) + .build(); + } + } + } + return getListRecognizersMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetRecognizerRequest, com.google.cloud.speech.v2.Recognizer> + getGetRecognizerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetRecognizer", + requestType = com.google.cloud.speech.v2.GetRecognizerRequest.class, + responseType = com.google.cloud.speech.v2.Recognizer.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetRecognizerRequest, com.google.cloud.speech.v2.Recognizer> + getGetRecognizerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetRecognizerRequest, com.google.cloud.speech.v2.Recognizer> + getGetRecognizerMethod; + if ((getGetRecognizerMethod = SpeechGrpc.getGetRecognizerMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getGetRecognizerMethod = SpeechGrpc.getGetRecognizerMethod) == null) { + SpeechGrpc.getGetRecognizerMethod = + getGetRecognizerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetRecognizer")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.GetRecognizerRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.Recognizer.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("GetRecognizer")) + .build(); + } + } + } + return getGetRecognizerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateRecognizerRequest, com.google.longrunning.Operation> + getUpdateRecognizerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateRecognizer", + requestType = com.google.cloud.speech.v2.UpdateRecognizerRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateRecognizerRequest, com.google.longrunning.Operation> + getUpdateRecognizerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateRecognizerRequest, com.google.longrunning.Operation> + getUpdateRecognizerMethod; + if ((getUpdateRecognizerMethod = SpeechGrpc.getUpdateRecognizerMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getUpdateRecognizerMethod = SpeechGrpc.getUpdateRecognizerMethod) == null) { + SpeechGrpc.getUpdateRecognizerMethod = + getUpdateRecognizerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateRecognizer")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.UpdateRecognizerRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("UpdateRecognizer")) + .build(); + } + } + } + return getUpdateRecognizerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeleteRecognizerRequest, com.google.longrunning.Operation> + getDeleteRecognizerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteRecognizer", + requestType = com.google.cloud.speech.v2.DeleteRecognizerRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeleteRecognizerRequest, com.google.longrunning.Operation> + getDeleteRecognizerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeleteRecognizerRequest, com.google.longrunning.Operation> + getDeleteRecognizerMethod; + if ((getDeleteRecognizerMethod = SpeechGrpc.getDeleteRecognizerMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getDeleteRecognizerMethod = SpeechGrpc.getDeleteRecognizerMethod) == null) { + SpeechGrpc.getDeleteRecognizerMethod = + getDeleteRecognizerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteRecognizer")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.DeleteRecognizerRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("DeleteRecognizer")) + .build(); + } + } + } + return getDeleteRecognizerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeleteRecognizerRequest, com.google.longrunning.Operation> + getUndeleteRecognizerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UndeleteRecognizer", + requestType = com.google.cloud.speech.v2.UndeleteRecognizerRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeleteRecognizerRequest, com.google.longrunning.Operation> + getUndeleteRecognizerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeleteRecognizerRequest, com.google.longrunning.Operation> + getUndeleteRecognizerMethod; + if ((getUndeleteRecognizerMethod = SpeechGrpc.getUndeleteRecognizerMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getUndeleteRecognizerMethod = SpeechGrpc.getUndeleteRecognizerMethod) == null) { + SpeechGrpc.getUndeleteRecognizerMethod = + getUndeleteRecognizerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UndeleteRecognizer")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.UndeleteRecognizerRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("UndeleteRecognizer")) + .build(); + } + } + } + return getUndeleteRecognizerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.RecognizeRequest, com.google.cloud.speech.v2.RecognizeResponse> + getRecognizeMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "Recognize", + requestType = com.google.cloud.speech.v2.RecognizeRequest.class, + responseType = com.google.cloud.speech.v2.RecognizeResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.RecognizeRequest, com.google.cloud.speech.v2.RecognizeResponse> + getRecognizeMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.RecognizeRequest, + com.google.cloud.speech.v2.RecognizeResponse> + getRecognizeMethod; + if ((getRecognizeMethod = SpeechGrpc.getRecognizeMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getRecognizeMethod = SpeechGrpc.getRecognizeMethod) == null) { + SpeechGrpc.getRecognizeMethod = + getRecognizeMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Recognize")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.RecognizeRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.RecognizeResponse.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("Recognize")) + .build(); + } + } + } + return getRecognizeMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.StreamingRecognizeRequest, + com.google.cloud.speech.v2.StreamingRecognizeResponse> + getStreamingRecognizeMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "StreamingRecognize", + requestType = com.google.cloud.speech.v2.StreamingRecognizeRequest.class, + responseType = com.google.cloud.speech.v2.StreamingRecognizeResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.StreamingRecognizeRequest, + com.google.cloud.speech.v2.StreamingRecognizeResponse> + getStreamingRecognizeMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.StreamingRecognizeRequest, + com.google.cloud.speech.v2.StreamingRecognizeResponse> + getStreamingRecognizeMethod; + if ((getStreamingRecognizeMethod = SpeechGrpc.getStreamingRecognizeMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getStreamingRecognizeMethod = SpeechGrpc.getStreamingRecognizeMethod) == null) { + SpeechGrpc.getStreamingRecognizeMethod = + getStreamingRecognizeMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingRecognize")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.StreamingRecognizeRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.StreamingRecognizeResponse + .getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("StreamingRecognize")) + .build(); + } + } + } + return getStreamingRecognizeMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.BatchRecognizeRequest, com.google.longrunning.Operation> + getBatchRecognizeMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "BatchRecognize", + requestType = com.google.cloud.speech.v2.BatchRecognizeRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.BatchRecognizeRequest, com.google.longrunning.Operation> + getBatchRecognizeMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.BatchRecognizeRequest, com.google.longrunning.Operation> + getBatchRecognizeMethod; + if ((getBatchRecognizeMethod = SpeechGrpc.getBatchRecognizeMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getBatchRecognizeMethod = SpeechGrpc.getBatchRecognizeMethod) == null) { + SpeechGrpc.getBatchRecognizeMethod = + getBatchRecognizeMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "BatchRecognize")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.BatchRecognizeRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("BatchRecognize")) + .build(); + } + } + } + return getBatchRecognizeMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetConfigRequest, com.google.cloud.speech.v2.Config> + getGetConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetConfig", + requestType = com.google.cloud.speech.v2.GetConfigRequest.class, + responseType = com.google.cloud.speech.v2.Config.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetConfigRequest, com.google.cloud.speech.v2.Config> + getGetConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetConfigRequest, com.google.cloud.speech.v2.Config> + getGetConfigMethod; + if ((getGetConfigMethod = SpeechGrpc.getGetConfigMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getGetConfigMethod = SpeechGrpc.getGetConfigMethod) == null) { + SpeechGrpc.getGetConfigMethod = + getGetConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.GetConfigRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.Config.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("GetConfig")) + .build(); + } + } + } + return getGetConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateConfigRequest, com.google.cloud.speech.v2.Config> + getUpdateConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateConfig", + requestType = com.google.cloud.speech.v2.UpdateConfigRequest.class, + responseType = com.google.cloud.speech.v2.Config.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateConfigRequest, com.google.cloud.speech.v2.Config> + getUpdateConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateConfigRequest, com.google.cloud.speech.v2.Config> + getUpdateConfigMethod; + if ((getUpdateConfigMethod = SpeechGrpc.getUpdateConfigMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getUpdateConfigMethod = SpeechGrpc.getUpdateConfigMethod) == null) { + SpeechGrpc.getUpdateConfigMethod = + getUpdateConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.Config.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("UpdateConfig")) + .build(); + } + } + } + return getUpdateConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreateCustomClassRequest, com.google.longrunning.Operation> + getCreateCustomClassMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateCustomClass", + requestType = com.google.cloud.speech.v2.CreateCustomClassRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreateCustomClassRequest, com.google.longrunning.Operation> + getCreateCustomClassMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreateCustomClassRequest, com.google.longrunning.Operation> + getCreateCustomClassMethod; + if ((getCreateCustomClassMethod = SpeechGrpc.getCreateCustomClassMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getCreateCustomClassMethod = SpeechGrpc.getCreateCustomClassMethod) == null) { + SpeechGrpc.getCreateCustomClassMethod = + getCreateCustomClassMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateCustomClass")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.CreateCustomClassRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("CreateCustomClass")) + .build(); + } + } + } + return getCreateCustomClassMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListCustomClassesRequest, + com.google.cloud.speech.v2.ListCustomClassesResponse> + getListCustomClassesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListCustomClasses", + requestType = com.google.cloud.speech.v2.ListCustomClassesRequest.class, + responseType = com.google.cloud.speech.v2.ListCustomClassesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListCustomClassesRequest, + com.google.cloud.speech.v2.ListCustomClassesResponse> + getListCustomClassesMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListCustomClassesRequest, + com.google.cloud.speech.v2.ListCustomClassesResponse> + getListCustomClassesMethod; + if ((getListCustomClassesMethod = SpeechGrpc.getListCustomClassesMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getListCustomClassesMethod = SpeechGrpc.getListCustomClassesMethod) == null) { + SpeechGrpc.getListCustomClassesMethod = + getListCustomClassesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListCustomClasses")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.ListCustomClassesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.ListCustomClassesResponse + .getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("ListCustomClasses")) + .build(); + } + } + } + return getListCustomClassesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetCustomClassRequest, com.google.cloud.speech.v2.CustomClass> + getGetCustomClassMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetCustomClass", + requestType = com.google.cloud.speech.v2.GetCustomClassRequest.class, + responseType = com.google.cloud.speech.v2.CustomClass.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetCustomClassRequest, com.google.cloud.speech.v2.CustomClass> + getGetCustomClassMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetCustomClassRequest, + com.google.cloud.speech.v2.CustomClass> + getGetCustomClassMethod; + if ((getGetCustomClassMethod = SpeechGrpc.getGetCustomClassMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getGetCustomClassMethod = SpeechGrpc.getGetCustomClassMethod) == null) { + SpeechGrpc.getGetCustomClassMethod = + getGetCustomClassMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetCustomClass")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.GetCustomClassRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.CustomClass.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("GetCustomClass")) + .build(); + } + } + } + return getGetCustomClassMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateCustomClassRequest, com.google.longrunning.Operation> + getUpdateCustomClassMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateCustomClass", + requestType = com.google.cloud.speech.v2.UpdateCustomClassRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateCustomClassRequest, com.google.longrunning.Operation> + getUpdateCustomClassMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdateCustomClassRequest, com.google.longrunning.Operation> + getUpdateCustomClassMethod; + if ((getUpdateCustomClassMethod = SpeechGrpc.getUpdateCustomClassMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getUpdateCustomClassMethod = SpeechGrpc.getUpdateCustomClassMethod) == null) { + SpeechGrpc.getUpdateCustomClassMethod = + getUpdateCustomClassMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateCustomClass")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.UpdateCustomClassRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("UpdateCustomClass")) + .build(); + } + } + } + return getUpdateCustomClassMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeleteCustomClassRequest, com.google.longrunning.Operation> + getDeleteCustomClassMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteCustomClass", + requestType = com.google.cloud.speech.v2.DeleteCustomClassRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeleteCustomClassRequest, com.google.longrunning.Operation> + getDeleteCustomClassMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeleteCustomClassRequest, com.google.longrunning.Operation> + getDeleteCustomClassMethod; + if ((getDeleteCustomClassMethod = SpeechGrpc.getDeleteCustomClassMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getDeleteCustomClassMethod = SpeechGrpc.getDeleteCustomClassMethod) == null) { + SpeechGrpc.getDeleteCustomClassMethod = + getDeleteCustomClassMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteCustomClass")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.DeleteCustomClassRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("DeleteCustomClass")) + .build(); + } + } + } + return getDeleteCustomClassMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeleteCustomClassRequest, com.google.longrunning.Operation> + getUndeleteCustomClassMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UndeleteCustomClass", + requestType = com.google.cloud.speech.v2.UndeleteCustomClassRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeleteCustomClassRequest, com.google.longrunning.Operation> + getUndeleteCustomClassMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeleteCustomClassRequest, com.google.longrunning.Operation> + getUndeleteCustomClassMethod; + if ((getUndeleteCustomClassMethod = SpeechGrpc.getUndeleteCustomClassMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getUndeleteCustomClassMethod = SpeechGrpc.getUndeleteCustomClassMethod) == null) { + SpeechGrpc.getUndeleteCustomClassMethod = + getUndeleteCustomClassMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UndeleteCustomClass")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.UndeleteCustomClassRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new SpeechMethodDescriptorSupplier("UndeleteCustomClass")) + .build(); + } + } + } + return getUndeleteCustomClassMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreatePhraseSetRequest, com.google.longrunning.Operation> + getCreatePhraseSetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreatePhraseSet", + requestType = com.google.cloud.speech.v2.CreatePhraseSetRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreatePhraseSetRequest, com.google.longrunning.Operation> + getCreatePhraseSetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.CreatePhraseSetRequest, com.google.longrunning.Operation> + getCreatePhraseSetMethod; + if ((getCreatePhraseSetMethod = SpeechGrpc.getCreatePhraseSetMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getCreatePhraseSetMethod = SpeechGrpc.getCreatePhraseSetMethod) == null) { + SpeechGrpc.getCreatePhraseSetMethod = + getCreatePhraseSetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreatePhraseSet")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.CreatePhraseSetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("CreatePhraseSet")) + .build(); + } + } + } + return getCreatePhraseSetMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListPhraseSetsRequest, + com.google.cloud.speech.v2.ListPhraseSetsResponse> + getListPhraseSetsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListPhraseSets", + requestType = com.google.cloud.speech.v2.ListPhraseSetsRequest.class, + responseType = com.google.cloud.speech.v2.ListPhraseSetsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListPhraseSetsRequest, + com.google.cloud.speech.v2.ListPhraseSetsResponse> + getListPhraseSetsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.ListPhraseSetsRequest, + com.google.cloud.speech.v2.ListPhraseSetsResponse> + getListPhraseSetsMethod; + if ((getListPhraseSetsMethod = SpeechGrpc.getListPhraseSetsMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getListPhraseSetsMethod = SpeechGrpc.getListPhraseSetsMethod) == null) { + SpeechGrpc.getListPhraseSetsMethod = + getListPhraseSetsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListPhraseSets")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.ListPhraseSetsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.ListPhraseSetsResponse + .getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("ListPhraseSets")) + .build(); + } + } + } + return getListPhraseSetsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetPhraseSetRequest, com.google.cloud.speech.v2.PhraseSet> + getGetPhraseSetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetPhraseSet", + requestType = com.google.cloud.speech.v2.GetPhraseSetRequest.class, + responseType = com.google.cloud.speech.v2.PhraseSet.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetPhraseSetRequest, com.google.cloud.speech.v2.PhraseSet> + getGetPhraseSetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.GetPhraseSetRequest, com.google.cloud.speech.v2.PhraseSet> + getGetPhraseSetMethod; + if ((getGetPhraseSetMethod = SpeechGrpc.getGetPhraseSetMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getGetPhraseSetMethod = SpeechGrpc.getGetPhraseSetMethod) == null) { + SpeechGrpc.getGetPhraseSetMethod = + getGetPhraseSetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetPhraseSet")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.GetPhraseSetRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.PhraseSet.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("GetPhraseSet")) + .build(); + } + } + } + return getGetPhraseSetMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdatePhraseSetRequest, com.google.longrunning.Operation> + getUpdatePhraseSetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdatePhraseSet", + requestType = com.google.cloud.speech.v2.UpdatePhraseSetRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdatePhraseSetRequest, com.google.longrunning.Operation> + getUpdatePhraseSetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UpdatePhraseSetRequest, com.google.longrunning.Operation> + getUpdatePhraseSetMethod; + if ((getUpdatePhraseSetMethod = SpeechGrpc.getUpdatePhraseSetMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getUpdatePhraseSetMethod = SpeechGrpc.getUpdatePhraseSetMethod) == null) { + SpeechGrpc.getUpdatePhraseSetMethod = + getUpdatePhraseSetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdatePhraseSet")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.UpdatePhraseSetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("UpdatePhraseSet")) + .build(); + } + } + } + return getUpdatePhraseSetMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeletePhraseSetRequest, com.google.longrunning.Operation> + getDeletePhraseSetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeletePhraseSet", + requestType = com.google.cloud.speech.v2.DeletePhraseSetRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeletePhraseSetRequest, com.google.longrunning.Operation> + getDeletePhraseSetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.DeletePhraseSetRequest, com.google.longrunning.Operation> + getDeletePhraseSetMethod; + if ((getDeletePhraseSetMethod = SpeechGrpc.getDeletePhraseSetMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getDeletePhraseSetMethod = SpeechGrpc.getDeletePhraseSetMethod) == null) { + SpeechGrpc.getDeletePhraseSetMethod = + getDeletePhraseSetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeletePhraseSet")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.DeletePhraseSetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("DeletePhraseSet")) + .build(); + } + } + } + return getDeletePhraseSetMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeletePhraseSetRequest, com.google.longrunning.Operation> + getUndeletePhraseSetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UndeletePhraseSet", + requestType = com.google.cloud.speech.v2.UndeletePhraseSetRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeletePhraseSetRequest, com.google.longrunning.Operation> + getUndeletePhraseSetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.speech.v2.UndeletePhraseSetRequest, com.google.longrunning.Operation> + getUndeletePhraseSetMethod; + if ((getUndeletePhraseSetMethod = SpeechGrpc.getUndeletePhraseSetMethod) == null) { + synchronized (SpeechGrpc.class) { + if ((getUndeletePhraseSetMethod = SpeechGrpc.getUndeletePhraseSetMethod) == null) { + SpeechGrpc.getUndeletePhraseSetMethod = + getUndeletePhraseSetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UndeletePhraseSet")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.speech.v2.UndeletePhraseSetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("UndeletePhraseSet")) + .build(); + } + } + } + return getUndeletePhraseSetMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static SpeechStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SpeechStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SpeechStub(channel, callOptions); + } + }; + return SpeechStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static SpeechBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SpeechBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SpeechBlockingStub(channel, callOptions); + } + }; + return SpeechBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static SpeechFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SpeechFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SpeechFutureStub(channel, callOptions); + } + }; + return SpeechFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Enables speech transcription and resource management.
+   * 
+ */ + public abstract static class SpeechImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void createRecognizer( + com.google.cloud.speech.v2.CreateRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateRecognizerMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists Recognizers.
+     * 
+ */ + public void listRecognizers( + com.google.cloud.speech.v2.ListRecognizersRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListRecognizersMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns the requested
+     * [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
+     * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't
+     * exist.
+     * 
+ */ + public void getRecognizer( + com.google.cloud.speech.v2.GetRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetRecognizerMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void updateRecognizer( + com.google.cloud.speech.v2.UpdateRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateRecognizerMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void deleteRecognizer( + com.google.cloud.speech.v2.DeleteRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteRecognizerMethod(), responseObserver); + } + + /** + * + * + *
+     * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void undeleteRecognizer( + com.google.cloud.speech.v2.UndeleteRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUndeleteRecognizerMethod(), responseObserver); + } + + /** + * + * + *
+     * Performs synchronous Speech recognition: receive results after all audio
+     * has been sent and processed.
+     * 
+ */ + public void recognize( + com.google.cloud.speech.v2.RecognizeRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRecognizeMethod(), responseObserver); + } + + /** + * + * + *
+     * Performs bidirectional streaming speech recognition: receive results while
+     * sending audio. This method is only available via the gRPC API (not REST).
+     * 
+ */ + public io.grpc.stub.StreamObserver + streamingRecognize( + io.grpc.stub.StreamObserver + responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall( + getStreamingRecognizeMethod(), responseObserver); + } + + /** + * + * + *
+     * Performs batch asynchronous speech recognition: send a request with N
+     * audio files and receive a long running operation that can be polled to see
+     * when the transcriptions are finished.
+     * 
+ */ + public void batchRecognize( + com.google.cloud.speech.v2.BatchRecognizeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getBatchRecognizeMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns the requested [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public void getConfig( + com.google.cloud.speech.v2.GetConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public void updateConfig( + com.google.cloud.speech.v2.UpdateConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void createCustomClass( + com.google.cloud.speech.v2.CreateCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateCustomClassMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists CustomClasses.
+     * 
+ */ + public void listCustomClasses( + com.google.cloud.speech.v2.ListCustomClassesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListCustomClassesMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns the requested
+     * [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void getCustomClass( + com.google.cloud.speech.v2.GetCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetCustomClassMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void updateCustomClass( + com.google.cloud.speech.v2.UpdateCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateCustomClassMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void deleteCustomClass( + com.google.cloud.speech.v2.DeleteCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteCustomClassMethod(), responseObserver); + } + + /** + * + * + *
+     * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void undeleteCustomClass( + com.google.cloud.speech.v2.UndeleteCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUndeleteCustomClassMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void createPhraseSet( + com.google.cloud.speech.v2.CreatePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreatePhraseSetMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists PhraseSets.
+     * 
+ */ + public void listPhraseSets( + com.google.cloud.speech.v2.ListPhraseSetsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListPhraseSetsMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns the requested
+     * [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void getPhraseSet( + com.google.cloud.speech.v2.GetPhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetPhraseSetMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void updatePhraseSet( + com.google.cloud.speech.v2.UpdatePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdatePhraseSetMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void deletePhraseSet( + com.google.cloud.speech.v2.DeletePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeletePhraseSetMethod(), responseObserver); + } + + /** + * + * + *
+     * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void undeletePhraseSet( + com.google.cloud.speech.v2.UndeletePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUndeletePhraseSetMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateRecognizerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.CreateRecognizerRequest, + com.google.longrunning.Operation>(this, METHODID_CREATE_RECOGNIZER))) + .addMethod( + getListRecognizersMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.ListRecognizersRequest, + com.google.cloud.speech.v2.ListRecognizersResponse>( + this, METHODID_LIST_RECOGNIZERS))) + .addMethod( + getGetRecognizerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.GetRecognizerRequest, + com.google.cloud.speech.v2.Recognizer>(this, METHODID_GET_RECOGNIZER))) + .addMethod( + getUpdateRecognizerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.UpdateRecognizerRequest, + com.google.longrunning.Operation>(this, METHODID_UPDATE_RECOGNIZER))) + .addMethod( + getDeleteRecognizerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.DeleteRecognizerRequest, + com.google.longrunning.Operation>(this, METHODID_DELETE_RECOGNIZER))) + .addMethod( + getUndeleteRecognizerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.UndeleteRecognizerRequest, + com.google.longrunning.Operation>(this, METHODID_UNDELETE_RECOGNIZER))) + .addMethod( + getRecognizeMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.RecognizeRequest, + com.google.cloud.speech.v2.RecognizeResponse>(this, METHODID_RECOGNIZE))) + .addMethod( + getStreamingRecognizeMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + com.google.cloud.speech.v2.StreamingRecognizeRequest, + com.google.cloud.speech.v2.StreamingRecognizeResponse>( + this, METHODID_STREAMING_RECOGNIZE))) + .addMethod( + getBatchRecognizeMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.BatchRecognizeRequest, + com.google.longrunning.Operation>(this, METHODID_BATCH_RECOGNIZE))) + .addMethod( + getGetConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.GetConfigRequest, + com.google.cloud.speech.v2.Config>(this, METHODID_GET_CONFIG))) + .addMethod( + getUpdateConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.UpdateConfigRequest, + com.google.cloud.speech.v2.Config>(this, METHODID_UPDATE_CONFIG))) + .addMethod( + getCreateCustomClassMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.CreateCustomClassRequest, + com.google.longrunning.Operation>(this, METHODID_CREATE_CUSTOM_CLASS))) + .addMethod( + getListCustomClassesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.ListCustomClassesRequest, + com.google.cloud.speech.v2.ListCustomClassesResponse>( + this, METHODID_LIST_CUSTOM_CLASSES))) + .addMethod( + getGetCustomClassMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.GetCustomClassRequest, + com.google.cloud.speech.v2.CustomClass>(this, METHODID_GET_CUSTOM_CLASS))) + .addMethod( + getUpdateCustomClassMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.UpdateCustomClassRequest, + com.google.longrunning.Operation>(this, METHODID_UPDATE_CUSTOM_CLASS))) + .addMethod( + getDeleteCustomClassMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.DeleteCustomClassRequest, + com.google.longrunning.Operation>(this, METHODID_DELETE_CUSTOM_CLASS))) + .addMethod( + getUndeleteCustomClassMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.UndeleteCustomClassRequest, + com.google.longrunning.Operation>(this, METHODID_UNDELETE_CUSTOM_CLASS))) + .addMethod( + getCreatePhraseSetMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.CreatePhraseSetRequest, + com.google.longrunning.Operation>(this, METHODID_CREATE_PHRASE_SET))) + .addMethod( + getListPhraseSetsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.ListPhraseSetsRequest, + com.google.cloud.speech.v2.ListPhraseSetsResponse>( + this, METHODID_LIST_PHRASE_SETS))) + .addMethod( + getGetPhraseSetMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.GetPhraseSetRequest, + com.google.cloud.speech.v2.PhraseSet>(this, METHODID_GET_PHRASE_SET))) + .addMethod( + getUpdatePhraseSetMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.UpdatePhraseSetRequest, + com.google.longrunning.Operation>(this, METHODID_UPDATE_PHRASE_SET))) + .addMethod( + getDeletePhraseSetMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.DeletePhraseSetRequest, + com.google.longrunning.Operation>(this, METHODID_DELETE_PHRASE_SET))) + .addMethod( + getUndeletePhraseSetMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.speech.v2.UndeletePhraseSetRequest, + com.google.longrunning.Operation>(this, METHODID_UNDELETE_PHRASE_SET))) + .build(); + } + } + + /** + * + * + *
+   * Enables speech transcription and resource management.
+   * 
+ */ + public static final class SpeechStub extends io.grpc.stub.AbstractAsyncStub { + private SpeechStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SpeechStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SpeechStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void createRecognizer( + com.google.cloud.speech.v2.CreateRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateRecognizerMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists Recognizers.
+     * 
+ */ + public void listRecognizers( + com.google.cloud.speech.v2.ListRecognizersRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListRecognizersMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns the requested
+     * [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
+     * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't
+     * exist.
+     * 
+ */ + public void getRecognizer( + com.google.cloud.speech.v2.GetRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetRecognizerMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void updateRecognizer( + com.google.cloud.speech.v2.UpdateRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateRecognizerMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void deleteRecognizer( + com.google.cloud.speech.v2.DeleteRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteRecognizerMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public void undeleteRecognizer( + com.google.cloud.speech.v2.UndeleteRecognizerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUndeleteRecognizerMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Performs synchronous Speech recognition: receive results after all audio
+     * has been sent and processed.
+     * 
+ */ + public void recognize( + com.google.cloud.speech.v2.RecognizeRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getRecognizeMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Performs bidirectional streaming speech recognition: receive results while
+     * sending audio. This method is only available via the gRPC API (not REST).
+     * 
+ */ + public io.grpc.stub.StreamObserver + streamingRecognize( + io.grpc.stub.StreamObserver + responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getStreamingRecognizeMethod(), getCallOptions()), responseObserver); + } + + /** + * + * + *
+     * Performs batch asynchronous speech recognition: send a request with N
+     * audio files and receive a long running operation that can be polled to see
+     * when the transcriptions are finished.
+     * 
+ */ + public void batchRecognize( + com.google.cloud.speech.v2.BatchRecognizeRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getBatchRecognizeMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns the requested [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public void getConfig( + com.google.cloud.speech.v2.GetConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetConfigMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Updates the [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public void updateConfig( + com.google.cloud.speech.v2.UpdateConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void createCustomClass( + com.google.cloud.speech.v2.CreateCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateCustomClassMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists CustomClasses.
+     * 
+ */ + public void listCustomClasses( + com.google.cloud.speech.v2.ListCustomClassesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListCustomClassesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns the requested
+     * [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void getCustomClass( + com.google.cloud.speech.v2.GetCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetCustomClassMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void updateCustomClass( + com.google.cloud.speech.v2.UpdateCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateCustomClassMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void deleteCustomClass( + com.google.cloud.speech.v2.DeleteCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteCustomClassMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public void undeleteCustomClass( + com.google.cloud.speech.v2.UndeleteCustomClassRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUndeleteCustomClassMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void createPhraseSet( + com.google.cloud.speech.v2.CreatePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreatePhraseSetMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists PhraseSets.
+     * 
+ */ + public void listPhraseSets( + com.google.cloud.speech.v2.ListPhraseSetsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListPhraseSetsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns the requested
+     * [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void getPhraseSet( + com.google.cloud.speech.v2.GetPhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetPhraseSetMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void updatePhraseSet( + com.google.cloud.speech.v2.UpdatePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdatePhraseSetMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void deletePhraseSet( + com.google.cloud.speech.v2.DeletePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeletePhraseSetMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public void undeletePhraseSet( + com.google.cloud.speech.v2.UndeletePhraseSetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUndeletePhraseSetMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Enables speech transcription and resource management.
+   * 
+ */ + public static final class SpeechBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private SpeechBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SpeechBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SpeechBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.longrunning.Operation createRecognizer( + com.google.cloud.speech.v2.CreateRecognizerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateRecognizerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists Recognizers.
+     * 
+ */ + public com.google.cloud.speech.v2.ListRecognizersResponse listRecognizers( + com.google.cloud.speech.v2.ListRecognizersRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListRecognizersMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns the requested
+     * [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
+     * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't
+     * exist.
+     * 
+ */ + public com.google.cloud.speech.v2.Recognizer getRecognizer( + com.google.cloud.speech.v2.GetRecognizerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetRecognizerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.longrunning.Operation updateRecognizer( + com.google.cloud.speech.v2.UpdateRecognizerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateRecognizerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.longrunning.Operation deleteRecognizer( + com.google.cloud.speech.v2.DeleteRecognizerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteRecognizerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.longrunning.Operation undeleteRecognizer( + com.google.cloud.speech.v2.UndeleteRecognizerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUndeleteRecognizerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Performs synchronous Speech recognition: receive results after all audio
+     * has been sent and processed.
+     * 
+ */ + public com.google.cloud.speech.v2.RecognizeResponse recognize( + com.google.cloud.speech.v2.RecognizeRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getRecognizeMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Performs batch asynchronous speech recognition: send a request with N
+     * audio files and receive a long running operation that can be polled to see
+     * when the transcriptions are finished.
+     * 
+ */ + public com.google.longrunning.Operation batchRecognize( + com.google.cloud.speech.v2.BatchRecognizeRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getBatchRecognizeMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns the requested [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public com.google.cloud.speech.v2.Config getConfig( + com.google.cloud.speech.v2.GetConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public com.google.cloud.speech.v2.Config updateConfig( + com.google.cloud.speech.v2.UpdateConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.longrunning.Operation createCustomClass( + com.google.cloud.speech.v2.CreateCustomClassRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateCustomClassMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists CustomClasses.
+     * 
+ */ + public com.google.cloud.speech.v2.ListCustomClassesResponse listCustomClasses( + com.google.cloud.speech.v2.ListCustomClassesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListCustomClassesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns the requested
+     * [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.cloud.speech.v2.CustomClass getCustomClass( + com.google.cloud.speech.v2.GetCustomClassRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetCustomClassMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.longrunning.Operation updateCustomClass( + com.google.cloud.speech.v2.UpdateCustomClassRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateCustomClassMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.longrunning.Operation deleteCustomClass( + com.google.cloud.speech.v2.DeleteCustomClassRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteCustomClassMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.longrunning.Operation undeleteCustomClass( + com.google.cloud.speech.v2.UndeleteCustomClassRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUndeleteCustomClassMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.longrunning.Operation createPhraseSet( + com.google.cloud.speech.v2.CreatePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreatePhraseSetMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists PhraseSets.
+     * 
+ */ + public com.google.cloud.speech.v2.ListPhraseSetsResponse listPhraseSets( + com.google.cloud.speech.v2.ListPhraseSetsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListPhraseSetsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns the requested
+     * [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.cloud.speech.v2.PhraseSet getPhraseSet( + com.google.cloud.speech.v2.GetPhraseSetRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetPhraseSetMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.longrunning.Operation updatePhraseSet( + com.google.cloud.speech.v2.UpdatePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdatePhraseSetMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.longrunning.Operation deletePhraseSet( + com.google.cloud.speech.v2.DeletePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeletePhraseSetMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.longrunning.Operation undeletePhraseSet( + com.google.cloud.speech.v2.UndeletePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUndeletePhraseSetMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Enables speech transcription and resource management.
+   * 
+ */ + public static final class SpeechFutureStub + extends io.grpc.stub.AbstractFutureStub { + private SpeechFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SpeechFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SpeechFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createRecognizer(com.google.cloud.speech.v2.CreateRecognizerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateRecognizerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists Recognizers.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.speech.v2.ListRecognizersResponse> + listRecognizers(com.google.cloud.speech.v2.ListRecognizersRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListRecognizersMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns the requested
+     * [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
+     * [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't
+     * exist.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getRecognizer(com.google.cloud.speech.v2.GetRecognizerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetRecognizerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateRecognizer(com.google.cloud.speech.v2.UpdateRecognizerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateRecognizerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteRecognizer(com.google.cloud.speech.v2.DeleteRecognizerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteRecognizerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + undeleteRecognizer(com.google.cloud.speech.v2.UndeleteRecognizerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUndeleteRecognizerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Performs synchronous Speech recognition: receive results after all audio
+     * has been sent and processed.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.speech.v2.RecognizeResponse> + recognize(com.google.cloud.speech.v2.RecognizeRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getRecognizeMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Performs batch asynchronous speech recognition: send a request with N
+     * audio files and receive a long running operation that can be polled to see
+     * when the transcriptions are finished.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + batchRecognize(com.google.cloud.speech.v2.BatchRecognizeRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getBatchRecognizeMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns the requested [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getConfig(com.google.cloud.speech.v2.GetConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [Config][google.cloud.speech.v2.Config].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateConfig(com.google.cloud.speech.v2.UpdateConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createCustomClass(com.google.cloud.speech.v2.CreateCustomClassRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateCustomClassMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists CustomClasses.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.speech.v2.ListCustomClassesResponse> + listCustomClasses(com.google.cloud.speech.v2.ListCustomClassesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListCustomClassesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns the requested
+     * [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.speech.v2.CustomClass> + getCustomClass(com.google.cloud.speech.v2.GetCustomClassRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetCustomClassMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateCustomClass(com.google.cloud.speech.v2.UpdateCustomClassRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateCustomClassMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteCustomClass(com.google.cloud.speech.v2.DeleteCustomClassRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteCustomClassMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + undeleteCustomClass(com.google.cloud.speech.v2.UndeleteCustomClassRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUndeleteCustomClassMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createPhraseSet(com.google.cloud.speech.v2.CreatePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreatePhraseSetMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists PhraseSets.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.speech.v2.ListPhraseSetsResponse> + listPhraseSets(com.google.cloud.speech.v2.ListPhraseSetsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListPhraseSetsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns the requested
+     * [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getPhraseSet(com.google.cloud.speech.v2.GetPhraseSetRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetPhraseSetMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updatePhraseSet(com.google.cloud.speech.v2.UpdatePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdatePhraseSetMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deletePhraseSet(com.google.cloud.speech.v2.DeletePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeletePhraseSetMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + undeletePhraseSet(com.google.cloud.speech.v2.UndeletePhraseSetRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUndeletePhraseSetMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_RECOGNIZER = 0; + private static final int METHODID_LIST_RECOGNIZERS = 1; + private static final int METHODID_GET_RECOGNIZER = 2; + private static final int METHODID_UPDATE_RECOGNIZER = 3; + private static final int METHODID_DELETE_RECOGNIZER = 4; + private static final int METHODID_UNDELETE_RECOGNIZER = 5; + private static final int METHODID_RECOGNIZE = 6; + private static final int METHODID_BATCH_RECOGNIZE = 7; + private static final int METHODID_GET_CONFIG = 8; + private static final int METHODID_UPDATE_CONFIG = 9; + private static final int METHODID_CREATE_CUSTOM_CLASS = 10; + private static final int METHODID_LIST_CUSTOM_CLASSES = 11; + private static final int METHODID_GET_CUSTOM_CLASS = 12; + private static final int METHODID_UPDATE_CUSTOM_CLASS = 13; + private static final int METHODID_DELETE_CUSTOM_CLASS = 14; + private static final int METHODID_UNDELETE_CUSTOM_CLASS = 15; + private static final int METHODID_CREATE_PHRASE_SET = 16; + private static final int METHODID_LIST_PHRASE_SETS = 17; + private static final int METHODID_GET_PHRASE_SET = 18; + private static final int METHODID_UPDATE_PHRASE_SET = 19; + private static final int METHODID_DELETE_PHRASE_SET = 20; + private static final int METHODID_UNDELETE_PHRASE_SET = 21; + private static final int METHODID_STREAMING_RECOGNIZE = 22; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final SpeechImplBase serviceImpl; + private final int methodId; + + MethodHandlers(SpeechImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_RECOGNIZER: + serviceImpl.createRecognizer( + (com.google.cloud.speech.v2.CreateRecognizerRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_RECOGNIZERS: + serviceImpl.listRecognizers( + (com.google.cloud.speech.v2.ListRecognizersRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_RECOGNIZER: + serviceImpl.getRecognizer( + (com.google.cloud.speech.v2.GetRecognizerRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_RECOGNIZER: + serviceImpl.updateRecognizer( + (com.google.cloud.speech.v2.UpdateRecognizerRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_RECOGNIZER: + serviceImpl.deleteRecognizer( + (com.google.cloud.speech.v2.DeleteRecognizerRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UNDELETE_RECOGNIZER: + serviceImpl.undeleteRecognizer( + (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_RECOGNIZE: + serviceImpl.recognize( + (com.google.cloud.speech.v2.RecognizeRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_BATCH_RECOGNIZE: + serviceImpl.batchRecognize( + (com.google.cloud.speech.v2.BatchRecognizeRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_CONFIG: + serviceImpl.getConfig( + (com.google.cloud.speech.v2.GetConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_CONFIG: + serviceImpl.updateConfig( + (com.google.cloud.speech.v2.UpdateConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_CUSTOM_CLASS: + serviceImpl.createCustomClass( + (com.google.cloud.speech.v2.CreateCustomClassRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_CUSTOM_CLASSES: + serviceImpl.listCustomClasses( + (com.google.cloud.speech.v2.ListCustomClassesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_CUSTOM_CLASS: + serviceImpl.getCustomClass( + (com.google.cloud.speech.v2.GetCustomClassRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_CUSTOM_CLASS: + serviceImpl.updateCustomClass( + (com.google.cloud.speech.v2.UpdateCustomClassRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_CUSTOM_CLASS: + serviceImpl.deleteCustomClass( + (com.google.cloud.speech.v2.DeleteCustomClassRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UNDELETE_CUSTOM_CLASS: + serviceImpl.undeleteCustomClass( + (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_PHRASE_SET: + serviceImpl.createPhraseSet( + (com.google.cloud.speech.v2.CreatePhraseSetRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_PHRASE_SETS: + serviceImpl.listPhraseSets( + (com.google.cloud.speech.v2.ListPhraseSetsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_PHRASE_SET: + serviceImpl.getPhraseSet( + (com.google.cloud.speech.v2.GetPhraseSetRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_PHRASE_SET: + serviceImpl.updatePhraseSet( + (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_PHRASE_SET: + serviceImpl.deletePhraseSet( + (com.google.cloud.speech.v2.DeletePhraseSetRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UNDELETE_PHRASE_SET: + serviceImpl.undeletePhraseSet( + (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_STREAMING_RECOGNIZE: + return (io.grpc.stub.StreamObserver) + serviceImpl.streamingRecognize( + (io.grpc.stub.StreamObserver< + com.google.cloud.speech.v2.StreamingRecognizeResponse>) + responseObserver); + default: + throw new AssertionError(); + } + } + } + + private abstract static class SpeechBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + SpeechBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Speech"); + } + } + + private static final class SpeechFileDescriptorSupplier extends SpeechBaseDescriptorSupplier { + SpeechFileDescriptorSupplier() {} + } + + private static final class SpeechMethodDescriptorSupplier extends SpeechBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + SpeechMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (SpeechGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new SpeechFileDescriptorSupplier()) + .addMethod(getCreateRecognizerMethod()) + .addMethod(getListRecognizersMethod()) + .addMethod(getGetRecognizerMethod()) + .addMethod(getUpdateRecognizerMethod()) + .addMethod(getDeleteRecognizerMethod()) + .addMethod(getUndeleteRecognizerMethod()) + .addMethod(getRecognizeMethod()) + .addMethod(getStreamingRecognizeMethod()) + .addMethod(getBatchRecognizeMethod()) + .addMethod(getGetConfigMethod()) + .addMethod(getUpdateConfigMethod()) + .addMethod(getCreateCustomClassMethod()) + .addMethod(getListCustomClassesMethod()) + .addMethod(getGetCustomClassMethod()) + .addMethod(getUpdateCustomClassMethod()) + .addMethod(getDeleteCustomClassMethod()) + .addMethod(getUndeleteCustomClassMethod()) + .addMethod(getCreatePhraseSetMethod()) + .addMethod(getListPhraseSetsMethod()) + .addMethod(getGetPhraseSetMethod()) + .addMethod(getUpdatePhraseSetMethod()) + .addMethod(getDeletePhraseSetMethod()) + .addMethod(getUndeletePhraseSetMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-speech/pom.xml b/java-speech/pom.xml index 683f403da22b..09f3a1bccae3 100644 --- a/java-speech/pom.xml +++ b/java-speech/pom.xml @@ -151,6 +151,16 @@ proto-google-cloud-speech-v1 2.5.5-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-speech-v2 + 2.5.5-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-speech-v2 + 2.5.5-SNAPSHOT + com.google.cloud google-cloud-speech @@ -235,9 +245,11 @@ grpc-google-cloud-speech-v1 grpc-google-cloud-speech-v1beta1 grpc-google-cloud-speech-v1p1beta1 + grpc-google-cloud-speech-v2 proto-google-cloud-speech-v1 proto-google-cloud-speech-v1beta1 proto-google-cloud-speech-v1p1beta1 + proto-google-cloud-speech-v2 google-cloud-speech-bom diff --git a/java-speech/proto-google-cloud-speech-v2/clirr-ignored-differences.xml b/java-speech/proto-google-cloud-speech-v2/clirr-ignored-differences.xml new file mode 100644 index 000000000000..561c28ce2824 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/cloud/speech/v2/*OrBuilder + * get*(*) + + + 7012 + com/google/cloud/speech/v2/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/cloud/speech/v2/*OrBuilder + boolean has*(*) + + diff --git a/java-speech/proto-google-cloud-speech-v2/pom.xml b/java-speech/proto-google-cloud-speech-v2/pom.xml new file mode 100644 index 000000000000..356018a0757a --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-speech-v2 + 2.5.5-SNAPSHOT + proto-google-cloud-speech-v2 + Proto library for google-cloud-speech + + com.google.cloud + google-cloud-speech-parent + 2.5.5-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfig.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfig.java new file mode 100644 index 000000000000..99beb7269304 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfig.java @@ -0,0 +1,478 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Automatically detected decoding parameters.
+ * Supported for the following encodings:
+ * * WAV_LINEAR16: 16-bit signed little-endian PCM samples in a WAV container.
+ * * WAV_MULAW: 8-bit companded mulaw samples in a WAV container.
+ * * WAV_ALAW: 8-bit companded alaw samples in a WAV container.
+ * * RFC4867_5_AMR: AMR frames with an rfc4867.5 header.
+ * * RFC4867_5_AMRWB: AMR-WB frames with an rfc4867.5 header.
+ * * FLAC: FLAC frames in the "native FLAC" container format.
+ * * MP3: MPEG audio frames with optional (ignored) ID3 metadata.
+ * * OGG_OPUS: Opus audio frames in an Ogg container.
+ * * WEBM_OPUS: Opus audio frames in a WebM container.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.AutoDetectDecodingConfig} + */ +public final class AutoDetectDecodingConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.AutoDetectDecodingConfig) + AutoDetectDecodingConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use AutoDetectDecodingConfig.newBuilder() to construct. + private AutoDetectDecodingConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AutoDetectDecodingConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AutoDetectDecodingConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AutoDetectDecodingConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_AutoDetectDecodingConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_AutoDetectDecodingConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.AutoDetectDecodingConfig.class, + com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.AutoDetectDecodingConfig)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.AutoDetectDecodingConfig other = + (com.google.cloud.speech.v2.AutoDetectDecodingConfig) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.AutoDetectDecodingConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Automatically detected decoding parameters.
+   * Supported for the following encodings:
+   * * WAV_LINEAR16: 16-bit signed little-endian PCM samples in a WAV container.
+   * * WAV_MULAW: 8-bit companded mulaw samples in a WAV container.
+   * * WAV_ALAW: 8-bit companded alaw samples in a WAV container.
+   * * RFC4867_5_AMR: AMR frames with an rfc4867.5 header.
+   * * RFC4867_5_AMRWB: AMR-WB frames with an rfc4867.5 header.
+   * * FLAC: FLAC frames in the "native FLAC" container format.
+   * * MP3: MPEG audio frames with optional (ignored) ID3 metadata.
+   * * OGG_OPUS: Opus audio frames in an Ogg container.
+   * * WEBM_OPUS: Opus audio frames in a WebM container.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.AutoDetectDecodingConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.AutoDetectDecodingConfig) + com.google.cloud.speech.v2.AutoDetectDecodingConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_AutoDetectDecodingConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_AutoDetectDecodingConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.AutoDetectDecodingConfig.class, + com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.AutoDetectDecodingConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_AutoDetectDecodingConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfig getDefaultInstanceForType() { + return com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfig build() { + com.google.cloud.speech.v2.AutoDetectDecodingConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfig buildPartial() { + com.google.cloud.speech.v2.AutoDetectDecodingConfig result = + new com.google.cloud.speech.v2.AutoDetectDecodingConfig(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.AutoDetectDecodingConfig) { + return mergeFrom((com.google.cloud.speech.v2.AutoDetectDecodingConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.AutoDetectDecodingConfig other) { + if (other == com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.AutoDetectDecodingConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.AutoDetectDecodingConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.AutoDetectDecodingConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.AutoDetectDecodingConfig) + private static final com.google.cloud.speech.v2.AutoDetectDecodingConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.AutoDetectDecodingConfig(); + } + + public static com.google.cloud.speech.v2.AutoDetectDecodingConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AutoDetectDecodingConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AutoDetectDecodingConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfigOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfigOrBuilder.java new file mode 100644 index 000000000000..eb900c2c33fb --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/AutoDetectDecodingConfigOrBuilder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface AutoDetectDecodingConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.AutoDetectDecodingConfig) + com.google.protobuf.MessageOrBuilder {} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadata.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadata.java new file mode 100644 index 000000000000..b52e5a3313d4 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadata.java @@ -0,0 +1,1546 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Metadata about a single file in a batch for BatchRecognize.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeFileMetadata} + */ +public final class BatchRecognizeFileMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.BatchRecognizeFileMetadata) + BatchRecognizeFileMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchRecognizeFileMetadata.newBuilder() to construct. + private BatchRecognizeFileMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchRecognizeFileMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchRecognizeFileMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchRecognizeFileMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + audioSourceCase_ = 1; + audioSource_ = s; + break; + } + case 34: + { + com.google.cloud.speech.v2.RecognitionConfig.Builder subBuilder = null; + if (config_ != null) { + subBuilder = config_.toBuilder(); + } + config_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(config_); + config_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (configMask_ != null) { + subBuilder = configMask_.toBuilder(); + } + configMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(configMask_); + configMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.class, + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder.class); + } + + private int audioSourceCase_ = 0; + private java.lang.Object audioSource_; + + public enum AudioSourceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + URI(1), + AUDIOSOURCE_NOT_SET(0); + private final int value; + + private AudioSourceCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AudioSourceCase valueOf(int value) { + return forNumber(value); + } + + public static AudioSourceCase forNumber(int value) { + switch (value) { + case 1: + return URI; + case 0: + return AUDIOSOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public AudioSourceCase getAudioSourceCase() { + return AudioSourceCase.forNumber(audioSourceCase_); + } + + public static final int URI_FIELD_NUMBER = 1; + /** + * + * + *
+   * Cloud Storage URI for the audio file.
+   * 
+ * + * string uri = 1; + * + * @return Whether the uri field is set. + */ + public boolean hasUri() { + return audioSourceCase_ == 1; + } + /** + * + * + *
+   * Cloud Storage URI for the audio file.
+   * 
+ * + * string uri = 1; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 1) { + ref = audioSource_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (audioSourceCase_ == 1) { + audioSource_ = s; + } + return s; + } + } + /** + * + * + *
+   * Cloud Storage URI for the audio file.
+   * 
+ * + * string uri = 1; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 1) { + ref = audioSource_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (audioSourceCase_ == 1) { + audioSource_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_FIELD_NUMBER = 4; + private com.google.cloud.speech.v2.RecognitionConfig config_; + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource as well as the
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+   * request level.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return config_ != null; + } + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource as well as the
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+   * request level.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return The config. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource as well as the
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+   * request level.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + return getConfig(); + } + + public static final int CONFIG_MASK_FIELD_NUMBER = 5; + private com.google.protobuf.FieldMask configMask_; + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return Whether the configMask field is set. + */ + @java.lang.Override + public boolean hasConfigMask() { + return configMask_ != null; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return The configMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getConfigMask() { + return configMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : configMask_; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + return getConfigMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (audioSourceCase_ == 1) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, audioSource_); + } + if (config_ != null) { + output.writeMessage(4, getConfig()); + } + if (configMask_ != null) { + output.writeMessage(5, getConfigMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (audioSourceCase_ == 1) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, audioSource_); + } + if (config_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getConfig()); + } + if (configMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getConfigMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.BatchRecognizeFileMetadata)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.BatchRecognizeFileMetadata other = + (com.google.cloud.speech.v2.BatchRecognizeFileMetadata) obj; + + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig().equals(other.getConfig())) return false; + } + if (hasConfigMask() != other.hasConfigMask()) return false; + if (hasConfigMask()) { + if (!getConfigMask().equals(other.getConfigMask())) return false; + } + if (!getAudioSourceCase().equals(other.getAudioSourceCase())) return false; + switch (audioSourceCase_) { + case 1: + if (!getUri().equals(other.getUri())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + if (hasConfigMask()) { + hash = (37 * hash) + CONFIG_MASK_FIELD_NUMBER; + hash = (53 * hash) + getConfigMask().hashCode(); + } + switch (audioSourceCase_) { + case 1: + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.BatchRecognizeFileMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata about a single file in a batch for BatchRecognize.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeFileMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.BatchRecognizeFileMetadata) + com.google.cloud.speech.v2.BatchRecognizeFileMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.class, + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.BatchRecognizeFileMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (configBuilder_ == null) { + config_ = null; + } else { + config_ = null; + configBuilder_ = null; + } + if (configMaskBuilder_ == null) { + configMask_ = null; + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + audioSourceCase_ = 0; + audioSource_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata getDefaultInstanceForType() { + return com.google.cloud.speech.v2.BatchRecognizeFileMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata build() { + com.google.cloud.speech.v2.BatchRecognizeFileMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata buildPartial() { + com.google.cloud.speech.v2.BatchRecognizeFileMetadata result = + new com.google.cloud.speech.v2.BatchRecognizeFileMetadata(this); + if (audioSourceCase_ == 1) { + result.audioSource_ = audioSource_; + } + if (configBuilder_ == null) { + result.config_ = config_; + } else { + result.config_ = configBuilder_.build(); + } + if (configMaskBuilder_ == null) { + result.configMask_ = configMask_; + } else { + result.configMask_ = configMaskBuilder_.build(); + } + result.audioSourceCase_ = audioSourceCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.BatchRecognizeFileMetadata) { + return mergeFrom((com.google.cloud.speech.v2.BatchRecognizeFileMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.BatchRecognizeFileMetadata other) { + if (other == com.google.cloud.speech.v2.BatchRecognizeFileMetadata.getDefaultInstance()) + return this; + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + if (other.hasConfigMask()) { + mergeConfigMask(other.getConfigMask()); + } + switch (other.getAudioSourceCase()) { + case URI: + { + audioSourceCase_ = 1; + audioSource_ = other.audioSource_; + onChanged(); + break; + } + case AUDIOSOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.BatchRecognizeFileMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.BatchRecognizeFileMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int audioSourceCase_ = 0; + private java.lang.Object audioSource_; + + public AudioSourceCase getAudioSourceCase() { + return AudioSourceCase.forNumber(audioSourceCase_); + } + + public Builder clearAudioSource() { + audioSourceCase_ = 0; + audioSource_ = null; + onChanged(); + return this; + } + + /** + * + * + *
+     * Cloud Storage URI for the audio file.
+     * 
+ * + * string uri = 1; + * + * @return Whether the uri field is set. + */ + @java.lang.Override + public boolean hasUri() { + return audioSourceCase_ == 1; + } + /** + * + * + *
+     * Cloud Storage URI for the audio file.
+     * 
+ * + * string uri = 1; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 1) { + ref = audioSource_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (audioSourceCase_ == 1) { + audioSource_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Cloud Storage URI for the audio file.
+     * 
+ * + * string uri = 1; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 1) { + ref = audioSource_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (audioSourceCase_ == 1) { + audioSource_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Cloud Storage URI for the audio file.
+     * 
+ * + * string uri = 1; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + audioSourceCase_ = 1; + audioSource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Cloud Storage URI for the audio file.
+     * 
+ * + * string uri = 1; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + if (audioSourceCase_ == 1) { + audioSourceCase_ = 0; + audioSource_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Cloud Storage URI for the audio file.
+     * 
+ * + * string uri = 1; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + audioSourceCase_ = 1; + audioSource_ = value; + onChanged(); + return this; + } + + private com.google.cloud.speech.v2.RecognitionConfig config_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + configBuilder_; + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return configBuilder_ != null || config_ != null; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return The config. + */ + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + onChanged(); + } else { + configBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + onChanged(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder mergeConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (config_ != null) { + config_ = + com.google.cloud.speech.v2.RecognitionConfig.newBuilder(config_) + .mergeFrom(value) + .buildPartial(); + } else { + config_ = value; + } + onChanged(); + } else { + configBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder clearConfig() { + if (configBuilder_ == null) { + config_ = null; + onChanged(); + } else { + config_ = null; + configBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public com.google.cloud.speech.v2.RecognitionConfig.Builder getConfigBuilder() { + + onChanged(); + return getConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource as well as the
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+     * request level.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + getConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder>( + getConfig(), getParentForChildren(), isClean()); + config_ = null; + } + return configBuilder_; + } + + private com.google.protobuf.FieldMask configMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + configMaskBuilder_; + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return Whether the configMask field is set. + */ + public boolean hasConfigMask() { + return configMaskBuilder_ != null || configMask_ != null; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return The configMask. + */ + public com.google.protobuf.FieldMask getConfigMask() { + if (configMaskBuilder_ == null) { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } else { + return configMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + configMask_ = value; + onChanged(); + } else { + configMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (configMaskBuilder_ == null) { + configMask_ = builderForValue.build(); + onChanged(); + } else { + configMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder mergeConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (configMask_ != null) { + configMask_ = + com.google.protobuf.FieldMask.newBuilder(configMask_).mergeFrom(value).buildPartial(); + } else { + configMask_ = value; + } + onChanged(); + } else { + configMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder clearConfigMask() { + if (configMaskBuilder_ == null) { + configMask_ = null; + onChanged(); + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public com.google.protobuf.FieldMask.Builder getConfigMaskBuilder() { + + onChanged(); + return getConfigMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + if (configMaskBuilder_ != null) { + return configMaskBuilder_.getMessageOrBuilder(); + } else { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getConfigMaskFieldBuilder() { + if (configMaskBuilder_ == null) { + configMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getConfigMask(), getParentForChildren(), isClean()); + configMask_ = null; + } + return configMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.BatchRecognizeFileMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.BatchRecognizeFileMetadata) + private static final com.google.cloud.speech.v2.BatchRecognizeFileMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.BatchRecognizeFileMetadata(); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchRecognizeFileMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchRecognizeFileMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadataOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadataOrBuilder.java new file mode 100644 index 000000000000..8e666904d05e --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileMetadataOrBuilder.java @@ -0,0 +1,191 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface BatchRecognizeFileMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.BatchRecognizeFileMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Cloud Storage URI for the audio file.
+   * 
+ * + * string uri = 1; + * + * @return Whether the uri field is set. + */ + boolean hasUri(); + /** + * + * + *
+   * Cloud Storage URI for the audio file.
+   * 
+ * + * string uri = 1; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * Cloud Storage URI for the audio file.
+   * 
+ * + * string uri = 1; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource as well as the
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+   * request level.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource as well as the
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+   * request level.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return The config. + */ + com.google.cloud.speech.v2.RecognitionConfig getConfig(); + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource as well as the
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
+   * request level.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder(); + + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return Whether the configMask field is set. + */ + boolean hasConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return The configMask. + */ + com.google.protobuf.FieldMask getConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder(); + + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata.AudioSourceCase getAudioSourceCase(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResult.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResult.java new file mode 100644 index 000000000000..986aabce0d27 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResult.java @@ -0,0 +1,899 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Final results for a single file.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeFileResult} + */ +public final class BatchRecognizeFileResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.BatchRecognizeFileResult) + BatchRecognizeFileResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchRecognizeFileResult.newBuilder() to construct. + private BatchRecognizeFileResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchRecognizeFileResult() { + uri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchRecognizeFileResult(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchRecognizeFileResult( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + case 18: + { + com.google.rpc.Status.Builder subBuilder = null; + if (error_ != null) { + subBuilder = error_.toBuilder(); + } + error_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(error_); + error_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeFileResult.class, + com.google.cloud.speech.v2.BatchRecognizeFileResult.Builder.class); + } + + public static final int URI_FIELD_NUMBER = 1; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * The GCS URI to which recognition results were written.
+   * 
+ * + * string uri = 1; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * The GCS URI to which recognition results were written.
+   * 
+ * + * string uri = 1; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ERROR_FIELD_NUMBER = 2; + private com.google.rpc.Status error_; + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return Whether the error field is set. + */ + @java.lang.Override + public boolean hasError() { + return error_ != null; + } + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return The error. + */ + @java.lang.Override + public com.google.rpc.Status getError() { + return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; + } + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { + return getError(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, uri_); + } + if (error_ != null) { + output.writeMessage(2, getError()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, uri_); + } + if (error_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getError()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.BatchRecognizeFileResult)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.BatchRecognizeFileResult other = + (com.google.cloud.speech.v2.BatchRecognizeFileResult) obj; + + if (!getUri().equals(other.getUri())) return false; + if (hasError() != other.hasError()) return false; + if (hasError()) { + if (!getError().equals(other.getError())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + if (hasError()) { + hash = (37 * hash) + ERROR_FIELD_NUMBER; + hash = (53 * hash) + getError().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.BatchRecognizeFileResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Final results for a single file.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeFileResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.BatchRecognizeFileResult) + com.google.cloud.speech.v2.BatchRecognizeFileResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeFileResult.class, + com.google.cloud.speech.v2.BatchRecognizeFileResult.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.BatchRecognizeFileResult.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + uri_ = ""; + + if (errorBuilder_ == null) { + error_ = null; + } else { + error_ = null; + errorBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeFileResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult getDefaultInstanceForType() { + return com.google.cloud.speech.v2.BatchRecognizeFileResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult build() { + com.google.cloud.speech.v2.BatchRecognizeFileResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult buildPartial() { + com.google.cloud.speech.v2.BatchRecognizeFileResult result = + new com.google.cloud.speech.v2.BatchRecognizeFileResult(this); + result.uri_ = uri_; + if (errorBuilder_ == null) { + result.error_ = error_; + } else { + result.error_ = errorBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.BatchRecognizeFileResult) { + return mergeFrom((com.google.cloud.speech.v2.BatchRecognizeFileResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.BatchRecognizeFileResult other) { + if (other == com.google.cloud.speech.v2.BatchRecognizeFileResult.getDefaultInstance()) + return this; + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + if (other.hasError()) { + mergeError(other.getError()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.BatchRecognizeFileResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.BatchRecognizeFileResult) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * The GCS URI to which recognition results were written.
+     * 
+ * + * string uri = 1; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The GCS URI to which recognition results were written.
+     * 
+ * + * string uri = 1; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The GCS URI to which recognition results were written.
+     * 
+ * + * string uri = 1; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The GCS URI to which recognition results were written.
+     * 
+ * + * string uri = 1; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * The GCS URI to which recognition results were written.
+     * 
+ * + * string uri = 1; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = value; + onChanged(); + return this; + } + + private com.google.rpc.Status error_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + errorBuilder_; + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + * + * @return Whether the error field is set. + */ + public boolean hasError() { + return errorBuilder_ != null || error_ != null; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + * + * @return The error. + */ + public com.google.rpc.Status getError() { + if (errorBuilder_ == null) { + return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; + } else { + return errorBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder setError(com.google.rpc.Status value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + error_ = value; + onChanged(); + } else { + errorBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder setError(com.google.rpc.Status.Builder builderForValue) { + if (errorBuilder_ == null) { + error_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder mergeError(com.google.rpc.Status value) { + if (errorBuilder_ == null) { + if (error_ != null) { + error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial(); + } else { + error_ = value; + } + onChanged(); + } else { + errorBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder clearError() { + if (errorBuilder_ == null) { + error_ = null; + onChanged(); + } else { + error_ = null; + errorBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public com.google.rpc.Status.Builder getErrorBuilder() { + + onChanged(); + return getErrorFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { + if (errorBuilder_ != null) { + return errorBuilder_.getMessageOrBuilder(); + } else { + return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; + } + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + errorBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>(getError(), getParentForChildren(), isClean()); + error_ = null; + } + return errorBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.BatchRecognizeFileResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.BatchRecognizeFileResult) + private static final com.google.cloud.speech.v2.BatchRecognizeFileResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.BatchRecognizeFileResult(); + } + + public static com.google.cloud.speech.v2.BatchRecognizeFileResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchRecognizeFileResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchRecognizeFileResult(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResultOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResultOrBuilder.java new file mode 100644 index 000000000000..5ec2c3bdb67d --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeFileResultOrBuilder.java @@ -0,0 +1,85 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface BatchRecognizeFileResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.BatchRecognizeFileResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The GCS URI to which recognition results were written.
+   * 
+ * + * string uri = 1; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * The GCS URI to which recognition results were written.
+   * 
+ * + * string uri = 1; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return Whether the error field is set. + */ + boolean hasError(); + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return The error. + */ + com.google.rpc.Status getError(); + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + */ + com.google.rpc.StatusOrBuilder getErrorOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadata.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadata.java new file mode 100644 index 000000000000..6b1f75ccf5c6 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadata.java @@ -0,0 +1,867 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Operation metadata for
+ * [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize].
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeMetadata} + */ +public final class BatchRecognizeMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.BatchRecognizeMetadata) + BatchRecognizeMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchRecognizeMetadata.newBuilder() to construct. + private BatchRecognizeMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchRecognizeMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchRecognizeMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchRecognizeMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + transcriptionMetadata_ = + com.google.protobuf.MapField.newMapField( + TranscriptionMetadataDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + transcriptionMetadata__ = + input.readMessage( + TranscriptionMetadataDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + transcriptionMetadata_ + .getMutableMap() + .put(transcriptionMetadata__.getKey(), transcriptionMetadata__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetTranscriptionMetadata(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeMetadata.class, + com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder.class); + } + + public static final int TRANSCRIPTION_METADATA_FIELD_NUMBER = 1; + + private static final class TranscriptionMetadataDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + defaultEntry = + com.google.protobuf.MapEntry + . + newDefaultInstance( + com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_TranscriptionMetadataEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + .getDefaultInstance()); + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + transcriptionMetadata_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + internalGetTranscriptionMetadata() { + if (transcriptionMetadata_ == null) { + return com.google.protobuf.MapField.emptyMapField( + TranscriptionMetadataDefaultEntryHolder.defaultEntry); + } + return transcriptionMetadata_; + } + + public int getTranscriptionMetadataCount() { + return internalGetTranscriptionMetadata().getMap().size(); + } + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public boolean containsTranscriptionMetadata(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTranscriptionMetadata().getMap().containsKey(key); + } + /** Use {@link #getTranscriptionMetadataMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + getTranscriptionMetadata() { + return getTranscriptionMetadataMap(); + } + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + getTranscriptionMetadataMap() { + return internalGetTranscriptionMetadata().getMap(); + } + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + getTranscriptionMetadataOrDefault( + java.lang.String key, + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map + map = internalGetTranscriptionMetadata().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + getTranscriptionMetadataOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map + map = internalGetTranscriptionMetadata().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, + internalGetTranscriptionMetadata(), + TranscriptionMetadataDefaultEntryHolder.defaultEntry, + 1); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + entry : internalGetTranscriptionMetadata().getMap().entrySet()) { + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + transcriptionMetadata__ = + TranscriptionMetadataDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, transcriptionMetadata__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.BatchRecognizeMetadata)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.BatchRecognizeMetadata other = + (com.google.cloud.speech.v2.BatchRecognizeMetadata) obj; + + if (!internalGetTranscriptionMetadata().equals(other.internalGetTranscriptionMetadata())) + return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetTranscriptionMetadata().getMap().isEmpty()) { + hash = (37 * hash) + TRANSCRIPTION_METADATA_FIELD_NUMBER; + hash = (53 * hash) + internalGetTranscriptionMetadata().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.BatchRecognizeMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Operation metadata for
+   * [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize].
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.BatchRecognizeMetadata) + com.google.cloud.speech.v2.BatchRecognizeMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetTranscriptionMetadata(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 1: + return internalGetMutableTranscriptionMetadata(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeMetadata.class, + com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.BatchRecognizeMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + internalGetMutableTranscriptionMetadata().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadata getDefaultInstanceForType() { + return com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadata build() { + com.google.cloud.speech.v2.BatchRecognizeMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadata buildPartial() { + com.google.cloud.speech.v2.BatchRecognizeMetadata result = + new com.google.cloud.speech.v2.BatchRecognizeMetadata(this); + int from_bitField0_ = bitField0_; + result.transcriptionMetadata_ = internalGetTranscriptionMetadata(); + result.transcriptionMetadata_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.BatchRecognizeMetadata) { + return mergeFrom((com.google.cloud.speech.v2.BatchRecognizeMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.BatchRecognizeMetadata other) { + if (other == com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance()) + return this; + internalGetMutableTranscriptionMetadata().mergeFrom(other.internalGetTranscriptionMetadata()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.BatchRecognizeMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.BatchRecognizeMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + transcriptionMetadata_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + internalGetTranscriptionMetadata() { + if (transcriptionMetadata_ == null) { + return com.google.protobuf.MapField.emptyMapField( + TranscriptionMetadataDefaultEntryHolder.defaultEntry); + } + return transcriptionMetadata_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + internalGetMutableTranscriptionMetadata() { + onChanged(); + ; + if (transcriptionMetadata_ == null) { + transcriptionMetadata_ = + com.google.protobuf.MapField.newMapField( + TranscriptionMetadataDefaultEntryHolder.defaultEntry); + } + if (!transcriptionMetadata_.isMutable()) { + transcriptionMetadata_ = transcriptionMetadata_.copy(); + } + return transcriptionMetadata_; + } + + public int getTranscriptionMetadataCount() { + return internalGetTranscriptionMetadata().getMap().size(); + } + /** + * + * + *
+     * Map from provided filename to the transcription metadata for that file.
+     * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public boolean containsTranscriptionMetadata(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTranscriptionMetadata().getMap().containsKey(key); + } + /** Use {@link #getTranscriptionMetadataMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + getTranscriptionMetadata() { + return getTranscriptionMetadataMap(); + } + /** + * + * + *
+     * Map from provided filename to the transcription metadata for that file.
+     * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + getTranscriptionMetadataMap() { + return internalGetTranscriptionMetadata().getMap(); + } + /** + * + * + *
+     * Map from provided filename to the transcription metadata for that file.
+     * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + getTranscriptionMetadataOrDefault( + java.lang.String key, + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + map = internalGetTranscriptionMetadata().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Map from provided filename to the transcription metadata for that file.
+     * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + getTranscriptionMetadataOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + map = internalGetTranscriptionMetadata().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearTranscriptionMetadata() { + internalGetMutableTranscriptionMetadata().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Map from provided filename to the transcription metadata for that file.
+     * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + public Builder removeTranscriptionMetadata(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableTranscriptionMetadata().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + getMutableTranscriptionMetadata() { + return internalGetMutableTranscriptionMetadata().getMutableMap(); + } + /** + * + * + *
+     * Map from provided filename to the transcription metadata for that file.
+     * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + public Builder putTranscriptionMetadata( + java.lang.String key, + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableTranscriptionMetadata().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Map from provided filename to the transcription metadata for that file.
+     * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + public Builder putAllTranscriptionMetadata( + java.util.Map< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> + values) { + internalGetMutableTranscriptionMetadata().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.BatchRecognizeMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.BatchRecognizeMetadata) + private static final com.google.cloud.speech.v2.BatchRecognizeMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.BatchRecognizeMetadata(); + } + + public static com.google.cloud.speech.v2.BatchRecognizeMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchRecognizeMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchRecognizeMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadataOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadataOrBuilder.java new file mode 100644 index 000000000000..ccb845169ee1 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeMetadataOrBuilder.java @@ -0,0 +1,97 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface BatchRecognizeMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.BatchRecognizeMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + int getTranscriptionMetadataCount(); + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + boolean containsTranscriptionMetadata(java.lang.String key); + /** Use {@link #getTranscriptionMetadataMap()} instead. */ + @java.lang.Deprecated + java.util.Map + getTranscriptionMetadata(); + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + java.util.Map + getTranscriptionMetadataMap(); + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + + /* nullable */ + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata getTranscriptionMetadataOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata defaultValue); + /** + * + * + *
+   * Map from provided filename to the transcription metadata for that file.
+   * 
+ * + * + * map<string, .google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata> transcription_metadata = 1; + * + */ + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata getTranscriptionMetadataOrThrow( + java.lang.String key); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequest.java new file mode 100644 index 000000000000..9b7898bdf7c9 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequest.java @@ -0,0 +1,1913 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeRequest} + */ +public final class BatchRecognizeRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.BatchRecognizeRequest) + BatchRecognizeRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchRecognizeRequest.newBuilder() to construct. + private BatchRecognizeRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchRecognizeRequest() { + recognizer_ = ""; + files_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchRecognizeRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchRecognizeRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + recognizer_ = s; + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + files_ = + new java.util.ArrayList< + com.google.cloud.speech.v2.BatchRecognizeFileMetadata>(); + mutable_bitField0_ |= 0x00000001; + } + files_.add( + input.readMessage( + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.parser(), + extensionRegistry)); + break; + } + case 34: + { + com.google.cloud.speech.v2.RecognitionConfig.Builder subBuilder = null; + if (config_ != null) { + subBuilder = config_.toBuilder(); + } + config_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(config_); + config_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (configMask_ != null) { + subBuilder = configMask_.toBuilder(); + } + configMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(configMask_); + configMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + files_ = java.util.Collections.unmodifiableList(files_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeRequest.class, + com.google.cloud.speech.v2.BatchRecognizeRequest.Builder.class); + } + + public static final int RECOGNIZER_FIELD_NUMBER = 1; + private volatile java.lang.Object recognizer_; + /** + * + * + *
+   * Required. Resource name of the recognizer to be used for ASR.
+   * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + @java.lang.Override + public java.lang.String getRecognizer() { + java.lang.Object ref = recognizer_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizer_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Resource name of the recognizer to be used for ASR.
+   * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRecognizerBytes() { + java.lang.Object ref = recognizer_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_FIELD_NUMBER = 4; + private com.google.cloud.speech.v2.RecognitionConfig config_; + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return config_ != null; + } + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return The config. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + return getConfig(); + } + + public static final int CONFIG_MASK_FIELD_NUMBER = 5; + private com.google.protobuf.FieldMask configMask_; + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+   * the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all given fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return Whether the configMask field is set. + */ + @java.lang.Override + public boolean hasConfigMask() { + return configMask_ != null; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+   * the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all given fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return The configMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getConfigMask() { + return configMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : configMask_; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+   * the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all given fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + return getConfigMask(); + } + + public static final int FILES_FIELD_NUMBER = 3; + private java.util.List files_; + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + @java.lang.Override + public java.util.List getFilesList() { + return files_; + } + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + @java.lang.Override + public java.util.List + getFilesOrBuilderList() { + return files_; + } + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + @java.lang.Override + public int getFilesCount() { + return files_.size(); + } + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata getFiles(int index) { + return files_.get(index); + } + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileMetadataOrBuilder getFilesOrBuilder( + int index) { + return files_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizer_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, recognizer_); + } + for (int i = 0; i < files_.size(); i++) { + output.writeMessage(3, files_.get(i)); + } + if (config_ != null) { + output.writeMessage(4, getConfig()); + } + if (configMask_ != null) { + output.writeMessage(5, getConfigMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizer_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, recognizer_); + } + for (int i = 0; i < files_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, files_.get(i)); + } + if (config_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getConfig()); + } + if (configMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getConfigMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.BatchRecognizeRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.BatchRecognizeRequest other = + (com.google.cloud.speech.v2.BatchRecognizeRequest) obj; + + if (!getRecognizer().equals(other.getRecognizer())) return false; + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig().equals(other.getConfig())) return false; + } + if (hasConfigMask() != other.hasConfigMask()) return false; + if (hasConfigMask()) { + if (!getConfigMask().equals(other.getConfigMask())) return false; + } + if (!getFilesList().equals(other.getFilesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + RECOGNIZER_FIELD_NUMBER; + hash = (53 * hash) + getRecognizer().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + if (hasConfigMask()) { + hash = (37 * hash) + CONFIG_MASK_FIELD_NUMBER; + hash = (53 * hash) + getConfigMask().hashCode(); + } + if (getFilesCount() > 0) { + hash = (37 * hash) + FILES_FIELD_NUMBER; + hash = (53 * hash) + getFilesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.BatchRecognizeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.BatchRecognizeRequest) + com.google.cloud.speech.v2.BatchRecognizeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeRequest.class, + com.google.cloud.speech.v2.BatchRecognizeRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.BatchRecognizeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getFilesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + recognizer_ = ""; + + if (configBuilder_ == null) { + config_ = null; + } else { + config_ = null; + configBuilder_ = null; + } + if (configMaskBuilder_ == null) { + configMask_ = null; + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + if (filesBuilder_ == null) { + files_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + filesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequest build() { + com.google.cloud.speech.v2.BatchRecognizeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequest buildPartial() { + com.google.cloud.speech.v2.BatchRecognizeRequest result = + new com.google.cloud.speech.v2.BatchRecognizeRequest(this); + int from_bitField0_ = bitField0_; + result.recognizer_ = recognizer_; + if (configBuilder_ == null) { + result.config_ = config_; + } else { + result.config_ = configBuilder_.build(); + } + if (configMaskBuilder_ == null) { + result.configMask_ = configMask_; + } else { + result.configMask_ = configMaskBuilder_.build(); + } + if (filesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + files_ = java.util.Collections.unmodifiableList(files_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.files_ = files_; + } else { + result.files_ = filesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.BatchRecognizeRequest) { + return mergeFrom((com.google.cloud.speech.v2.BatchRecognizeRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.BatchRecognizeRequest other) { + if (other == com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance()) + return this; + if (!other.getRecognizer().isEmpty()) { + recognizer_ = other.recognizer_; + onChanged(); + } + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + if (other.hasConfigMask()) { + mergeConfigMask(other.getConfigMask()); + } + if (filesBuilder_ == null) { + if (!other.files_.isEmpty()) { + if (files_.isEmpty()) { + files_ = other.files_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureFilesIsMutable(); + files_.addAll(other.files_); + } + onChanged(); + } + } else { + if (!other.files_.isEmpty()) { + if (filesBuilder_.isEmpty()) { + filesBuilder_.dispose(); + filesBuilder_ = null; + files_ = other.files_; + bitField0_ = (bitField0_ & ~0x00000001); + filesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getFilesFieldBuilder() + : null; + } else { + filesBuilder_.addAllMessages(other.files_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.BatchRecognizeRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.BatchRecognizeRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object recognizer_ = ""; + /** + * + * + *
+     * Required. Resource name of the recognizer to be used for ASR.
+     * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + public java.lang.String getRecognizer() { + java.lang.Object ref = recognizer_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizer_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the recognizer to be used for ASR.
+     * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + public com.google.protobuf.ByteString getRecognizerBytes() { + java.lang.Object ref = recognizer_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the recognizer to be used for ASR.
+     * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The recognizer to set. + * @return This builder for chaining. + */ + public Builder setRecognizer(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + recognizer_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the recognizer to be used for ASR.
+     * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearRecognizer() { + + recognizer_ = getDefaultInstance().getRecognizer(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the recognizer to be used for ASR.
+     * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for recognizer to set. + * @return This builder for chaining. + */ + public Builder setRecognizerBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + recognizer_ = value; + onChanged(); + return this; + } + + private com.google.cloud.speech.v2.RecognitionConfig config_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + configBuilder_; + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return configBuilder_ != null || config_ != null; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return The config. + */ + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + onChanged(); + } else { + configBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + onChanged(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder mergeConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (config_ != null) { + config_ = + com.google.cloud.speech.v2.RecognitionConfig.newBuilder(config_) + .mergeFrom(value) + .buildPartial(); + } else { + config_ = value; + } + onChanged(); + } else { + configBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public Builder clearConfig() { + if (configBuilder_ == null) { + config_ = null; + onChanged(); + } else { + config_ = null; + configBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public com.google.cloud.speech.v2.RecognitionConfig.Builder getConfigBuilder() { + + onChanged(); + return getConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + getConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder>( + getConfig(), getParentForChildren(), isClean()); + config_ = null; + } + return configBuilder_; + } + + private com.google.protobuf.FieldMask configMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + configMaskBuilder_; + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return Whether the configMask field is set. + */ + public boolean hasConfigMask() { + return configMaskBuilder_ != null || configMask_ != null; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return The configMask. + */ + public com.google.protobuf.FieldMask getConfigMask() { + if (configMaskBuilder_ == null) { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } else { + return configMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + configMask_ = value; + onChanged(); + } else { + configMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (configMaskBuilder_ == null) { + configMask_ = builderForValue.build(); + onChanged(); + } else { + configMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder mergeConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (configMask_ != null) { + configMask_ = + com.google.protobuf.FieldMask.newBuilder(configMask_).mergeFrom(value).buildPartial(); + } else { + configMask_ = value; + } + onChanged(); + } else { + configMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public Builder clearConfigMask() { + if (configMaskBuilder_ == null) { + configMask_ = null; + onChanged(); + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public com.google.protobuf.FieldMask.Builder getConfigMaskBuilder() { + + onChanged(); + return getConfigMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + if (configMaskBuilder_ != null) { + return configMaskBuilder_.getMessageOrBuilder(); + } else { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+     * the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all given fields in
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getConfigMaskFieldBuilder() { + if (configMaskBuilder_ == null) { + configMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getConfigMask(), getParentForChildren(), isClean()); + configMask_ = null; + } + return configMaskBuilder_; + } + + private java.util.List files_ = + java.util.Collections.emptyList(); + + private void ensureFilesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + files_ = + new java.util.ArrayList(files_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeFileMetadata, + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder, + com.google.cloud.speech.v2.BatchRecognizeFileMetadataOrBuilder> + filesBuilder_; + + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public java.util.List getFilesList() { + if (filesBuilder_ == null) { + return java.util.Collections.unmodifiableList(files_); + } else { + return filesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public int getFilesCount() { + if (filesBuilder_ == null) { + return files_.size(); + } else { + return filesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata getFiles(int index) { + if (filesBuilder_ == null) { + return files_.get(index); + } else { + return filesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder setFiles( + int index, com.google.cloud.speech.v2.BatchRecognizeFileMetadata value) { + if (filesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesIsMutable(); + files_.set(index, value); + onChanged(); + } else { + filesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder setFiles( + int index, com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder builderForValue) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.set(index, builderForValue.build()); + onChanged(); + } else { + filesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder addFiles(com.google.cloud.speech.v2.BatchRecognizeFileMetadata value) { + if (filesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesIsMutable(); + files_.add(value); + onChanged(); + } else { + filesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder addFiles( + int index, com.google.cloud.speech.v2.BatchRecognizeFileMetadata value) { + if (filesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesIsMutable(); + files_.add(index, value); + onChanged(); + } else { + filesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder addFiles( + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder builderForValue) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.add(builderForValue.build()); + onChanged(); + } else { + filesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder addFiles( + int index, com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder builderForValue) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.add(index, builderForValue.build()); + onChanged(); + } else { + filesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder addAllFiles( + java.lang.Iterable + values) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, files_); + onChanged(); + } else { + filesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder clearFiles() { + if (filesBuilder_ == null) { + files_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + filesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public Builder removeFiles(int index) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.remove(index); + onChanged(); + } else { + filesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder getFilesBuilder( + int index) { + return getFilesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public com.google.cloud.speech.v2.BatchRecognizeFileMetadataOrBuilder getFilesOrBuilder( + int index) { + if (filesBuilder_ == null) { + return files_.get(index); + } else { + return filesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public java.util.List + getFilesOrBuilderList() { + if (filesBuilder_ != null) { + return filesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(files_); + } + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder addFilesBuilder() { + return getFilesFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.BatchRecognizeFileMetadata.getDefaultInstance()); + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder addFilesBuilder( + int index) { + return getFilesFieldBuilder() + .addBuilder( + index, com.google.cloud.speech.v2.BatchRecognizeFileMetadata.getDefaultInstance()); + } + /** + * + * + *
+     * Audio files with file metadata for ASR.
+     * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + public java.util.List + getFilesBuilderList() { + return getFilesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeFileMetadata, + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder, + com.google.cloud.speech.v2.BatchRecognizeFileMetadataOrBuilder> + getFilesFieldBuilder() { + if (filesBuilder_ == null) { + filesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeFileMetadata, + com.google.cloud.speech.v2.BatchRecognizeFileMetadata.Builder, + com.google.cloud.speech.v2.BatchRecognizeFileMetadataOrBuilder>( + files_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + files_ = null; + } + return filesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.BatchRecognizeRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.BatchRecognizeRequest) + private static final com.google.cloud.speech.v2.BatchRecognizeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.BatchRecognizeRequest(); + } + + public static com.google.cloud.speech.v2.BatchRecognizeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchRecognizeRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchRecognizeRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequestOrBuilder.java new file mode 100644 index 000000000000..3c9471a9e2cf --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeRequestOrBuilder.java @@ -0,0 +1,227 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface BatchRecognizeRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.BatchRecognizeRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Resource name of the recognizer to be used for ASR.
+   * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + java.lang.String getRecognizer(); + /** + * + * + *
+   * Required. Resource name of the recognizer to be used for ASR.
+   * 
+ * + * + * string recognizer = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + com.google.protobuf.ByteString getRecognizerBytes(); + + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + * + * @return The config. + */ + com.google.cloud.speech.v2.RecognitionConfig getConfig(); + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 4; + */ + com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder(); + + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+   * the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all given fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return Whether the configMask field is set. + */ + boolean hasConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+   * the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all given fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + * + * @return The configMask. + */ + com.google.protobuf.FieldMask getConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
+   * the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all given fields in
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 5; + */ + com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder(); + + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + java.util.List getFilesList(); + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + com.google.cloud.speech.v2.BatchRecognizeFileMetadata getFiles(int index); + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + int getFilesCount(); + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + java.util.List + getFilesOrBuilderList(); + /** + * + * + *
+   * Audio files with file metadata for ASR.
+   * 
+ * + * repeated .google.cloud.speech.v2.BatchRecognizeFileMetadata files = 3; + */ + com.google.cloud.speech.v2.BatchRecognizeFileMetadataOrBuilder getFilesOrBuilder(int index); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponse.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponse.java new file mode 100644 index 000000000000..cec2d24d5c7a --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponse.java @@ -0,0 +1,821 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Response message for
+ * [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize] that is
+ * packaged into a longrunning [Operation][google.longrunning.Operation].
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeResponse} + */ +public final class BatchRecognizeResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.BatchRecognizeResponse) + BatchRecognizeResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchRecognizeResponse.newBuilder() to construct. + private BatchRecognizeResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchRecognizeResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchRecognizeResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchRecognizeResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + com.google.protobuf.MapField.newMapField( + ResultsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + results__ = + input.readMessage( + ResultsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + results_.getMutableMap().put(results__.getKey(), results__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeResponse_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetResults(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeResponse.class, + com.google.cloud.speech.v2.BatchRecognizeResponse.Builder.class); + } + + public static final int RESULTS_FIELD_NUMBER = 1; + + private static final class ResultsDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + defaultEntry = + com.google.protobuf.MapEntry + . + newDefaultInstance( + com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeResponse_ResultsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.speech.v2.BatchRecognizeFileResult.getDefaultInstance()); + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + results_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + internalGetResults() { + if (results_ == null) { + return com.google.protobuf.MapField.emptyMapField(ResultsDefaultEntryHolder.defaultEntry); + } + return results_; + } + + public int getResultsCount() { + return internalGetResults().getMap().size(); + } + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public boolean containsResults(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetResults().getMap().containsKey(key); + } + /** Use {@link #getResultsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getResults() { + return getResultsMap(); + } + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public java.util.Map + getResultsMap() { + return internalGetResults().getMap(); + } + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult getResultsOrDefault( + java.lang.String key, com.google.cloud.speech.v2.BatchRecognizeFileResult defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetResults().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult getResultsOrThrow( + java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetResults().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetResults(), ResultsDefaultEntryHolder.defaultEntry, 1); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry + entry : internalGetResults().getMap().entrySet()) { + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + results__ = + ResultsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, results__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.BatchRecognizeResponse)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.BatchRecognizeResponse other = + (com.google.cloud.speech.v2.BatchRecognizeResponse) obj; + + if (!internalGetResults().equals(other.internalGetResults())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetResults().getMap().isEmpty()) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + internalGetResults().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.BatchRecognizeResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize] that is
+   * packaged into a longrunning [Operation][google.longrunning.Operation].
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.BatchRecognizeResponse) + com.google.cloud.speech.v2.BatchRecognizeResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeResponse_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetResults(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 1: + return internalGetMutableResults(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeResponse.class, + com.google.cloud.speech.v2.BatchRecognizeResponse.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.BatchRecognizeResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + internalGetMutableResults().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeResponse getDefaultInstanceForType() { + return com.google.cloud.speech.v2.BatchRecognizeResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeResponse build() { + com.google.cloud.speech.v2.BatchRecognizeResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeResponse buildPartial() { + com.google.cloud.speech.v2.BatchRecognizeResponse result = + new com.google.cloud.speech.v2.BatchRecognizeResponse(this); + int from_bitField0_ = bitField0_; + result.results_ = internalGetResults(); + result.results_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.BatchRecognizeResponse) { + return mergeFrom((com.google.cloud.speech.v2.BatchRecognizeResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.BatchRecognizeResponse other) { + if (other == com.google.cloud.speech.v2.BatchRecognizeResponse.getDefaultInstance()) + return this; + internalGetMutableResults().mergeFrom(other.internalGetResults()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.BatchRecognizeResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.BatchRecognizeResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + results_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + internalGetResults() { + if (results_ == null) { + return com.google.protobuf.MapField.emptyMapField(ResultsDefaultEntryHolder.defaultEntry); + } + return results_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.speech.v2.BatchRecognizeFileResult> + internalGetMutableResults() { + onChanged(); + ; + if (results_ == null) { + results_ = com.google.protobuf.MapField.newMapField(ResultsDefaultEntryHolder.defaultEntry); + } + if (!results_.isMutable()) { + results_ = results_.copy(); + } + return results_; + } + + public int getResultsCount() { + return internalGetResults().getMap().size(); + } + /** + * + * + *
+     * Map from filename to the final result for that file.
+     * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public boolean containsResults(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetResults().getMap().containsKey(key); + } + /** Use {@link #getResultsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map + getResults() { + return getResultsMap(); + } + /** + * + * + *
+     * Map from filename to the final result for that file.
+     * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public java.util.Map + getResultsMap() { + return internalGetResults().getMap(); + } + /** + * + * + *
+     * Map from filename to the final result for that file.
+     * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult getResultsOrDefault( + java.lang.String key, com.google.cloud.speech.v2.BatchRecognizeFileResult defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetResults().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Map from filename to the final result for that file.
+     * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeFileResult getResultsOrThrow( + java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetResults().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearResults() { + internalGetMutableResults().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Map from filename to the final result for that file.
+     * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + public Builder removeResults(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableResults().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map + getMutableResults() { + return internalGetMutableResults().getMutableMap(); + } + /** + * + * + *
+     * Map from filename to the final result for that file.
+     * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + public Builder putResults( + java.lang.String key, com.google.cloud.speech.v2.BatchRecognizeFileResult value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableResults().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Map from filename to the final result for that file.
+     * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + public Builder putAllResults( + java.util.Map + values) { + internalGetMutableResults().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.BatchRecognizeResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.BatchRecognizeResponse) + private static final com.google.cloud.speech.v2.BatchRecognizeResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.BatchRecognizeResponse(); + } + + public static com.google.cloud.speech.v2.BatchRecognizeResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchRecognizeResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchRecognizeResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponseOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponseOrBuilder.java new file mode 100644 index 000000000000..3e48dc1eea7a --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeResponseOrBuilder.java @@ -0,0 +1,85 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface BatchRecognizeResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.BatchRecognizeResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + int getResultsCount(); + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + boolean containsResults(java.lang.String key); + /** Use {@link #getResultsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getResults(); + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + java.util.Map + getResultsMap(); + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + + /* nullable */ + com.google.cloud.speech.v2.BatchRecognizeFileResult getResultsOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.speech.v2.BatchRecognizeFileResult defaultValue); + /** + * + * + *
+   * Map from filename to the final result for that file.
+   * 
+ * + * map<string, .google.cloud.speech.v2.BatchRecognizeFileResult> results = 1; + */ + com.google.cloud.speech.v2.BatchRecognizeFileResult getResultsOrThrow(java.lang.String key); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadata.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadata.java new file mode 100644 index 000000000000..9d27e202362f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadata.java @@ -0,0 +1,1000 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Metadata about transcription for a single file (for example, progress
+ * percent).
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata} + */ +public final class BatchRecognizeTranscriptionMetadata + extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) + BatchRecognizeTranscriptionMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchRecognizeTranscriptionMetadata.newBuilder() to construct. + private BatchRecognizeTranscriptionMetadata( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchRecognizeTranscriptionMetadata() { + uri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchRecognizeTranscriptionMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchRecognizeTranscriptionMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + progressPercent_ = input.readInt32(); + break; + } + case 18: + { + com.google.rpc.Status.Builder subBuilder = null; + if (error_ != null) { + subBuilder = error_.toBuilder(); + } + error_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(error_); + error_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + uri_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeTranscriptionMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeTranscriptionMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata.class, + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata.Builder.class); + } + + public static final int PROGRESS_PERCENT_FIELD_NUMBER = 1; + private int progressPercent_; + /** + * + * + *
+   * How much of the file has been transcribed so far.
+   * 
+ * + * int32 progress_percent = 1; + * + * @return The progressPercent. + */ + @java.lang.Override + public int getProgressPercent() { + return progressPercent_; + } + + public static final int ERROR_FIELD_NUMBER = 2; + private com.google.rpc.Status error_; + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return Whether the error field is set. + */ + @java.lang.Override + public boolean hasError() { + return error_ != null; + } + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return The error. + */ + @java.lang.Override + public com.google.rpc.Status getError() { + return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; + } + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { + return getError(); + } + + public static final int URI_FIELD_NUMBER = 3; + private volatile java.lang.Object uri_; + /** + * + * + *
+   * The GCS URI to which recognition results will be written.
+   * 
+ * + * string uri = 3; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + * + * + *
+   * The GCS URI to which recognition results will be written.
+   * 
+ * + * string uri = 3; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (progressPercent_ != 0) { + output.writeInt32(1, progressPercent_); + } + if (error_ != null) { + output.writeMessage(2, getError()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, uri_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (progressPercent_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, progressPercent_); + } + if (error_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getError()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uri_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, uri_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata other = + (com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) obj; + + if (getProgressPercent() != other.getProgressPercent()) return false; + if (hasError() != other.hasError()) return false; + if (hasError()) { + if (!getError().equals(other.getError())) return false; + } + if (!getUri().equals(other.getUri())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PROGRESS_PERCENT_FIELD_NUMBER; + hash = (53 * hash) + getProgressPercent(); + if (hasError()) { + hash = (37 * hash) + ERROR_FIELD_NUMBER; + hash = (53 * hash) + getError().hashCode(); + } + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata about transcription for a single file (for example, progress
+   * percent).
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeTranscriptionMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeTranscriptionMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata.class, + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + progressPercent_ = 0; + + if (errorBuilder_ == null) { + error_ = null; + } else { + error_ = null; + errorBuilder_ = null; + } + uri_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_BatchRecognizeTranscriptionMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + getDefaultInstanceForType() { + return com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata build() { + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata buildPartial() { + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata result = + new com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata(this); + result.progressPercent_ = progressPercent_; + if (errorBuilder_ == null) { + result.error_ = error_; + } else { + result.error_ = errorBuilder_.build(); + } + result.uri_ = uri_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) { + return mergeFrom((com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata other) { + if (other + == com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata.getDefaultInstance()) + return this; + if (other.getProgressPercent() != 0) { + setProgressPercent(other.getProgressPercent()); + } + if (other.hasError()) { + mergeError(other.getError()); + } + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int progressPercent_; + /** + * + * + *
+     * How much of the file has been transcribed so far.
+     * 
+ * + * int32 progress_percent = 1; + * + * @return The progressPercent. + */ + @java.lang.Override + public int getProgressPercent() { + return progressPercent_; + } + /** + * + * + *
+     * How much of the file has been transcribed so far.
+     * 
+ * + * int32 progress_percent = 1; + * + * @param value The progressPercent to set. + * @return This builder for chaining. + */ + public Builder setProgressPercent(int value) { + + progressPercent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * How much of the file has been transcribed so far.
+     * 
+ * + * int32 progress_percent = 1; + * + * @return This builder for chaining. + */ + public Builder clearProgressPercent() { + + progressPercent_ = 0; + onChanged(); + return this; + } + + private com.google.rpc.Status error_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + errorBuilder_; + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + * + * @return Whether the error field is set. + */ + public boolean hasError() { + return errorBuilder_ != null || error_ != null; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + * + * @return The error. + */ + public com.google.rpc.Status getError() { + if (errorBuilder_ == null) { + return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; + } else { + return errorBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder setError(com.google.rpc.Status value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + error_ = value; + onChanged(); + } else { + errorBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder setError(com.google.rpc.Status.Builder builderForValue) { + if (errorBuilder_ == null) { + error_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder mergeError(com.google.rpc.Status value) { + if (errorBuilder_ == null) { + if (error_ != null) { + error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial(); + } else { + error_ = value; + } + onChanged(); + } else { + errorBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public Builder clearError() { + if (errorBuilder_ == null) { + error_ = null; + onChanged(); + } else { + error_ = null; + errorBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public com.google.rpc.Status.Builder getErrorBuilder() { + + onChanged(); + return getErrorFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { + if (errorBuilder_ != null) { + return errorBuilder_.getMessageOrBuilder(); + } else { + return error_ == null ? com.google.rpc.Status.getDefaultInstance() : error_; + } + } + /** + * + * + *
+     * Error if one was encountered.
+     * 
+ * + * .google.rpc.Status error = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + errorBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>(getError(), getParentForChildren(), isClean()); + error_ = null; + } + return errorBuilder_; + } + + private java.lang.Object uri_ = ""; + /** + * + * + *
+     * The GCS URI to which recognition results will be written.
+     * 
+ * + * string uri = 3; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The GCS URI to which recognition results will be written.
+     * 
+ * + * string uri = 3; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The GCS URI to which recognition results will be written.
+     * 
+ * + * string uri = 3; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The GCS URI to which recognition results will be written.
+     * 
+ * + * string uri = 3; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + + uri_ = getDefaultInstance().getUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * The GCS URI to which recognition results will be written.
+     * 
+ * + * string uri = 3; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uri_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) + private static final com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata(); + } + + public static com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchRecognizeTranscriptionMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchRecognizeTranscriptionMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadataOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadataOrBuilder.java new file mode 100644 index 000000000000..f2763466c9d6 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/BatchRecognizeTranscriptionMetadataOrBuilder.java @@ -0,0 +1,98 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface BatchRecognizeTranscriptionMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * How much of the file has been transcribed so far.
+   * 
+ * + * int32 progress_percent = 1; + * + * @return The progressPercent. + */ + int getProgressPercent(); + + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return Whether the error field is set. + */ + boolean hasError(); + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + * + * @return The error. + */ + com.google.rpc.Status getError(); + /** + * + * + *
+   * Error if one was encountered.
+   * 
+ * + * .google.rpc.Status error = 2; + */ + com.google.rpc.StatusOrBuilder getErrorOrBuilder(); + + /** + * + * + *
+   * The GCS URI to which recognition results will be written.
+   * 
+ * + * string uri = 3; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * The GCS URI to which recognition results will be written.
+   * 
+ * + * string uri = 3; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CloudSpeechProto.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CloudSpeechProto.java new file mode 100644 index 000000000000..dabcad59583b --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CloudSpeechProto.java @@ -0,0 +1,1346 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public final class CloudSpeechProto { + private CloudSpeechProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_CreateRecognizerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_CreateRecognizerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_OperationMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_OperationMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_ListRecognizersRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_ListRecognizersRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_ListRecognizersResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_ListRecognizersResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_GetRecognizerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_GetRecognizerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_UpdateRecognizerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_UpdateRecognizerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_DeleteRecognizerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_DeleteRecognizerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_UndeleteRecognizerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_UndeleteRecognizerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_Recognizer_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_Recognizer_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_Recognizer_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_Recognizer_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_AutoDetectDecodingConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_AutoDetectDecodingConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_ExplicitDecodingConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_ExplicitDecodingConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_SpeakerDiarizationConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_SpeakerDiarizationConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_RecognitionFeatures_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_RecognitionFeatures_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_SpeechAdaptation_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_SpeechAdaptation_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_SpeechAdaptation_AdaptationPhraseSet_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_SpeechAdaptation_AdaptationPhraseSet_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_RecognitionConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_RecognitionConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_RecognizeRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_RecognizeRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_RecognitionResponseMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_RecognitionResponseMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_SpeechRecognitionAlternative_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_SpeechRecognitionAlternative_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_WordInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_WordInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_SpeechRecognitionResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_SpeechRecognitionResult_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_RecognizeResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_RecognizeResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_VoiceActivityTimeout_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_VoiceActivityTimeout_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_StreamingRecognitionConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_StreamingRecognitionConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_StreamingRecognizeRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_StreamingRecognizeRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeResponse_ResultsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeResponse_ResultsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeFileResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeFileResult_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeTranscriptionMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeTranscriptionMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_TranscriptionMetadataEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeMetadata_TranscriptionMetadataEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_BatchRecognizeFileMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_BatchRecognizeFileMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_StreamingRecognitionResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_StreamingRecognitionResult_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_StreamingRecognizeResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_StreamingRecognizeResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_Config_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_Config_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_GetConfigRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_GetConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_UpdateConfigRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_UpdateConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_CustomClass_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_CustomClass_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_CustomClass_ClassItem_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_CustomClass_ClassItem_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_CustomClass_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_CustomClass_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_PhraseSet_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_PhraseSet_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_PhraseSet_Phrase_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_PhraseSet_Phrase_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_PhraseSet_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_PhraseSet_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_CreateCustomClassRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_CreateCustomClassRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_ListCustomClassesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_ListCustomClassesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_ListCustomClassesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_ListCustomClassesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_GetCustomClassRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_GetCustomClassRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_UpdateCustomClassRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_UpdateCustomClassRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_DeleteCustomClassRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_DeleteCustomClassRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_UndeleteCustomClassRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_UndeleteCustomClassRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_CreatePhraseSetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_CreatePhraseSetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_ListPhraseSetsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_ListPhraseSetsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_ListPhraseSetsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_ListPhraseSetsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_GetPhraseSetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_GetPhraseSetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_UpdatePhraseSetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_UpdatePhraseSetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_DeletePhraseSetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_DeletePhraseSetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_speech_v2_UndeletePhraseSetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_speech_v2_UndeletePhraseSetRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n)google/cloud/speech/v2/cloud_speech.pr" + + "oto\022\026google.cloud.speech.v2\032\034google/api/" + + "annotations.proto\032\027google/api/client.pro" + + "to\032\037google/api/field_behavior.proto\032\031goo" + + "gle/api/resource.proto\032#google/longrunni" + + "ng/operations.proto\032\036google/protobuf/dur" + + "ation.proto\032 google/protobuf/field_mask." + + "proto\032\037google/protobuf/timestamp.proto\032\027" + + "google/rpc/status.proto\"\276\001\n\027CreateRecogn" + + "izerRequest\022;\n\nrecognizer\030\001 \001(\0132\".google" + + ".cloud.speech.v2.RecognizerB\003\340A\002\022\025\n\rvali" + + "date_only\030\002 \001(\010\022\025\n\rrecognizer_id\030\003 \001(\t\0228" + + "\n\006parent\030\004 \001(\tB(\340A\002\372A\"\022 speech.googleapi" + + "s.com/Recognizer\"\343\014\n\021OperationMetadata\022/" + + "\n\013create_time\030\001 \001(\0132\032.google.protobuf.Ti" + + "mestamp\022/\n\013update_time\030\002 \001(\0132\032.google.pr" + + "otobuf.Timestamp\022\020\n\010resource\030\003 \001(\t\022\016\n\006me" + + "thod\030\004 \001(\t\022<\n\014kms_key_name\030\006 \001(\tB&\372A#\n!c" + + "loudkms.googleapis.com/CryptoKey\022K\n\024kms_" + + "key_version_name\030\007 \001(\tB-\372A*\n(cloudkms.go" + + "ogleapis.com/CryptoKeyVersion\022P\n\027batch_r" + + "ecognize_request\030\010 \001(\0132-.google.cloud.sp" + + "eech.v2.BatchRecognizeRequestH\000\022T\n\031creat" + + "e_recognizer_request\030\t \001(\0132/.google.clou" + + "d.speech.v2.CreateRecognizerRequestH\000\022T\n" + + "\031update_recognizer_request\030\n \001(\0132/.googl" + + "e.cloud.speech.v2.UpdateRecognizerReques" + + "tH\000\022T\n\031delete_recognizer_request\030\013 \001(\0132/" + + ".google.cloud.speech.v2.DeleteRecognizer" + + "RequestH\000\022X\n\033undelete_recognizer_request" + + "\030\014 \001(\01321.google.cloud.speech.v2.Undelete" + + "RecognizerRequestH\000\022W\n\033create_custom_cla" + + "ss_request\030\r \001(\01320.google.cloud.speech.v" + + "2.CreateCustomClassRequestH\000\022W\n\033update_c" + + "ustom_class_request\030\016 \001(\01320.google.cloud" + + ".speech.v2.UpdateCustomClassRequestH\000\022W\n" + + "\033delete_custom_class_request\030\017 \001(\01320.goo" + + "gle.cloud.speech.v2.DeleteCustomClassReq" + + "uestH\000\022[\n\035undelete_custom_class_request\030" + + "\020 \001(\01322.google.cloud.speech.v2.UndeleteC" + + "ustomClassRequestH\000\022S\n\031create_phrase_set" + + "_request\030\021 \001(\0132..google.cloud.speech.v2." + + "CreatePhraseSetRequestH\000\022S\n\031update_phras" + + "e_set_request\030\022 \001(\0132..google.cloud.speec" + + "h.v2.UpdatePhraseSetRequestH\000\022S\n\031delete_" + + "phrase_set_request\030\023 \001(\0132..google.cloud." + + "speech.v2.DeletePhraseSetRequestH\000\022W\n\033un" + + "delete_phrase_set_request\030\024 \001(\01320.google" + + ".cloud.speech.v2.UndeletePhraseSetReques" + + "tH\000\022L\n\025update_config_request\030\025 \001(\0132+.goo" + + "gle.cloud.speech.v2.UpdateConfigRequestH" + + "\000\022\030\n\020progress_percent\030\026 \001(\005\022R\n\030batch_rec" + + "ognize_metadata\030\027 \001(\0132..google.cloud.spe" + + "ech.v2.BatchRecognizeMetadataH\001B\t\n\007reque" + + "stB\n\n\010metadata\"\220\001\n\026ListRecognizersReques" + + "t\0229\n\006parent\030\001 \001(\tB)\340A\002\372A#\n!locations.goo" + + "gleapis.com/Location\022\021\n\tpage_size\030\002 \001(\005\022" + + "\022\n\npage_token\030\003 \001(\t\022\024\n\014show_deleted\030\004 \001(" + + "\010\"k\n\027ListRecognizersResponse\0227\n\013recogniz" + + "ers\030\001 \003(\0132\".google.cloud.speech.v2.Recog" + + "nizer\022\027\n\017next_page_token\030\002 \001(\t\"N\n\024GetRec" + + "ognizerRequest\0226\n\004name\030\001 \001(\tB(\340A\002\372A\"\n sp" + + "eech.googleapis.com/Recognizer\"\236\001\n\027Updat" + + "eRecognizerRequest\022;\n\nrecognizer\030\001 \001(\0132\"" + + ".google.cloud.speech.v2.RecognizerB\003\340A\002\022" + + "/\n\013update_mask\030\002 \001(\0132\032.google.protobuf.F" + + "ieldMask\022\025\n\rvalidate_only\030\004 \001(\010\"\215\001\n\027Dele" + + "teRecognizerRequest\0226\n\004name\030\001 \001(\tB(\340A\002\372A" + + "\"\n speech.googleapis.com/Recognizer\022\025\n\rv" + + "alidate_only\030\002 \001(\010\022\025\n\rallow_missing\030\004 \001(" + + "\010\022\014\n\004etag\030\003 \001(\t\"x\n\031UndeleteRecognizerReq" + + "uest\0226\n\004name\030\001 \001(\tB(\340A\002\372A\"\n speech.googl" + + "eapis.com/Recognizer\022\025\n\rvalidate_only\030\003 " + + "\001(\010\022\014\n\004etag\030\004 \001(\t\"\276\007\n\nRecognizer\022\021\n\004name" + + "\030\001 \001(\tB\003\340A\003\022\020\n\003uid\030\002 \001(\tB\003\340A\003\022\024\n\014display" + + "_name\030\003 \001(\t\022\022\n\005model\030\004 \001(\tB\003\340A\002\022\033\n\016langu" + + "age_codes\030\021 \003(\tB\003\340A\002\022M\n\032default_recognit" + + "ion_config\030\006 \001(\0132).google.cloud.speech.v" + + "2.RecognitionConfig\022H\n\013annotations\030\007 \003(\013" + + "23.google.cloud.speech.v2.Recognizer.Ann" + + "otationsEntry\022<\n\005state\030\010 \001(\0162(.google.cl" + + "oud.speech.v2.Recognizer.StateB\003\340A\003\0224\n\013c" + + "reate_time\030\t \001(\0132\032.google.protobuf.Times" + + "tampB\003\340A\003\0224\n\013update_time\030\n \001(\0132\032.google." + + "protobuf.TimestampB\003\340A\003\0224\n\013delete_time\030\013" + + " \001(\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n" + + "\013expire_time\030\016 \001(\0132\032.google.protobuf.Tim" + + "estampB\003\340A\003\022\021\n\004etag\030\014 \001(\tB\003\340A\003\022\030\n\013reconc" + + "iling\030\r \001(\010B\003\340A\003\022?\n\014kms_key_name\030\017 \001(\tB)" + + "\340A\003\372A#\n!cloudkms.googleapis.com/CryptoKe" + + "y\022N\n\024kms_key_version_name\030\020 \001(\tB0\340A\003\372A*\n" + + "(cloudkms.googleapis.com/CryptoKeyVersio" + + "n\0322\n\020AnnotationsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005va" + + "lue\030\002 \001(\t:\0028\001\"7\n\005State\022\025\n\021STATE_UNSPECIF" + + "IED\020\000\022\n\n\006ACTIVE\020\002\022\013\n\007DELETED\020\004:j\352Ag\n spe" + + "ech.googleapis.com/Recognizer\022@projects/" + + "{project}/locations/{location}/recognize" + + "rs/{recognizer}R\001\001\"\032\n\030AutoDetectDecoding" + + "Config\"\371\001\n\026ExplicitDecodingConfig\022S\n\010enc" + + "oding\030\001 \001(\0162<.google.cloud.speech.v2.Exp" + + "licitDecodingConfig.AudioEncodingB\003\340A\002\022\031" + + "\n\021sample_rate_hertz\030\002 \001(\005\022\033\n\023audio_chann" + + "el_count\030\003 \001(\005\"R\n\rAudioEncoding\022\036\n\032AUDIO" + + "_ENCODING_UNSPECIFIED\020\000\022\014\n\010LINEAR16\020\001\022\t\n" + + "\005MULAW\020\002\022\010\n\004ALAW\020\003\"Z\n\030SpeakerDiarization" + + "Config\022\036\n\021min_speaker_count\030\002 \001(\005B\003\340A\002\022\036" + + "\n\021max_speaker_count\030\003 \001(\005B\003\340A\002\"\370\003\n\023Recog" + + "nitionFeatures\022\030\n\020profanity_filter\030\001 \001(\010" + + "\022 \n\030enable_word_time_offsets\030\002 \001(\010\022\036\n\026en" + + "able_word_confidence\030\003 \001(\010\022$\n\034enable_aut" + + "omatic_punctuation\030\004 \001(\010\022!\n\031enable_spoke" + + "n_punctuation\030\016 \001(\010\022\034\n\024enable_spoken_emo" + + "jis\030\017 \001(\010\022X\n\022multi_channel_mode\030\021 \001(\0162<." + + "google.cloud.speech.v2.RecognitionFeatur" + + "es.MultiChannelMode\022L\n\022diarization_confi" + + "g\030\t \001(\01320.google.cloud.speech.v2.Speaker" + + "DiarizationConfig\022\030\n\020max_alternatives\030\020 " + + "\001(\005\"\\\n\020MultiChannelMode\022\"\n\036MULTI_CHANNEL" + + "_MODE_UNSPECIFIED\020\000\022$\n SEPARATE_RECOGNIT" + + "ION_PER_CHANNEL\020\001\"\277\002\n\020SpeechAdaptation\022Q" + + "\n\013phrase_sets\030\001 \003(\0132<.google.cloud.speec" + + "h.v2.SpeechAdaptation.AdaptationPhraseSe" + + "t\022;\n\016custom_classes\030\002 \003(\0132#.google.cloud" + + ".speech.v2.CustomClass\032\232\001\n\023AdaptationPhr" + + "aseSet\022:\n\nphrase_set\030\001 \001(\tB$\372A!\n\037speech." + + "googleapis.com/PhraseSetH\000\022>\n\021inline_phr" + + "ase_set\030\002 \001(\0132!.google.cloud.speech.v2.P" + + "hraseSetH\000B\007\n\005value\"\311\002\n\021RecognitionConfi" + + "g\022P\n\024auto_decoding_config\030\007 \001(\01320.google" + + ".cloud.speech.v2.AutoDetectDecodingConfi" + + "gH\000\022R\n\030explicit_decoding_config\030\010 \001(\0132.." + + "google.cloud.speech.v2.ExplicitDecodingC" + + "onfigH\000\022=\n\010features\030\002 \001(\0132+.google.cloud" + + ".speech.v2.RecognitionFeatures\022<\n\nadapta" + + "tion\030\006 \001(\0132(.google.cloud.speech.v2.Spee" + + "chAdaptationB\021\n\017decoding_config\"\356\001\n\020Reco" + + "gnizeRequest\022<\n\nrecognizer\030\003 \001(\tB(\340A\002\372A\"" + + "\n speech.googleapis.com/Recognizer\0229\n\006co" + + "nfig\030\001 \001(\0132).google.cloud.speech.v2.Reco" + + "gnitionConfig\022/\n\013config_mask\030\010 \001(\0132\032.goo" + + "gle.protobuf.FieldMask\022\021\n\007content\030\005 \001(\014H" + + "\000\022\r\n\003uri\030\006 \001(\tH\000B\016\n\014audio_source\"W\n\033Reco" + + "gnitionResponseMetadata\0228\n\025total_billed_" + + "duration\030\006 \001(\0132\031.google.protobuf.Duratio" + + "n\"w\n\034SpeechRecognitionAlternative\022\022\n\ntra" + + "nscript\030\001 \001(\t\022\022\n\nconfidence\030\002 \001(\002\022/\n\005wor" + + "ds\030\003 \003(\0132 .google.cloud.speech.v2.WordIn" + + "fo\"\243\001\n\010WordInfo\022/\n\014start_offset\030\001 \001(\0132\031." + + "google.protobuf.Duration\022-\n\nend_offset\030\002" + + " \001(\0132\031.google.protobuf.Duration\022\014\n\004word\030" + + "\003 \001(\t\022\022\n\nconfidence\030\004 \001(\002\022\025\n\rspeaker_lab" + + "el\030\006 \001(\t\"\314\001\n\027SpeechRecognitionResult\022J\n\014" + + "alternatives\030\001 \003(\01324.google.cloud.speech" + + ".v2.SpeechRecognitionAlternative\022\023\n\013chan" + + "nel_tag\030\002 \001(\005\0224\n\021result_end_offset\030\004 \001(\013" + + "2\031.google.protobuf.Duration\022\032\n\rlanguage_" + + "code\030\005 \001(\tB\003\340A\003\"\234\001\n\021RecognizeResponse\022@\n" + + "\007results\030\003 \003(\0132/.google.cloud.speech.v2." + + "SpeechRecognitionResult\022E\n\010metadata\030\002 \001(" + + "\01323.google.cloud.speech.v2.RecognitionRe" + + "sponseMetadata\"\321\002\n\034StreamingRecognitionF" + + "eatures\022$\n\034enable_voice_activity_events\030" + + "\001 \001(\010\022\027\n\017interim_results\030\002 \001(\010\022i\n\026voice_" + + "activity_timeout\030\003 \001(\0132I.google.cloud.sp" + + "eech.v2.StreamingRecognitionFeatures.Voi" + + "ceActivityTimeout\032\206\001\n\024VoiceActivityTimeo" + + "ut\0227\n\024speech_start_timeout\030\001 \001(\0132\031.googl" + + "e.protobuf.Duration\0225\n\022speech_end_timeou" + + "t\030\002 \001(\0132\031.google.protobuf.Duration\"\337\001\n\032S" + + "treamingRecognitionConfig\022>\n\006config\030\001 \001(" + + "\0132).google.cloud.speech.v2.RecognitionCo" + + "nfigB\003\340A\002\022/\n\013config_mask\030\003 \001(\0132\032.google." + + "protobuf.FieldMask\022P\n\022streaming_features" + + "\030\002 \001(\01324.google.cloud.speech.v2.Streamin" + + "gRecognitionFeatures\"\317\001\n\031StreamingRecogn" + + "izeRequest\022<\n\nrecognizer\030\003 \001(\tB(\340A\002\372A\"\n " + + "speech.googleapis.com/Recognizer\022N\n\020stre" + + "aming_config\030\006 \001(\01322.google.cloud.speech" + + ".v2.StreamingRecognitionConfigH\000\022\017\n\005audi" + + "o\030\005 \001(\014H\000B\023\n\021streaming_request\"\204\002\n\025Batch" + + "RecognizeRequest\022<\n\nrecognizer\030\001 \001(\tB(\340A" + + "\002\372A\"\n speech.googleapis.com/Recognizer\0229" + + "\n\006config\030\004 \001(\0132).google.cloud.speech.v2." + + "RecognitionConfig\022/\n\013config_mask\030\005 \001(\0132\032" + + ".google.protobuf.FieldMask\022A\n\005files\030\003 \003(" + + "\01322.google.cloud.speech.v2.BatchRecogniz" + + "eFileMetadata\"\310\001\n\026BatchRecognizeResponse" + + "\022L\n\007results\030\001 \003(\0132;.google.cloud.speech." + + "v2.BatchRecognizeResponse.ResultsEntry\032`" + + "\n\014ResultsEntry\022\013\n\003key\030\001 \001(\t\022?\n\005value\030\002 \001" + + "(\01320.google.cloud.speech.v2.BatchRecogni" + + "zeFileResult:\0028\001\"J\n\030BatchRecognizeFileRe" + + "sult\022\013\n\003uri\030\001 \001(\t\022!\n\005error\030\002 \001(\0132\022.googl" + + "e.rpc.Status\"o\n#BatchRecognizeTranscript" + + "ionMetadata\022\030\n\020progress_percent\030\001 \001(\005\022!\n" + + "\005error\030\002 \001(\0132\022.google.rpc.Status\022\013\n\003uri\030" + + "\003 \001(\t\"\376\001\n\026BatchRecognizeMetadata\022i\n\026tran" + + "scription_metadata\030\001 \003(\0132I.google.cloud." + + "speech.v2.BatchRecognizeMetadata.Transcr" + + "iptionMetadataEntry\032y\n\032TranscriptionMeta" + + "dataEntry\022\013\n\003key\030\001 \001(\t\022J\n\005value\030\002 \001(\0132;." + + "google.cloud.speech.v2.BatchRecognizeTra" + + "nscriptionMetadata:\0028\001\"\247\001\n\032BatchRecogniz" + + "eFileMetadata\022\r\n\003uri\030\001 \001(\tH\000\0229\n\006config\030\004" + + " \001(\0132).google.cloud.speech.v2.Recognitio" + + "nConfig\022/\n\013config_mask\030\005 \001(\0132\032.google.pr" + + "otobuf.FieldMaskB\016\n\014audio_source\"\364\001\n\032Str" + + "eamingRecognitionResult\022J\n\014alternatives\030" + + "\001 \003(\01324.google.cloud.speech.v2.SpeechRec" + + "ognitionAlternative\022\020\n\010is_final\030\002 \001(\010\022\021\n" + + "\tstability\030\003 \001(\002\0224\n\021result_end_offset\030\004 " + + "\001(\0132\031.google.protobuf.Duration\022\023\n\013channe" + + "l_tag\030\005 \001(\005\022\032\n\rlanguage_code\030\006 \001(\tB\003\340A\003\"" + + "\307\003\n\032StreamingRecognizeResponse\022C\n\007result" + + "s\030\006 \003(\01322.google.cloud.speech.v2.Streami" + + "ngRecognitionResult\022]\n\021speech_event_type" + + "\030\003 \001(\0162B.google.cloud.speech.v2.Streamin" + + "gRecognizeResponse.SpeechEventType\0226\n\023sp" + + "eech_event_offset\030\007 \001(\0132\031.google.protobu" + + "f.Duration\022E\n\010metadata\030\005 \001(\01323.google.cl" + + "oud.speech.v2.RecognitionResponseMetadat" + + "a\"\205\001\n\017SpeechEventType\022!\n\035SPEECH_EVENT_TY" + + "PE_UNSPECIFIED\020\000\022\033\n\027END_OF_SINGLE_UTTERA" + + "NCE\020\001\022\031\n\025SPEECH_ACTIVITY_BEGIN\020\002\022\027\n\023SPEE" + + "CH_ACTIVITY_END\020\003\"\345\001\n\006Config\022\021\n\004name\030\001 \001" + + "(\tB\003\340A\003\022?\n\014kms_key_name\030\002 \001(\tB)\340A\001\372A#\n!c" + + "loudkms.googleapis.com/CryptoKey\0224\n\013upda" + + "te_time\030\003 \001(\0132\032.google.protobuf.Timestam" + + "pB\003\340A\003:Q\352AN\n\034speech.googleapis.com/Confi" + + "g\022.projects/{project}/locations/{locatio" + + "n}/config\"F\n\020GetConfigRequest\0222\n\004name\030\001 " + + "\001(\tB$\340A\002\372A\036\n\034speech.googleapis.com/Confi" + + "g\"{\n\023UpdateConfigRequest\0223\n\006config\030\001 \001(\013" + + "2\036.google.cloud.speech.v2.ConfigB\003\340A\002\022/\n" + + "\013update_mask\030\002 \001(\0132\032.google.protobuf.Fie" + + "ldMask\"\240\007\n\013CustomClass\022\021\n\004name\030\001 \001(\tB\003\340A" + + "\003\022\020\n\003uid\030\002 \001(\tB\003\340A\003\022\024\n\014display_name\030\004 \001(" + + "\t\022<\n\005items\030\005 \003(\0132-.google.cloud.speech.v" + + "2.CustomClass.ClassItem\022=\n\005state\030\017 \001(\0162)" + + ".google.cloud.speech.v2.CustomClass.Stat" + + "eB\003\340A\003\0224\n\013create_time\030\006 \001(\0132\032.google.pro" + + "tobuf.TimestampB\003\340A\003\0224\n\013update_time\030\007 \001(" + + "\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n\013de" + + "lete_time\030\010 \001(\0132\032.google.protobuf.Timest" + + "ampB\003\340A\003\0224\n\013expire_time\030\t \001(\0132\032.google.p" + + "rotobuf.TimestampB\003\340A\003\022I\n\013annotations\030\n " + + "\003(\01324.google.cloud.speech.v2.CustomClass" + + ".AnnotationsEntry\022\021\n\004etag\030\013 \001(\tB\003\340A\003\022\030\n\013" + + "reconciling\030\014 \001(\010B\003\340A\003\022?\n\014kms_key_name\030\r" + + " \001(\tB)\340A\003\372A#\n!cloudkms.googleapis.com/Cr" + + "yptoKey\022N\n\024kms_key_version_name\030\016 \001(\tB0\340" + + "A\003\372A*\n(cloudkms.googleapis.com/CryptoKey" + + "Version\032\032\n\tClassItem\022\r\n\005value\030\001 \001(\t\0322\n\020A" + + "nnotationsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 " + + "\001(\t:\0028\001\"7\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022" + + "\n\n\006ACTIVE\020\002\022\013\n\007DELETED\020\004:o\352Al\n!speech.go" + + "ogleapis.com/CustomClass\022Dprojects/{proj" + + "ect}/locations/{location}/customClasses/" + + "{custom_class}R\001\001\"\253\007\n\tPhraseSet\022\021\n\004name\030" + + "\001 \001(\tB\003\340A\003\022\020\n\003uid\030\002 \001(\tB\003\340A\003\0229\n\007phrases\030" + + "\003 \003(\0132(.google.cloud.speech.v2.PhraseSet" + + ".Phrase\022\r\n\005boost\030\004 \001(\002\022\024\n\014display_name\030\005" + + " \001(\t\022;\n\005state\030\017 \001(\0162\'.google.cloud.speec" + + "h.v2.PhraseSet.StateB\003\340A\003\0224\n\013create_time" + + "\030\006 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022" + + "4\n\013update_time\030\007 \001(\0132\032.google.protobuf.T" + + "imestampB\003\340A\003\0224\n\013delete_time\030\010 \001(\0132\032.goo" + + "gle.protobuf.TimestampB\003\340A\003\0224\n\013expire_ti" + + "me\030\t \001(\0132\032.google.protobuf.TimestampB\003\340A" + + "\003\022G\n\013annotations\030\n \003(\01322.google.cloud.sp" + + "eech.v2.PhraseSet.AnnotationsEntry\022\021\n\004et" + + "ag\030\013 \001(\tB\003\340A\003\022\030\n\013reconciling\030\014 \001(\010B\003\340A\003\022" + + "?\n\014kms_key_name\030\r \001(\tB)\340A\003\372A#\n!cloudkms." + + "googleapis.com/CryptoKey\022N\n\024kms_key_vers" + + "ion_name\030\016 \001(\tB0\340A\003\372A*\n(cloudkms.googlea" + + "pis.com/CryptoKeyVersion\032&\n\006Phrase\022\r\n\005va" + + "lue\030\001 \001(\t\022\r\n\005boost\030\002 \001(\002\0322\n\020AnnotationsE" + + "ntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"7\n\005" + + "State\022\025\n\021STATE_UNSPECIFIED\020\000\022\n\n\006ACTIVE\020\002" + + "\022\013\n\007DELETED\020\004:h\352Ae\n\037speech.googleapis.co" + + "m/PhraseSet\022?projects/{project}/location" + + "s/{location}/phraseSets/{phrase_set}R\001\001\"" + + "\305\001\n\030CreateCustomClassRequest\022>\n\014custom_c" + + "lass\030\001 \001(\0132#.google.cloud.speech.v2.Cust" + + "omClassB\003\340A\002\022\025\n\rvalidate_only\030\002 \001(\010\022\027\n\017c" + + "ustom_class_id\030\003 \001(\t\0229\n\006parent\030\004 \001(\tB)\340A" + + "\002\372A#\022!speech.googleapis.com/CustomClass\"" + + "\222\001\n\030ListCustomClassesRequest\0229\n\006parent\030\001" + + " \001(\tB)\340A\002\372A#\n!locations.googleapis.com/L" + + "ocation\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token" + + "\030\003 \001(\t\022\024\n\014show_deleted\030\004 \001(\010\"q\n\031ListCust" + + "omClassesResponse\022;\n\016custom_classes\030\001 \003(" + + "\0132#.google.cloud.speech.v2.CustomClass\022\027" + + "\n\017next_page_token\030\002 \001(\t\"P\n\025GetCustomClas" + + "sRequest\0227\n\004name\030\001 \001(\tB)\340A\002\372A#\n!speech.g" + + "oogleapis.com/CustomClass\"\242\001\n\030UpdateCust" + + "omClassRequest\022>\n\014custom_class\030\001 \001(\0132#.g" + + "oogle.cloud.speech.v2.CustomClassB\003\340A\002\022/" + + "\n\013update_mask\030\002 \001(\0132\032.google.protobuf.Fi" + + "eldMask\022\025\n\rvalidate_only\030\004 \001(\010\"\217\001\n\030Delet" + + "eCustomClassRequest\0227\n\004name\030\001 \001(\tB)\340A\002\372A" + + "#\n!speech.googleapis.com/CustomClass\022\025\n\r" + + "validate_only\030\002 \001(\010\022\025\n\rallow_missing\030\004 \001" + + "(\010\022\014\n\004etag\030\003 \001(\t\"z\n\032UndeleteCustomClassR" + + "equest\0227\n\004name\030\001 \001(\tB)\340A\002\372A#\n!speech.goo" + + "gleapis.com/CustomClass\022\025\n\rvalidate_only" + + "\030\003 \001(\010\022\014\n\004etag\030\004 \001(\t\"\273\001\n\026CreatePhraseSet" + + "Request\022:\n\nphrase_set\030\001 \001(\0132!.google.clo" + + "ud.speech.v2.PhraseSetB\003\340A\002\022\025\n\rvalidate_" + + "only\030\002 \001(\010\022\025\n\rphrase_set_id\030\003 \001(\t\0227\n\006par" + + "ent\030\004 \001(\tB\'\340A\002\372A!\022\037speech.googleapis.com" + + "/PhraseSet\"\217\001\n\025ListPhraseSetsRequest\0229\n\006" + + "parent\030\001 \001(\tB)\340A\002\372A#\n!locations.googleap" + + "is.com/Location\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npa" + + "ge_token\030\003 \001(\t\022\024\n\014show_deleted\030\004 \001(\010\"i\n\026" + + "ListPhraseSetsResponse\0226\n\013phrase_sets\030\001 " + + "\003(\0132!.google.cloud.speech.v2.PhraseSet\022\027" + + "\n\017next_page_token\030\002 \001(\t\"L\n\023GetPhraseSetR" + + "equest\0225\n\004name\030\001 \001(\tB\'\340A\002\372A!\n\037speech.goo" + + "gleapis.com/PhraseSet\"\234\001\n\026UpdatePhraseSe" + + "tRequest\022:\n\nphrase_set\030\001 \001(\0132!.google.cl" + + "oud.speech.v2.PhraseSetB\003\340A\002\022/\n\013update_m" + + "ask\030\002 \001(\0132\032.google.protobuf.FieldMask\022\025\n" + + "\rvalidate_only\030\004 \001(\010\"\213\001\n\026DeletePhraseSet" + + "Request\0225\n\004name\030\001 \001(\tB\'\340A\002\372A!\n\037speech.go" + + "ogleapis.com/PhraseSet\022\025\n\rvalidate_only\030" + + "\002 \001(\010\022\025\n\rallow_missing\030\004 \001(\010\022\014\n\004etag\030\003 \001" + + "(\t\"v\n\030UndeletePhraseSetRequest\0225\n\004name\030\001" + + " \001(\tB\'\340A\002\372A!\n\037speech.googleapis.com/Phra" + + "seSet\022\025\n\rvalidate_only\030\003 \001(\010\022\014\n\004etag\030\004 \001" + + "(\t2\277%\n\006Speech\022\354\001\n\020CreateRecognizer\022/.goo" + + "gle.cloud.speech.v2.CreateRecognizerRequ" + + "est\032\035.google.longrunning.Operation\"\207\001\202\323\344" + + "\223\002=\"//v2/{parent=projects/*/locations/*}" + + "/recognizers:\nrecognizer\332A\037parent,recogn" + + "izer,recognizer_id\312A\037\n\nRecognizer\022\021Opera" + + "tionMetadata\022\264\001\n\017ListRecognizers\022..googl" + + "e.cloud.speech.v2.ListRecognizersRequest" + + "\032/.google.cloud.speech.v2.ListRecognizer" + + "sResponse\"@\202\323\344\223\0021\022//v2/{parent=projects/" + + "*/locations/*}/recognizers\332A\006parent\022\241\001\n\r" + + "GetRecognizer\022,.google.cloud.speech.v2.G" + + "etRecognizerRequest\032\".google.cloud.speec" + + "h.v2.Recognizer\">\202\323\344\223\0021\022//v2/{name=proje" + + "cts/*/locations/*/recognizers/*}\332A\004name\022" + + "\356\001\n\020UpdateRecognizer\022/.google.cloud.spee" + + "ch.v2.UpdateRecognizerRequest\032\035.google.l" + + "ongrunning.Operation\"\211\001\202\323\344\223\002H2:/v2/{reco" + + "gnizer.name=projects/*/locations/*/recog" + + "nizers/*}:\nrecognizer\332A\026recognizer,updat" + + "e_mask\312A\037\n\nRecognizer\022\021OperationMetadata" + + "\022\304\001\n\020DeleteRecognizer\022/.google.cloud.spe" + + "ech.v2.DeleteRecognizerRequest\032\035.google." + + "longrunning.Operation\"`\202\323\344\223\0021*//v2/{name" + + "=projects/*/locations/*/recognizers/*}\332A" + + "\004name\312A\037\n\nRecognizer\022\021OperationMetadata\022" + + "\324\001\n\022UndeleteRecognizer\0221.google.cloud.sp" + + "eech.v2.UndeleteRecognizerRequest\032\035.goog" + + "le.longrunning.Operation\"l\202\323\344\223\002=\"8/v2/{n" + + "ame=projects/*/locations/*/recognizers/*" + + "}:undelete:\001*\332A\004name\312A\037\n\nRecognizer\022\021Ope" + + "rationMetadata\022\371\001\n\tRecognize\022(.google.cl" + + "oud.speech.v2.RecognizeRequest\032).google." + + "cloud.speech.v2.RecognizeResponse\"\226\001\202\323\344\223" + + "\002D\"?/v2/{recognizer=projects/*/locations" + + "/*/recognizers/*}:recognize:\001*\332A%recogni" + + "zer,config,config_mask,content\332A!recogni" + + "zer,config,config_mask,uri\022\201\001\n\022Streaming" + + "Recognize\0221.google.cloud.speech.v2.Strea" + + "mingRecognizeRequest\0322.google.cloud.spee" + + "ch.v2.StreamingRecognizeResponse\"\000(\0010\001\022\204" + + "\002\n\016BatchRecognize\022-.google.cloud.speech." + + "v2.BatchRecognizeRequest\032\035.google.longru" + + "nning.Operation\"\243\001\202\323\344\223\002I\"D/v2/{recognize" + + "r=projects/*/locations/*/recognizers/*}:" + + "batchRecognize:\001*\332A#recognizer,config,co" + + "nfig_mask,files\312A+\n\026BatchRecognizeRespon" + + "se\022\021OperationMetadata\022\216\001\n\tGetConfig\022(.go" + + "ogle.cloud.speech.v2.GetConfigRequest\032\036." + + "google.cloud.speech.v2.Config\"7\202\323\344\223\002*\022(/" + + "v2/{name=projects/*/locations/*/config}\332" + + "A\004name\022\261\001\n\014UpdateConfig\022+.google.cloud.s" + + "peech.v2.UpdateConfigRequest\032\036.google.cl" + + "oud.speech.v2.Config\"T\202\323\344\223\00292//v2/{confi" + + "g.name=projects/*/locations/*/config}:\006c" + + "onfig\332A\022config,update_mask\022\367\001\n\021CreateCus" + + "tomClass\0220.google.cloud.speech.v2.Create" + + "CustomClassRequest\032\035.google.longrunning." + + "Operation\"\220\001\202\323\344\223\002A\"1/v2/{parent=projects" + + "/*/locations/*}/customClasses:\014custom_cl" + + "ass\332A#parent,custom_class,custom_class_i" + + "d\312A \n\013CustomClass\022\021OperationMetadata\022\274\001\n" + + "\021ListCustomClasses\0220.google.cloud.speech" + + ".v2.ListCustomClassesRequest\0321.google.cl" + + "oud.speech.v2.ListCustomClassesResponse\"" + + "B\202\323\344\223\0023\0221/v2/{parent=projects/*/location" + + "s/*}/customClasses\332A\006parent\022\246\001\n\016GetCusto" + + "mClass\022-.google.cloud.speech.v2.GetCusto" + + "mClassRequest\032#.google.cloud.speech.v2.C" + + "ustomClass\"@\202\323\344\223\0023\0221/v2/{name=projects/*", + "/locations/*/customClasses/*}\332A\004name\022\371\001\n" + + "\021UpdateCustomClass\0220.google.cloud.speech" + + ".v2.UpdateCustomClassRequest\032\035.google.lo" + + "ngrunning.Operation\"\222\001\202\323\344\223\002N2>/v2/{custo" + + "m_class.name=projects/*/locations/*/cust" + + "omClasses/*}:\014custom_class\332A\030custom_clas" + + "s,update_mask\312A \n\013CustomClass\022\021Operation" + + "Metadata\022\311\001\n\021DeleteCustomClass\0220.google." + + "cloud.speech.v2.DeleteCustomClassRequest" + + "\032\035.google.longrunning.Operation\"c\202\323\344\223\0023*" + + "1/v2/{name=projects/*/locations/*/custom" + + "Classes/*}\332A\004name\312A \n\013CustomClass\022\021Opera" + + "tionMetadata\022\331\001\n\023UndeleteCustomClass\0222.g" + + "oogle.cloud.speech.v2.UndeleteCustomClas" + + "sRequest\032\035.google.longrunning.Operation\"" + + "o\202\323\344\223\002?\":/v2/{name=projects/*/locations/" + + "*/customClasses/*}:undelete:\001*\332A\004name\312A " + + "\n\013CustomClass\022\021OperationMetadata\022\350\001\n\017Cre" + + "atePhraseSet\022..google.cloud.speech.v2.Cr" + + "eatePhraseSetRequest\032\035.google.longrunnin" + + "g.Operation\"\205\001\202\323\344\223\002<\"./v2/{parent=projec" + + "ts/*/locations/*}/phraseSets:\nphrase_set" + + "\332A\037parent,phrase_set,phrase_set_id\312A\036\n\tP" + + "hraseSet\022\021OperationMetadata\022\260\001\n\016ListPhra" + + "seSets\022-.google.cloud.speech.v2.ListPhra" + + "seSetsRequest\032..google.cloud.speech.v2.L" + + "istPhraseSetsResponse\"?\202\323\344\223\0020\022./v2/{pare" + + "nt=projects/*/locations/*}/phraseSets\332A\006" + + "parent\022\235\001\n\014GetPhraseSet\022+.google.cloud.s" + + "peech.v2.GetPhraseSetRequest\032!.google.cl" + + "oud.speech.v2.PhraseSet\"=\202\323\344\223\0020\022./v2/{na" + + "me=projects/*/locations/*/phraseSets/*}\332" + + "A\004name\022\352\001\n\017UpdatePhraseSet\022..google.clou" + + "d.speech.v2.UpdatePhraseSetRequest\032\035.goo" + + "gle.longrunning.Operation\"\207\001\202\323\344\223\002G29/v2/" + + "{phrase_set.name=projects/*/locations/*/" + + "phraseSets/*}:\nphrase_set\332A\026phrase_set,u" + + "pdate_mask\312A\036\n\tPhraseSet\022\021OperationMetad" + + "ata\022\300\001\n\017DeletePhraseSet\022..google.cloud.s" + + "peech.v2.DeletePhraseSetRequest\032\035.google" + + ".longrunning.Operation\"^\202\323\344\223\0020*./v2/{nam" + + "e=projects/*/locations/*/phraseSets/*}\332A" + + "\004name\312A\036\n\tPhraseSet\022\021OperationMetadata\022\320" + + "\001\n\021UndeletePhraseSet\0220.google.cloud.spee" + + "ch.v2.UndeletePhraseSetRequest\032\035.google." + + "longrunning.Operation\"j\202\323\344\223\002<\"7/v2/{name" + + "=projects/*/locations/*/phraseSets/*}:un" + + "delete:\001*\332A\004name\312A\036\n\tPhraseSet\022\021Operatio" + + "nMetadata\032I\312A\025speech.googleapis.com\322A.ht" + + "tps://www.googleapis.com/auth/cloud-plat" + + "formB\223\003\n\032com.google.cloud.speech.v2B\020Clo" + + "udSpeechProtoP\001Z + * Message representing the config for the Speech-to-Text API. This includes an + * optional [KMS key](https://cloud.google.com/kms/docs/resource-hierarchy#keys) + * with which incoming data will be encrypted. + * + * + * Protobuf type {@code google.cloud.speech.v2.Config} + */ +public final class Config extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.Config) + ConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use Config.newBuilder() to construct. + private Config(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Config() { + name_ = ""; + kmsKeyName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Config(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Config( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyName_ = s; + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Config_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Config_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.Config.class, + com.google.cloud.speech.v2.Config.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. The name of the config resource. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The name of the config resource. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KMS_KEY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object kmsKeyName_; + /** + * + * + *
+   * Optional. An optional [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+   * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+   * this key will not encrypt existing resources using this key; only new
+   * resources will be encrypted using this key. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + @java.lang.Override + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. An optional [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+   * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+   * this key will not encrypt existing resources using this key; only new
+   * resources will be encrypted using this key. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, kmsKeyName_); + } + if (updateTime_ != null) { + output.writeMessage(3, getUpdateTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, kmsKeyName_); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getUpdateTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.Config)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.Config other = (com.google.cloud.speech.v2.Config) obj; + + if (!getName().equals(other.getName())) return false; + if (!getKmsKeyName().equals(other.getKmsKeyName())) return false; + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + KMS_KEY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyName().hashCode(); + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.Config parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.Config parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Config parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.Config parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Config parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.Config parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Config parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.Config parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Config parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.Config parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Config parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.Config parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.Config prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Message representing the config for the Speech-to-Text API. This includes an
+   * optional [KMS key](https://cloud.google.com/kms/docs/resource-hierarchy#keys)
+   * with which incoming data will be encrypted.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.Config} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.Config) + com.google.cloud.speech.v2.ConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Config_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Config_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.Config.class, + com.google.cloud.speech.v2.Config.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.Config.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + kmsKeyName_ = ""; + + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Config_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.Config getDefaultInstanceForType() { + return com.google.cloud.speech.v2.Config.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.Config build() { + com.google.cloud.speech.v2.Config result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.Config buildPartial() { + com.google.cloud.speech.v2.Config result = new com.google.cloud.speech.v2.Config(this); + result.name_ = name_; + result.kmsKeyName_ = kmsKeyName_; + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.Config) { + return mergeFrom((com.google.cloud.speech.v2.Config) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.Config other) { + if (other == com.google.cloud.speech.v2.Config.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getKmsKeyName().isEmpty()) { + kmsKeyName_ = other.kmsKeyName_; + onChanged(); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.Config parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.Config) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The name of the config resource. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The name of the config resource. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The name of the config resource. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the config resource. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the config resource. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyName_ = ""; + /** + * + * + *
+     * Optional. An optional [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+     * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+     * this key will not encrypt existing resources using this key; only new
+     * resources will be encrypted using this key. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. An optional [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+     * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+     * this key will not encrypt existing resources using this key; only new
+     * resources will be encrypted using this key. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. An optional [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+     * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+     * this key will not encrypt existing resources using this key; only new
+     * resources will be encrypted using this key. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+     * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+     * this key will not encrypt existing resources using this key; only new
+     * resources will be encrypted using this key. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyName() { + + kmsKeyName_ = getDefaultInstance().getKmsKeyName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+     * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+     * this key will not encrypt existing resources using this key; only new
+     * resources will be encrypted using this key. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyName_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.Config) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.Config) + private static final com.google.cloud.speech.v2.Config DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.Config(); + } + + public static com.google.cloud.speech.v2.Config getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Config parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Config(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.Config getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigName.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigName.java new file mode 100644 index 000000000000..69de63ede2ae --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ConfigName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/config"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + + @Deprecated + protected ConfigName() { + project = null; + location = null; + } + + private ConfigName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ConfigName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static ConfigName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION.validatedMatch( + formattedString, "ConfigName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ConfigName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate("project", project, "location", location); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ConfigName that = ((ConfigName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}/config. */ + public static class Builder { + private String project; + private String location; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(ConfigName configName) { + this.project = configName.project; + this.location = configName.location; + } + + public ConfigName build() { + return new ConfigName(this); + } + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigOrBuilder.java new file mode 100644 index 000000000000..6d4dd82b7de2 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ConfigOrBuilder.java @@ -0,0 +1,131 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.Config) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The name of the config resource. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The name of the config resource. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Optional. An optional [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+   * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+   * this key will not encrypt existing resources using this key; only new
+   * resources will be encrypted using this key. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + java.lang.String getKmsKeyName(); + /** + * + * + *
+   * Optional. An optional [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
+   * present, will be used to encrypt Speech-to-Text resources at-rest. Updating
+   * this key will not encrypt existing resources using this key; only new
+   * resources will be encrypted using this key. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + com.google.protobuf.ByteString getKmsKeyNameBytes(); + + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequest.java new file mode 100644 index 000000000000..9ccb4af8559a --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequest.java @@ -0,0 +1,1256 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [CreateCustomClass][google.cloud.speech.v2.Speech.CreateCustomClass] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CreateCustomClassRequest} + */ +public final class CreateCustomClassRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.CreateCustomClassRequest) + CreateCustomClassRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateCustomClassRequest.newBuilder() to construct. + private CreateCustomClassRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateCustomClassRequest() { + customClassId_ = ""; + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateCustomClassRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateCustomClassRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.CustomClass.Builder subBuilder = null; + if (customClass_ != null) { + subBuilder = customClass_.toBuilder(); + } + customClass_ = + input.readMessage( + com.google.cloud.speech.v2.CustomClass.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(customClass_); + customClass_ = subBuilder.buildPartial(); + } + + break; + } + case 16: + { + validateOnly_ = input.readBool(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + customClassId_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CreateCustomClassRequest.class, + com.google.cloud.speech.v2.CreateCustomClassRequest.Builder.class); + } + + public static final int CUSTOM_CLASS_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.CustomClass customClass_; + /** + * + * + *
+   * Required. The CustomClass to create.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the customClass field is set. + */ + @java.lang.Override + public boolean hasCustomClass() { + return customClass_ != null; + } + /** + * + * + *
+   * Required. The CustomClass to create.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The customClass. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass getCustomClass() { + return customClass_ == null + ? com.google.cloud.speech.v2.CustomClass.getDefaultInstance() + : customClass_; + } + /** + * + * + *
+   * Required. The CustomClass to create.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassOrBuilder() { + return getCustomClass(); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the CustomClass, but do not
+   * actually create it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int CUSTOM_CLASS_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object customClassId_; + /** + * + * + *
+   * The ID to use for the CustomClass, which will become the final component of
+   * the CustomClass's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string custom_class_id = 3; + * + * @return The customClassId. + */ + @java.lang.Override + public java.lang.String getCustomClassId() { + java.lang.Object ref = customClassId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + customClassId_ = s; + return s; + } + } + /** + * + * + *
+   * The ID to use for the CustomClass, which will become the final component of
+   * the CustomClass's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string custom_class_id = 3; + * + * @return The bytes for customClassId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCustomClassIdBytes() { + java.lang.Object ref = customClassId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + customClassId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARENT_FIELD_NUMBER = 4; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project and location where this CustomClass will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project and location where this CustomClass will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (customClass_ != null) { + output.writeMessage(1, getCustomClass()); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(customClassId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, customClassId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, parent_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (customClass_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCustomClass()); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(customClassId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, customClassId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, parent_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.CreateCustomClassRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.CreateCustomClassRequest other = + (com.google.cloud.speech.v2.CreateCustomClassRequest) obj; + + if (hasCustomClass() != other.hasCustomClass()) return false; + if (hasCustomClass()) { + if (!getCustomClass().equals(other.getCustomClass())) return false; + } + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getCustomClassId().equals(other.getCustomClassId())) return false; + if (!getParent().equals(other.getParent())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCustomClass()) { + hash = (37 * hash) + CUSTOM_CLASS_FIELD_NUMBER; + hash = (53 * hash) + getCustomClass().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + CUSTOM_CLASS_ID_FIELD_NUMBER; + hash = (53 * hash) + getCustomClassId().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.CreateCustomClassRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [CreateCustomClass][google.cloud.speech.v2.Speech.CreateCustomClass] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CreateCustomClassRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.CreateCustomClassRequest) + com.google.cloud.speech.v2.CreateCustomClassRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CreateCustomClassRequest.class, + com.google.cloud.speech.v2.CreateCustomClassRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.CreateCustomClassRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (customClassBuilder_ == null) { + customClass_ = null; + } else { + customClass_ = null; + customClassBuilder_ = null; + } + validateOnly_ = false; + + customClassId_ = ""; + + parent_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateCustomClassRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequest build() { + com.google.cloud.speech.v2.CreateCustomClassRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequest buildPartial() { + com.google.cloud.speech.v2.CreateCustomClassRequest result = + new com.google.cloud.speech.v2.CreateCustomClassRequest(this); + if (customClassBuilder_ == null) { + result.customClass_ = customClass_; + } else { + result.customClass_ = customClassBuilder_.build(); + } + result.validateOnly_ = validateOnly_; + result.customClassId_ = customClassId_; + result.parent_ = parent_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.CreateCustomClassRequest) { + return mergeFrom((com.google.cloud.speech.v2.CreateCustomClassRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.CreateCustomClassRequest other) { + if (other == com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance()) + return this; + if (other.hasCustomClass()) { + mergeCustomClass(other.getCustomClass()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getCustomClassId().isEmpty()) { + customClassId_ = other.customClassId_; + onChanged(); + } + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.CreateCustomClassRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.CreateCustomClassRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.CustomClass customClass_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + customClassBuilder_; + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the customClass field is set. + */ + public boolean hasCustomClass() { + return customClassBuilder_ != null || customClass_ != null; + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The customClass. + */ + public com.google.cloud.speech.v2.CustomClass getCustomClass() { + if (customClassBuilder_ == null) { + return customClass_ == null + ? com.google.cloud.speech.v2.CustomClass.getDefaultInstance() + : customClass_; + } else { + return customClassBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCustomClass(com.google.cloud.speech.v2.CustomClass value) { + if (customClassBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + customClass_ = value; + onChanged(); + } else { + customClassBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCustomClass(com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassBuilder_ == null) { + customClass_ = builderForValue.build(); + onChanged(); + } else { + customClassBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeCustomClass(com.google.cloud.speech.v2.CustomClass value) { + if (customClassBuilder_ == null) { + if (customClass_ != null) { + customClass_ = + com.google.cloud.speech.v2.CustomClass.newBuilder(customClass_) + .mergeFrom(value) + .buildPartial(); + } else { + customClass_ = value; + } + onChanged(); + } else { + customClassBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearCustomClass() { + if (customClassBuilder_ == null) { + customClass_ = null; + onChanged(); + } else { + customClass_ = null; + customClassBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.CustomClass.Builder getCustomClassBuilder() { + + onChanged(); + return getCustomClassFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassOrBuilder() { + if (customClassBuilder_ != null) { + return customClassBuilder_.getMessageOrBuilder(); + } else { + return customClass_ == null + ? com.google.cloud.speech.v2.CustomClass.getDefaultInstance() + : customClass_; + } + } + /** + * + * + *
+     * Required. The CustomClass to create.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + getCustomClassFieldBuilder() { + if (customClassBuilder_ == null) { + customClassBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder>( + getCustomClass(), getParentForChildren(), isClean()); + customClass_ = null; + } + return customClassBuilder_; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the CustomClass, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the CustomClass, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the CustomClass, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object customClassId_ = ""; + /** + * + * + *
+     * The ID to use for the CustomClass, which will become the final component of
+     * the CustomClass's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string custom_class_id = 3; + * + * @return The customClassId. + */ + public java.lang.String getCustomClassId() { + java.lang.Object ref = customClassId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + customClassId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The ID to use for the CustomClass, which will become the final component of
+     * the CustomClass's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string custom_class_id = 3; + * + * @return The bytes for customClassId. + */ + public com.google.protobuf.ByteString getCustomClassIdBytes() { + java.lang.Object ref = customClassId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + customClassId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The ID to use for the CustomClass, which will become the final component of
+     * the CustomClass's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string custom_class_id = 3; + * + * @param value The customClassId to set. + * @return This builder for chaining. + */ + public Builder setCustomClassId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + customClassId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for the CustomClass, which will become the final component of
+     * the CustomClass's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string custom_class_id = 3; + * + * @return This builder for chaining. + */ + public Builder clearCustomClassId() { + + customClassId_ = getDefaultInstance().getCustomClassId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for the CustomClass, which will become the final component of
+     * the CustomClass's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string custom_class_id = 3; + * + * @param value The bytes for customClassId to set. + * @return This builder for chaining. + */ + public Builder setCustomClassIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + customClassId_ = value; + onChanged(); + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project and location where this CustomClass will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project and location where this CustomClass will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project and location where this CustomClass will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location where this CustomClass will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location where this CustomClass will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.CreateCustomClassRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.CreateCustomClassRequest) + private static final com.google.cloud.speech.v2.CreateCustomClassRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.CreateCustomClassRequest(); + } + + public static com.google.cloud.speech.v2.CreateCustomClassRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateCustomClassRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateCustomClassRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequestOrBuilder.java new file mode 100644 index 000000000000..4a356278c295 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateCustomClassRequestOrBuilder.java @@ -0,0 +1,142 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface CreateCustomClassRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.CreateCustomClassRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The CustomClass to create.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the customClass field is set. + */ + boolean hasCustomClass(); + /** + * + * + *
+   * Required. The CustomClass to create.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The customClass. + */ + com.google.cloud.speech.v2.CustomClass getCustomClass(); + /** + * + * + *
+   * Required. The CustomClass to create.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassOrBuilder(); + + /** + * + * + *
+   * If set, validate the request and preview the CustomClass, but do not
+   * actually create it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * The ID to use for the CustomClass, which will become the final component of
+   * the CustomClass's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string custom_class_id = 3; + * + * @return The customClassId. + */ + java.lang.String getCustomClassId(); + /** + * + * + *
+   * The ID to use for the CustomClass, which will become the final component of
+   * the CustomClass's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string custom_class_id = 3; + * + * @return The bytes for customClassId. + */ + com.google.protobuf.ByteString getCustomClassIdBytes(); + + /** + * + * + *
+   * Required. The project and location where this CustomClass will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project and location where this CustomClass will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequest.java new file mode 100644 index 000000000000..7ce66f2c8946 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequest.java @@ -0,0 +1,1256 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [CreatePhraseSet][google.cloud.speech.v2.Speech.CreatePhraseSet] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CreatePhraseSetRequest} + */ +public final class CreatePhraseSetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.CreatePhraseSetRequest) + CreatePhraseSetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreatePhraseSetRequest.newBuilder() to construct. + private CreatePhraseSetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreatePhraseSetRequest() { + phraseSetId_ = ""; + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreatePhraseSetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreatePhraseSetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.PhraseSet.Builder subBuilder = null; + if (phraseSet_ != null) { + subBuilder = phraseSet_.toBuilder(); + } + phraseSet_ = + input.readMessage( + com.google.cloud.speech.v2.PhraseSet.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(phraseSet_); + phraseSet_ = subBuilder.buildPartial(); + } + + break; + } + case 16: + { + validateOnly_ = input.readBool(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + phraseSetId_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreatePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreatePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CreatePhraseSetRequest.class, + com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder.class); + } + + public static final int PHRASE_SET_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.PhraseSet phraseSet_; + /** + * + * + *
+   * Required. The PhraseSet to create.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the phraseSet field is set. + */ + @java.lang.Override + public boolean hasPhraseSet() { + return phraseSet_ != null; + } + /** + * + * + *
+   * Required. The PhraseSet to create.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The phraseSet. + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet getPhraseSet() { + return phraseSet_ == null + ? com.google.cloud.speech.v2.PhraseSet.getDefaultInstance() + : phraseSet_; + } + /** + * + * + *
+   * Required. The PhraseSet to create.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetOrBuilder() { + return getPhraseSet(); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the PhraseSet, but do not
+   * actually create it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int PHRASE_SET_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object phraseSetId_; + /** + * + * + *
+   * The ID to use for the PhraseSet, which will become the final component of
+   * the PhraseSet's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string phrase_set_id = 3; + * + * @return The phraseSetId. + */ + @java.lang.Override + public java.lang.String getPhraseSetId() { + java.lang.Object ref = phraseSetId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + phraseSetId_ = s; + return s; + } + } + /** + * + * + *
+   * The ID to use for the PhraseSet, which will become the final component of
+   * the PhraseSet's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string phrase_set_id = 3; + * + * @return The bytes for phraseSetId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPhraseSetIdBytes() { + java.lang.Object ref = phraseSetId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + phraseSetId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARENT_FIELD_NUMBER = 4; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project and location where this PhraseSet will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project and location where this PhraseSet will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (phraseSet_ != null) { + output.writeMessage(1, getPhraseSet()); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(phraseSetId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, phraseSetId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, parent_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (phraseSet_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getPhraseSet()); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(phraseSetId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, phraseSetId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, parent_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.CreatePhraseSetRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.CreatePhraseSetRequest other = + (com.google.cloud.speech.v2.CreatePhraseSetRequest) obj; + + if (hasPhraseSet() != other.hasPhraseSet()) return false; + if (hasPhraseSet()) { + if (!getPhraseSet().equals(other.getPhraseSet())) return false; + } + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getPhraseSetId().equals(other.getPhraseSetId())) return false; + if (!getParent().equals(other.getParent())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasPhraseSet()) { + hash = (37 * hash) + PHRASE_SET_FIELD_NUMBER; + hash = (53 * hash) + getPhraseSet().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + PHRASE_SET_ID_FIELD_NUMBER; + hash = (53 * hash) + getPhraseSetId().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.CreatePhraseSetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [CreatePhraseSet][google.cloud.speech.v2.Speech.CreatePhraseSet] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CreatePhraseSetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.CreatePhraseSetRequest) + com.google.cloud.speech.v2.CreatePhraseSetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreatePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreatePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CreatePhraseSetRequest.class, + com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.CreatePhraseSetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (phraseSetBuilder_ == null) { + phraseSet_ = null; + } else { + phraseSet_ = null; + phraseSetBuilder_ = null; + } + validateOnly_ = false; + + phraseSetId_ = ""; + + parent_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreatePhraseSetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequest build() { + com.google.cloud.speech.v2.CreatePhraseSetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequest buildPartial() { + com.google.cloud.speech.v2.CreatePhraseSetRequest result = + new com.google.cloud.speech.v2.CreatePhraseSetRequest(this); + if (phraseSetBuilder_ == null) { + result.phraseSet_ = phraseSet_; + } else { + result.phraseSet_ = phraseSetBuilder_.build(); + } + result.validateOnly_ = validateOnly_; + result.phraseSetId_ = phraseSetId_; + result.parent_ = parent_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.CreatePhraseSetRequest) { + return mergeFrom((com.google.cloud.speech.v2.CreatePhraseSetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.CreatePhraseSetRequest other) { + if (other == com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance()) + return this; + if (other.hasPhraseSet()) { + mergePhraseSet(other.getPhraseSet()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getPhraseSetId().isEmpty()) { + phraseSetId_ = other.phraseSetId_; + onChanged(); + } + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.CreatePhraseSetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.CreatePhraseSetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.PhraseSet phraseSet_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + phraseSetBuilder_; + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the phraseSet field is set. + */ + public boolean hasPhraseSet() { + return phraseSetBuilder_ != null || phraseSet_ != null; + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The phraseSet. + */ + public com.google.cloud.speech.v2.PhraseSet getPhraseSet() { + if (phraseSetBuilder_ == null) { + return phraseSet_ == null + ? com.google.cloud.speech.v2.PhraseSet.getDefaultInstance() + : phraseSet_; + } else { + return phraseSetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setPhraseSet(com.google.cloud.speech.v2.PhraseSet value) { + if (phraseSetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + phraseSet_ = value; + onChanged(); + } else { + phraseSetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setPhraseSet(com.google.cloud.speech.v2.PhraseSet.Builder builderForValue) { + if (phraseSetBuilder_ == null) { + phraseSet_ = builderForValue.build(); + onChanged(); + } else { + phraseSetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergePhraseSet(com.google.cloud.speech.v2.PhraseSet value) { + if (phraseSetBuilder_ == null) { + if (phraseSet_ != null) { + phraseSet_ = + com.google.cloud.speech.v2.PhraseSet.newBuilder(phraseSet_) + .mergeFrom(value) + .buildPartial(); + } else { + phraseSet_ = value; + } + onChanged(); + } else { + phraseSetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearPhraseSet() { + if (phraseSetBuilder_ == null) { + phraseSet_ = null; + onChanged(); + } else { + phraseSet_ = null; + phraseSetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.PhraseSet.Builder getPhraseSetBuilder() { + + onChanged(); + return getPhraseSetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetOrBuilder() { + if (phraseSetBuilder_ != null) { + return phraseSetBuilder_.getMessageOrBuilder(); + } else { + return phraseSet_ == null + ? com.google.cloud.speech.v2.PhraseSet.getDefaultInstance() + : phraseSet_; + } + } + /** + * + * + *
+     * Required. The PhraseSet to create.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + getPhraseSetFieldBuilder() { + if (phraseSetBuilder_ == null) { + phraseSetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder>( + getPhraseSet(), getParentForChildren(), isClean()); + phraseSet_ = null; + } + return phraseSetBuilder_; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the PhraseSet, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the PhraseSet, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the PhraseSet, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object phraseSetId_ = ""; + /** + * + * + *
+     * The ID to use for the PhraseSet, which will become the final component of
+     * the PhraseSet's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string phrase_set_id = 3; + * + * @return The phraseSetId. + */ + public java.lang.String getPhraseSetId() { + java.lang.Object ref = phraseSetId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + phraseSetId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The ID to use for the PhraseSet, which will become the final component of
+     * the PhraseSet's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string phrase_set_id = 3; + * + * @return The bytes for phraseSetId. + */ + public com.google.protobuf.ByteString getPhraseSetIdBytes() { + java.lang.Object ref = phraseSetId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + phraseSetId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The ID to use for the PhraseSet, which will become the final component of
+     * the PhraseSet's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string phrase_set_id = 3; + * + * @param value The phraseSetId to set. + * @return This builder for chaining. + */ + public Builder setPhraseSetId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + phraseSetId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for the PhraseSet, which will become the final component of
+     * the PhraseSet's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string phrase_set_id = 3; + * + * @return This builder for chaining. + */ + public Builder clearPhraseSetId() { + + phraseSetId_ = getDefaultInstance().getPhraseSetId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for the PhraseSet, which will become the final component of
+     * the PhraseSet's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string phrase_set_id = 3; + * + * @param value The bytes for phraseSetId to set. + * @return This builder for chaining. + */ + public Builder setPhraseSetIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + phraseSetId_ = value; + onChanged(); + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project and location where this PhraseSet will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project and location where this PhraseSet will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project and location where this PhraseSet will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location where this PhraseSet will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location where this PhraseSet will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.CreatePhraseSetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.CreatePhraseSetRequest) + private static final com.google.cloud.speech.v2.CreatePhraseSetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.CreatePhraseSetRequest(); + } + + public static com.google.cloud.speech.v2.CreatePhraseSetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreatePhraseSetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreatePhraseSetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequestOrBuilder.java new file mode 100644 index 000000000000..862e79fa966f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreatePhraseSetRequestOrBuilder.java @@ -0,0 +1,142 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface CreatePhraseSetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.CreatePhraseSetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The PhraseSet to create.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the phraseSet field is set. + */ + boolean hasPhraseSet(); + /** + * + * + *
+   * Required. The PhraseSet to create.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The phraseSet. + */ + com.google.cloud.speech.v2.PhraseSet getPhraseSet(); + /** + * + * + *
+   * Required. The PhraseSet to create.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetOrBuilder(); + + /** + * + * + *
+   * If set, validate the request and preview the PhraseSet, but do not
+   * actually create it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * The ID to use for the PhraseSet, which will become the final component of
+   * the PhraseSet's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string phrase_set_id = 3; + * + * @return The phraseSetId. + */ + java.lang.String getPhraseSetId(); + /** + * + * + *
+   * The ID to use for the PhraseSet, which will become the final component of
+   * the PhraseSet's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string phrase_set_id = 3; + * + * @return The bytes for phraseSetId. + */ + com.google.protobuf.ByteString getPhraseSetIdBytes(); + + /** + * + * + *
+   * Required. The project and location where this PhraseSet will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project and location where this PhraseSet will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequest.java new file mode 100644 index 000000000000..6d5c71d0d1d9 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequest.java @@ -0,0 +1,1256 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [CreateRecognizer][google.cloud.speech.v2.Speech.CreateRecognizer] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CreateRecognizerRequest} + */ +public final class CreateRecognizerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.CreateRecognizerRequest) + CreateRecognizerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateRecognizerRequest.newBuilder() to construct. + private CreateRecognizerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateRecognizerRequest() { + recognizerId_ = ""; + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateRecognizerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateRecognizerRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.Recognizer.Builder subBuilder = null; + if (recognizer_ != null) { + subBuilder = recognizer_.toBuilder(); + } + recognizer_ = + input.readMessage( + com.google.cloud.speech.v2.Recognizer.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(recognizer_); + recognizer_ = subBuilder.buildPartial(); + } + + break; + } + case 16: + { + validateOnly_ = input.readBool(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + recognizerId_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CreateRecognizerRequest.class, + com.google.cloud.speech.v2.CreateRecognizerRequest.Builder.class); + } + + public static final int RECOGNIZER_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.Recognizer recognizer_; + /** + * + * + *
+   * Required. The Recognizer to create.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the recognizer field is set. + */ + @java.lang.Override + public boolean hasRecognizer() { + return recognizer_ != null; + } + /** + * + * + *
+   * Required. The Recognizer to create.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The recognizer. + */ + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer getRecognizer() { + return recognizer_ == null + ? com.google.cloud.speech.v2.Recognizer.getDefaultInstance() + : recognizer_; + } + /** + * + * + *
+   * Required. The Recognizer to create.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizerOrBuilder() { + return getRecognizer(); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the Recognizer, but do not
+   * actually create it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int RECOGNIZER_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object recognizerId_; + /** + * + * + *
+   * The ID to use for the Recognizer, which will become the final component of
+   * the Recognizer's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string recognizer_id = 3; + * + * @return The recognizerId. + */ + @java.lang.Override + public java.lang.String getRecognizerId() { + java.lang.Object ref = recognizerId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizerId_ = s; + return s; + } + } + /** + * + * + *
+   * The ID to use for the Recognizer, which will become the final component of
+   * the Recognizer's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string recognizer_id = 3; + * + * @return The bytes for recognizerId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRecognizerIdBytes() { + java.lang.Object ref = recognizerId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizerId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARENT_FIELD_NUMBER = 4; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project and location where this Recognizer will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project and location where this Recognizer will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (recognizer_ != null) { + output.writeMessage(1, getRecognizer()); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizerId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, recognizerId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, parent_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (recognizer_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getRecognizer()); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizerId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, recognizerId_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, parent_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.CreateRecognizerRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.CreateRecognizerRequest other = + (com.google.cloud.speech.v2.CreateRecognizerRequest) obj; + + if (hasRecognizer() != other.hasRecognizer()) return false; + if (hasRecognizer()) { + if (!getRecognizer().equals(other.getRecognizer())) return false; + } + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getRecognizerId().equals(other.getRecognizerId())) return false; + if (!getParent().equals(other.getParent())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasRecognizer()) { + hash = (37 * hash) + RECOGNIZER_FIELD_NUMBER; + hash = (53 * hash) + getRecognizer().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + RECOGNIZER_ID_FIELD_NUMBER; + hash = (53 * hash) + getRecognizerId().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.CreateRecognizerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [CreateRecognizer][google.cloud.speech.v2.Speech.CreateRecognizer] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CreateRecognizerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.CreateRecognizerRequest) + com.google.cloud.speech.v2.CreateRecognizerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CreateRecognizerRequest.class, + com.google.cloud.speech.v2.CreateRecognizerRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.CreateRecognizerRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (recognizerBuilder_ == null) { + recognizer_ = null; + } else { + recognizer_ = null; + recognizerBuilder_ = null; + } + validateOnly_ = false; + + recognizerId_ = ""; + + parent_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CreateRecognizerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequest build() { + com.google.cloud.speech.v2.CreateRecognizerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequest buildPartial() { + com.google.cloud.speech.v2.CreateRecognizerRequest result = + new com.google.cloud.speech.v2.CreateRecognizerRequest(this); + if (recognizerBuilder_ == null) { + result.recognizer_ = recognizer_; + } else { + result.recognizer_ = recognizerBuilder_.build(); + } + result.validateOnly_ = validateOnly_; + result.recognizerId_ = recognizerId_; + result.parent_ = parent_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.CreateRecognizerRequest) { + return mergeFrom((com.google.cloud.speech.v2.CreateRecognizerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.CreateRecognizerRequest other) { + if (other == com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance()) + return this; + if (other.hasRecognizer()) { + mergeRecognizer(other.getRecognizer()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getRecognizerId().isEmpty()) { + recognizerId_ = other.recognizerId_; + onChanged(); + } + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.CreateRecognizerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.CreateRecognizerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.Recognizer recognizer_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder> + recognizerBuilder_; + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the recognizer field is set. + */ + public boolean hasRecognizer() { + return recognizerBuilder_ != null || recognizer_ != null; + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The recognizer. + */ + public com.google.cloud.speech.v2.Recognizer getRecognizer() { + if (recognizerBuilder_ == null) { + return recognizer_ == null + ? com.google.cloud.speech.v2.Recognizer.getDefaultInstance() + : recognizer_; + } else { + return recognizerBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setRecognizer(com.google.cloud.speech.v2.Recognizer value) { + if (recognizerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + recognizer_ = value; + onChanged(); + } else { + recognizerBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setRecognizer(com.google.cloud.speech.v2.Recognizer.Builder builderForValue) { + if (recognizerBuilder_ == null) { + recognizer_ = builderForValue.build(); + onChanged(); + } else { + recognizerBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeRecognizer(com.google.cloud.speech.v2.Recognizer value) { + if (recognizerBuilder_ == null) { + if (recognizer_ != null) { + recognizer_ = + com.google.cloud.speech.v2.Recognizer.newBuilder(recognizer_) + .mergeFrom(value) + .buildPartial(); + } else { + recognizer_ = value; + } + onChanged(); + } else { + recognizerBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearRecognizer() { + if (recognizerBuilder_ == null) { + recognizer_ = null; + onChanged(); + } else { + recognizer_ = null; + recognizerBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.Recognizer.Builder getRecognizerBuilder() { + + onChanged(); + return getRecognizerFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizerOrBuilder() { + if (recognizerBuilder_ != null) { + return recognizerBuilder_.getMessageOrBuilder(); + } else { + return recognizer_ == null + ? com.google.cloud.speech.v2.Recognizer.getDefaultInstance() + : recognizer_; + } + } + /** + * + * + *
+     * Required. The Recognizer to create.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder> + getRecognizerFieldBuilder() { + if (recognizerBuilder_ == null) { + recognizerBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder>( + getRecognizer(), getParentForChildren(), isClean()); + recognizer_ = null; + } + return recognizerBuilder_; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the Recognizer, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the Recognizer, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the Recognizer, but do not
+     * actually create it.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object recognizerId_ = ""; + /** + * + * + *
+     * The ID to use for the Recognizer, which will become the final component of
+     * the Recognizer's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string recognizer_id = 3; + * + * @return The recognizerId. + */ + public java.lang.String getRecognizerId() { + java.lang.Object ref = recognizerId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizerId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The ID to use for the Recognizer, which will become the final component of
+     * the Recognizer's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string recognizer_id = 3; + * + * @return The bytes for recognizerId. + */ + public com.google.protobuf.ByteString getRecognizerIdBytes() { + java.lang.Object ref = recognizerId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizerId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The ID to use for the Recognizer, which will become the final component of
+     * the Recognizer's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string recognizer_id = 3; + * + * @param value The recognizerId to set. + * @return This builder for chaining. + */ + public Builder setRecognizerId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + recognizerId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for the Recognizer, which will become the final component of
+     * the Recognizer's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string recognizer_id = 3; + * + * @return This builder for chaining. + */ + public Builder clearRecognizerId() { + + recognizerId_ = getDefaultInstance().getRecognizerId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for the Recognizer, which will become the final component of
+     * the Recognizer's resource name.
+     * This value should be 4-63 characters, and valid characters
+     * are /[a-z][0-9]-/.
+     * 
+ * + * string recognizer_id = 3; + * + * @param value The bytes for recognizerId to set. + * @return This builder for chaining. + */ + public Builder setRecognizerIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + recognizerId_ = value; + onChanged(); + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project and location where this Recognizer will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project and location where this Recognizer will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project and location where this Recognizer will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location where this Recognizer will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location where this Recognizer will be created.
+     * The expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.CreateRecognizerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.CreateRecognizerRequest) + private static final com.google.cloud.speech.v2.CreateRecognizerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.CreateRecognizerRequest(); + } + + public static com.google.cloud.speech.v2.CreateRecognizerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateRecognizerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateRecognizerRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequestOrBuilder.java new file mode 100644 index 000000000000..77aa7ec49b6a --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CreateRecognizerRequestOrBuilder.java @@ -0,0 +1,142 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface CreateRecognizerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.CreateRecognizerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Recognizer to create.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the recognizer field is set. + */ + boolean hasRecognizer(); + /** + * + * + *
+   * Required. The Recognizer to create.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The recognizer. + */ + com.google.cloud.speech.v2.Recognizer getRecognizer(); + /** + * + * + *
+   * Required. The Recognizer to create.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizerOrBuilder(); + + /** + * + * + *
+   * If set, validate the request and preview the Recognizer, but do not
+   * actually create it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * The ID to use for the Recognizer, which will become the final component of
+   * the Recognizer's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string recognizer_id = 3; + * + * @return The recognizerId. + */ + java.lang.String getRecognizerId(); + /** + * + * + *
+   * The ID to use for the Recognizer, which will become the final component of
+   * the Recognizer's resource name.
+   * This value should be 4-63 characters, and valid characters
+   * are /[a-z][0-9]-/.
+   * 
+ * + * string recognizer_id = 3; + * + * @return The bytes for recognizerId. + */ + com.google.protobuf.ByteString getRecognizerIdBytes(); + + /** + * + * + *
+   * Required. The project and location where this Recognizer will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project and location where this Recognizer will be created.
+   * The expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClass.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClass.java new file mode 100644 index 000000000000..32ef95ccef58 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClass.java @@ -0,0 +1,4727 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * CustomClass for biasing in speech recognition. Used to define a set of words
+ * or phrases that represents a common concept or theme likely to appear in your
+ * audio, for example a list of passenger ship names.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CustomClass} + */ +public final class CustomClass extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.CustomClass) + CustomClassOrBuilder { + private static final long serialVersionUID = 0L; + // Use CustomClass.newBuilder() to construct. + private CustomClass(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CustomClass() { + name_ = ""; + uid_ = ""; + displayName_ = ""; + items_ = java.util.Collections.emptyList(); + state_ = 0; + etag_ = ""; + kmsKeyName_ = ""; + kmsKeyVersionName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CustomClass(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CustomClass( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + uid_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + items_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + items_.add( + input.readMessage( + com.google.cloud.speech.v2.CustomClass.ClassItem.parser(), + extensionRegistry)); + break; + } + case 50: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (deleteTime_ != null) { + subBuilder = deleteTime_.toBuilder(); + } + deleteTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(deleteTime_); + deleteTime_ = subBuilder.buildPartial(); + } + + break; + } + case 74: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (expireTime_ != null) { + subBuilder = expireTime_.toBuilder(); + } + expireTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(expireTime_); + expireTime_ = subBuilder.buildPartial(); + } + + break; + } + case 82: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + annotations_ = + com.google.protobuf.MapField.newMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + annotations_.getMutableMap().put(annotations__.getKey(), annotations__.getValue()); + break; + } + case 90: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 96: + { + reconciling_ = input.readBool(); + break; + } + case 106: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyName_ = s; + break; + } + case 114: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyVersionName_ = s; + break; + } + case 120: + { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + items_ = java.util.Collections.unmodifiableList(items_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CustomClass.class, + com.google.cloud.speech.v2.CustomClass.Builder.class); + } + + /** + * + * + *
+   * Set of states that define the lifecycle of a CustomClass.
+   * 
+ * + * Protobuf enum {@code google.cloud.speech.v2.CustomClass.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Unspecified state.  This is only used/useful for distinguishing
+     * unset values.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * The normal and active state.
+     * 
+ * + * ACTIVE = 2; + */ + ACTIVE(2), + /** + * + * + *
+     * This CustomClass has been deleted.
+     * 
+ * + * DELETED = 4; + */ + DELETED(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Unspecified state.  This is only used/useful for distinguishing
+     * unset values.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The normal and active state.
+     * 
+ * + * ACTIVE = 2; + */ + public static final int ACTIVE_VALUE = 2; + /** + * + * + *
+     * This CustomClass has been deleted.
+     * 
+ * + * DELETED = 4; + */ + public static final int DELETED_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 2: + return ACTIVE; + case 4: + return DELETED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.speech.v2.CustomClass.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.speech.v2.CustomClass.State) + } + + public interface ClassItemOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.CustomClass.ClassItem) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The class item's value.
+     * 
+ * + * string value = 1; + * + * @return The value. + */ + java.lang.String getValue(); + /** + * + * + *
+     * The class item's value.
+     * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + com.google.protobuf.ByteString getValueBytes(); + } + /** + * + * + *
+   * An item of the class.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CustomClass.ClassItem} + */ + public static final class ClassItem extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.CustomClass.ClassItem) + ClassItemOrBuilder { + private static final long serialVersionUID = 0L; + // Use ClassItem.newBuilder() to construct. + private ClassItem(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ClassItem() { + value_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ClassItem(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ClassItem( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + value_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_ClassItem_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_ClassItem_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CustomClass.ClassItem.class, + com.google.cloud.speech.v2.CustomClass.ClassItem.Builder.class); + } + + public static final int VALUE_FIELD_NUMBER = 1; + private volatile java.lang.Object value_; + /** + * + * + *
+     * The class item's value.
+     * 
+ * + * string value = 1; + * + * @return The value. + */ + @java.lang.Override + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } + } + /** + * + * + *
+     * The class item's value.
+     * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + @java.lang.Override + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.CustomClass.ClassItem)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.CustomClass.ClassItem other = + (com.google.cloud.speech.v2.CustomClass.ClassItem) obj; + + if (!getValue().equals(other.getValue())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.CustomClass.ClassItem prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * An item of the class.
+     * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CustomClass.ClassItem} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.CustomClass.ClassItem) + com.google.cloud.speech.v2.CustomClass.ClassItemOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_ClassItem_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_ClassItem_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CustomClass.ClassItem.class, + com.google.cloud.speech.v2.CustomClass.ClassItem.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.CustomClass.ClassItem.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + value_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_ClassItem_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.ClassItem getDefaultInstanceForType() { + return com.google.cloud.speech.v2.CustomClass.ClassItem.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.ClassItem build() { + com.google.cloud.speech.v2.CustomClass.ClassItem result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.ClassItem buildPartial() { + com.google.cloud.speech.v2.CustomClass.ClassItem result = + new com.google.cloud.speech.v2.CustomClass.ClassItem(this); + result.value_ = value_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.CustomClass.ClassItem) { + return mergeFrom((com.google.cloud.speech.v2.CustomClass.ClassItem) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.CustomClass.ClassItem other) { + if (other == com.google.cloud.speech.v2.CustomClass.ClassItem.getDefaultInstance()) + return this; + if (!other.getValue().isEmpty()) { + value_ = other.value_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.CustomClass.ClassItem parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.CustomClass.ClassItem) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object value_ = ""; + /** + * + * + *
+       * The class item's value.
+       * 
+ * + * string value = 1; + * + * @return The value. + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The class item's value.
+       * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The class item's value.
+       * 
+ * + * string value = 1; + * + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + value_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The class item's value.
+       * 
+ * + * string value = 1; + * + * @return This builder for chaining. + */ + public Builder clearValue() { + + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * + * + *
+       * The class item's value.
+       * 
+ * + * string value = 1; + * + * @param value The bytes for value to set. + * @return This builder for chaining. + */ + public Builder setValueBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + value_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.CustomClass.ClassItem) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.CustomClass.ClassItem) + private static final com.google.cloud.speech.v2.CustomClass.ClassItem DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.CustomClass.ClassItem(); + } + + public static com.google.cloud.speech.v2.CustomClass.ClassItem getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClassItem parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClassItem(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.ClassItem getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. The resource name of the CustomClass.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The resource name of the CustomClass.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. System-assigned unique identifier for the CustomClass.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. System-assigned unique identifier for the CustomClass.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 4; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * User-settable, human-readable name for the CustomClass. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * User-settable, human-readable name for the CustomClass. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ITEMS_FIELD_NUMBER = 5; + private java.util.List items_; + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + @java.lang.Override + public java.util.List getItemsList() { + return items_; + } + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + @java.lang.Override + public java.util.List + getItemsOrBuilderList() { + return items_; + } + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + @java.lang.Override + public int getItemsCount() { + return items_.size(); + } + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.ClassItem getItems(int index) { + return items_.get(index); + } + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.ClassItemOrBuilder getItemsOrBuilder(int index) { + return items_.get(index); + } + + public static final int STATE_FIELD_NUMBER = 15; + private int state_; + /** + * + * + *
+   * Output only. The CustomClass lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Output only. The CustomClass lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.CustomClass.State result = + com.google.cloud.speech.v2.CustomClass.State.valueOf(state_); + return result == null ? com.google.cloud.speech.v2.CustomClass.State.UNRECOGNIZED : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int EXPIRE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 10; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ETAG_FIELD_NUMBER = 11; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int RECONCILING_FIELD_NUMBER = 12; + private boolean reconciling_; + /** + * + * + *
+   * Output only. Whether or not this CustomClass is in the process of being
+   * updated.
+   * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + + public static final int KMS_KEY_NAME_FIELD_NUMBER = 13; + private volatile java.lang.Object kmsKeyName_; + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + @java.lang.Override + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KMS_KEY_VERSION_NAME_FIELD_NUMBER = 14; + private volatile java.lang.Object kmsKeyVersionName_; + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + @java.lang.Override + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, displayName_); + } + for (int i = 0; i < items_.size(); i++) { + output.writeMessage(5, items_.get(i)); + } + if (createTime_ != null) { + output.writeMessage(6, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(7, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(8, getDeleteTime()); + } + if (expireTime_ != null) { + output.writeMessage(9, getExpireTime()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 10); + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, etag_); + } + if (reconciling_ != false) { + output.writeBool(12, reconciling_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 13, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 14, kmsKeyVersionName_); + } + if (state_ != com.google.cloud.speech.v2.CustomClass.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(15, state_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, displayName_); + } + for (int i = 0; i < items_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, items_.get(i)); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getDeleteTime()); + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getExpireTime()); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, annotations__); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, etag_); + } + if (reconciling_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(12, reconciling_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, kmsKeyVersionName_); + } + if (state_ != com.google.cloud.speech.v2.CustomClass.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(15, state_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.CustomClass)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.CustomClass other = (com.google.cloud.speech.v2.CustomClass) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getItemsList().equals(other.getItemsList())) return false; + if (state_ != other.state_) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (getReconciling() != other.getReconciling()) return false; + if (!getKmsKeyName().equals(other.getKmsKeyName())) return false; + if (!getKmsKeyVersionName().equals(other.getKmsKeyVersionName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + if (getItemsCount() > 0) { + hash = (37 * hash) + ITEMS_FIELD_NUMBER; + hash = (53 * hash) + getItemsList().hashCode(); + } + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (37 * hash) + RECONCILING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReconciling()); + hash = (37 * hash) + KMS_KEY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyName().hashCode(); + hash = (37 * hash) + KMS_KEY_VERSION_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyVersionName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CustomClass parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.CustomClass parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.CustomClass prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * CustomClass for biasing in speech recognition. Used to define a set of words
+   * or phrases that represents a common concept or theme likely to appear in your
+   * audio, for example a list of passenger ship names.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.CustomClass} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.CustomClass) + com.google.cloud.speech.v2.CustomClassOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 10: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.CustomClass.class, + com.google.cloud.speech.v2.CustomClass.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.CustomClass.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getItemsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + displayName_ = ""; + + if (itemsBuilder_ == null) { + items_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + itemsBuilder_.clear(); + } + state_ = 0; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + internalGetMutableAnnotations().clear(); + etag_ = ""; + + reconciling_ = false; + + kmsKeyName_ = ""; + + kmsKeyVersionName_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_CustomClass_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass getDefaultInstanceForType() { + return com.google.cloud.speech.v2.CustomClass.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass build() { + com.google.cloud.speech.v2.CustomClass result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass buildPartial() { + com.google.cloud.speech.v2.CustomClass result = + new com.google.cloud.speech.v2.CustomClass(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + result.displayName_ = displayName_; + if (itemsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + items_ = java.util.Collections.unmodifiableList(items_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.items_ = items_; + } else { + result.items_ = itemsBuilder_.build(); + } + result.state_ = state_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + result.etag_ = etag_; + result.reconciling_ = reconciling_; + result.kmsKeyName_ = kmsKeyName_; + result.kmsKeyVersionName_ = kmsKeyVersionName_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.CustomClass) { + return mergeFrom((com.google.cloud.speech.v2.CustomClass) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.CustomClass other) { + if (other == com.google.cloud.speech.v2.CustomClass.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (itemsBuilder_ == null) { + if (!other.items_.isEmpty()) { + if (items_.isEmpty()) { + items_ = other.items_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureItemsIsMutable(); + items_.addAll(other.items_); + } + onChanged(); + } + } else { + if (!other.items_.isEmpty()) { + if (itemsBuilder_.isEmpty()) { + itemsBuilder_.dispose(); + itemsBuilder_ = null; + items_ = other.items_; + bitField0_ = (bitField0_ & ~0x00000001); + itemsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getItemsFieldBuilder() + : null; + } else { + itemsBuilder_.addAllMessages(other.items_); + } + } + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + if (other.getReconciling() != false) { + setReconciling(other.getReconciling()); + } + if (!other.getKmsKeyName().isEmpty()) { + kmsKeyName_ = other.kmsKeyName_; + onChanged(); + } + if (!other.getKmsKeyVersionName().isEmpty()) { + kmsKeyVersionName_ = other.kmsKeyVersionName_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.CustomClass parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.CustomClass) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The resource name of the CustomClass.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the CustomClass.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the CustomClass.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the CustomClass.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the CustomClass.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. System-assigned unique identifier for the CustomClass.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the CustomClass.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the CustomClass.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the CustomClass.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the CustomClass.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * User-settable, human-readable name for the CustomClass. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User-settable, human-readable name for the CustomClass. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User-settable, human-readable name for the CustomClass. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 4; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User-settable, human-readable name for the CustomClass. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 4; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * User-settable, human-readable name for the CustomClass. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 4; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private java.util.List items_ = + java.util.Collections.emptyList(); + + private void ensureItemsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + items_ = new java.util.ArrayList(items_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass.ClassItem, + com.google.cloud.speech.v2.CustomClass.ClassItem.Builder, + com.google.cloud.speech.v2.CustomClass.ClassItemOrBuilder> + itemsBuilder_; + + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public java.util.List getItemsList() { + if (itemsBuilder_ == null) { + return java.util.Collections.unmodifiableList(items_); + } else { + return itemsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public int getItemsCount() { + if (itemsBuilder_ == null) { + return items_.size(); + } else { + return itemsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public com.google.cloud.speech.v2.CustomClass.ClassItem getItems(int index) { + if (itemsBuilder_ == null) { + return items_.get(index); + } else { + return itemsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder setItems(int index, com.google.cloud.speech.v2.CustomClass.ClassItem value) { + if (itemsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureItemsIsMutable(); + items_.set(index, value); + onChanged(); + } else { + itemsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder setItems( + int index, com.google.cloud.speech.v2.CustomClass.ClassItem.Builder builderForValue) { + if (itemsBuilder_ == null) { + ensureItemsIsMutable(); + items_.set(index, builderForValue.build()); + onChanged(); + } else { + itemsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder addItems(com.google.cloud.speech.v2.CustomClass.ClassItem value) { + if (itemsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureItemsIsMutable(); + items_.add(value); + onChanged(); + } else { + itemsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder addItems(int index, com.google.cloud.speech.v2.CustomClass.ClassItem value) { + if (itemsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureItemsIsMutable(); + items_.add(index, value); + onChanged(); + } else { + itemsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder addItems( + com.google.cloud.speech.v2.CustomClass.ClassItem.Builder builderForValue) { + if (itemsBuilder_ == null) { + ensureItemsIsMutable(); + items_.add(builderForValue.build()); + onChanged(); + } else { + itemsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder addItems( + int index, com.google.cloud.speech.v2.CustomClass.ClassItem.Builder builderForValue) { + if (itemsBuilder_ == null) { + ensureItemsIsMutable(); + items_.add(index, builderForValue.build()); + onChanged(); + } else { + itemsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder addAllItems( + java.lang.Iterable values) { + if (itemsBuilder_ == null) { + ensureItemsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, items_); + onChanged(); + } else { + itemsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder clearItems() { + if (itemsBuilder_ == null) { + items_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + itemsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public Builder removeItems(int index) { + if (itemsBuilder_ == null) { + ensureItemsIsMutable(); + items_.remove(index); + onChanged(); + } else { + itemsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public com.google.cloud.speech.v2.CustomClass.ClassItem.Builder getItemsBuilder(int index) { + return getItemsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public com.google.cloud.speech.v2.CustomClass.ClassItemOrBuilder getItemsOrBuilder(int index) { + if (itemsBuilder_ == null) { + return items_.get(index); + } else { + return itemsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public java.util.List + getItemsOrBuilderList() { + if (itemsBuilder_ != null) { + return itemsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(items_); + } + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public com.google.cloud.speech.v2.CustomClass.ClassItem.Builder addItemsBuilder() { + return getItemsFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.CustomClass.ClassItem.getDefaultInstance()); + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public com.google.cloud.speech.v2.CustomClass.ClassItem.Builder addItemsBuilder(int index) { + return getItemsFieldBuilder() + .addBuilder(index, com.google.cloud.speech.v2.CustomClass.ClassItem.getDefaultInstance()); + } + /** + * + * + *
+     * A collection of class items.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + public java.util.List + getItemsBuilderList() { + return getItemsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass.ClassItem, + com.google.cloud.speech.v2.CustomClass.ClassItem.Builder, + com.google.cloud.speech.v2.CustomClass.ClassItemOrBuilder> + getItemsFieldBuilder() { + if (itemsBuilder_ == null) { + itemsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass.ClassItem, + com.google.cloud.speech.v2.CustomClass.ClassItem.Builder, + com.google.cloud.speech.v2.CustomClass.ClassItemOrBuilder>( + items_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + items_ = null; + } + return itemsBuilder_; + } + + private int state_ = 0; + /** + * + * + *
+     * Output only. The CustomClass lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Output only. The CustomClass lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The CustomClass lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.CustomClass.State result = + com.google.cloud.speech.v2.CustomClass.State.valueOf(state_); + return result == null ? com.google.cloud.speech.v2.CustomClass.State.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Output only. The CustomClass lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.cloud.speech.v2.CustomClass.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The CustomClass lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_).mergeFrom(value).buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + private boolean reconciling_; + /** + * + * + *
+     * Output only. Whether or not this CustomClass is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + /** + * + * + *
+     * Output only. Whether or not this CustomClass is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The reconciling to set. + * @return This builder for chaining. + */ + public Builder setReconciling(boolean value) { + + reconciling_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Whether or not this CustomClass is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearReconciling() { + + reconciling_ = false; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyName_ = ""; + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyName() { + + kmsKeyName_ = getDefaultInstance().getKmsKeyName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyName_ = value; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyVersionName_ = ""; + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyVersionName() { + + kmsKeyVersionName_ = getDefaultInstance().getKmsKeyVersionName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the CustomClass is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.CustomClass) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.CustomClass) + private static final com.google.cloud.speech.v2.CustomClass DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.CustomClass(); + } + + public static com.google.cloud.speech.v2.CustomClass getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CustomClass parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CustomClass(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassName.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassName.java new file mode 100644 index 000000000000..89e7a0fd9afd --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassName.java @@ -0,0 +1,227 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class CustomClassName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_CUSTOM_CLASS = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/customClasses/{custom_class}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String customClass; + + @Deprecated + protected CustomClassName() { + project = null; + location = null; + customClass = null; + } + + private CustomClassName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + customClass = Preconditions.checkNotNull(builder.getCustomClass()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCustomClass() { + return customClass; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static CustomClassName of(String project, String location, String customClass) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCustomClass(customClass) + .build(); + } + + public static String format(String project, String location, String customClass) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setCustomClass(customClass) + .build() + .toString(); + } + + public static CustomClassName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_CUSTOM_CLASS.validatedMatch( + formattedString, "CustomClassName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("custom_class")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (CustomClassName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_CUSTOM_CLASS.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (customClass != null) { + fieldMapBuilder.put("custom_class", customClass); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_CUSTOM_CLASS.instantiate( + "project", project, "location", location, "custom_class", customClass); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + CustomClassName that = ((CustomClassName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.customClass, that.customClass); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(customClass); + return h; + } + + /** Builder for projects/{project}/locations/{location}/customClasses/{custom_class}. */ + public static class Builder { + private String project; + private String location; + private String customClass; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getCustomClass() { + return customClass; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setCustomClass(String customClass) { + this.customClass = customClass; + return this; + } + + private Builder(CustomClassName customClassName) { + this.project = customClassName.project; + this.location = customClassName.location; + this.customClass = customClassName.customClass; + } + + public CustomClassName build() { + return new CustomClassName(this); + } + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassOrBuilder.java new file mode 100644 index 000000000000..b638112ac1b3 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/CustomClassOrBuilder.java @@ -0,0 +1,521 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface CustomClassOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.CustomClass) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The resource name of the CustomClass.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The resource name of the CustomClass.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. System-assigned unique identifier for the CustomClass.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. System-assigned unique identifier for the CustomClass.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * User-settable, human-readable name for the CustomClass. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * User-settable, human-readable name for the CustomClass. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + java.util.List getItemsList(); + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + com.google.cloud.speech.v2.CustomClass.ClassItem getItems(int index); + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + int getItemsCount(); + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + java.util.List + getItemsOrBuilderList(); + /** + * + * + *
+   * A collection of class items.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass.ClassItem items = 5; + */ + com.google.cloud.speech.v2.CustomClass.ClassItemOrBuilder getItemsOrBuilder(int index); + + /** + * + * + *
+   * Output only. The CustomClass lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Output only. The CustomClass lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.cloud.speech.v2.CustomClass.State getState(); + + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); + + /** + * + * + *
+   * Output only. Whether or not this CustomClass is in the process of being
+   * updated.
+   * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + boolean getReconciling(); + + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + java.lang.String getKmsKeyName(); + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + com.google.protobuf.ByteString getKmsKeyNameBytes(); + + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + java.lang.String getKmsKeyVersionName(); + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the CustomClass is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + com.google.protobuf.ByteString getKmsKeyVersionNameBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequest.java new file mode 100644 index 000000000000..e3570e468656 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequest.java @@ -0,0 +1,1049 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [DeleteCustomClass][google.cloud.speech.v2.Speech.DeleteCustomClass] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.DeleteCustomClassRequest} + */ +public final class DeleteCustomClassRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.DeleteCustomClassRequest) + DeleteCustomClassRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteCustomClassRequest.newBuilder() to construct. + private DeleteCustomClassRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteCustomClassRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteCustomClassRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteCustomClassRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: + { + validateOnly_ = input.readBool(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 32: + { + allowMissing_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.DeleteCustomClassRequest.class, + com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the CustomClass to delete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the CustomClass to delete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the deleted CustomClass, but do
+   * not actually delete it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ALLOW_MISSING_FIELD_NUMBER = 4; + private boolean allowMissing_; + /** + * + * + *
+   * If set to true, and the CustomClass is not found, the request will succeed
+   * and  be a no-op (no Operation is recorded in this case).
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + + public static final int ETAG_FIELD_NUMBER = 3; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, etag_); + } + if (allowMissing_ != false) { + output.writeBool(4, allowMissing_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, etag_); + } + if (allowMissing_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, allowMissing_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.DeleteCustomClassRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.DeleteCustomClassRequest other = + (com.google.cloud.speech.v2.DeleteCustomClassRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (getAllowMissing() != other.getAllowMissing()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ALLOW_MISSING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowMissing()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.DeleteCustomClassRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [DeleteCustomClass][google.cloud.speech.v2.Speech.DeleteCustomClass] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.DeleteCustomClassRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.DeleteCustomClassRequest) + com.google.cloud.speech.v2.DeleteCustomClassRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.DeleteCustomClassRequest.class, + com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.DeleteCustomClassRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + allowMissing_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteCustomClassRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequest build() { + com.google.cloud.speech.v2.DeleteCustomClassRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequest buildPartial() { + com.google.cloud.speech.v2.DeleteCustomClassRequest result = + new com.google.cloud.speech.v2.DeleteCustomClassRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.allowMissing_ = allowMissing_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.DeleteCustomClassRequest) { + return mergeFrom((com.google.cloud.speech.v2.DeleteCustomClassRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.DeleteCustomClassRequest other) { + if (other == com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (other.getAllowMissing() != false) { + setAllowMissing(other.getAllowMissing()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.DeleteCustomClassRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.DeleteCustomClassRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the CustomClass to delete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the CustomClass to delete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the CustomClass to delete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the CustomClass to delete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the CustomClass to delete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the deleted CustomClass, but do
+     * not actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the deleted CustomClass, but do
+     * not actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the deleted CustomClass, but do
+     * not actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private boolean allowMissing_; + /** + * + * + *
+     * If set to true, and the CustomClass is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + /** + * + * + *
+     * If set to true, and the CustomClass is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @param value The allowMissing to set. + * @return This builder for chaining. + */ + public Builder setAllowMissing(boolean value) { + + allowMissing_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to true, and the CustomClass is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @return This builder for chaining. + */ + public Builder clearAllowMissing() { + + allowMissing_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.DeleteCustomClassRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.DeleteCustomClassRequest) + private static final com.google.cloud.speech.v2.DeleteCustomClassRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.DeleteCustomClassRequest(); + } + + public static com.google.cloud.speech.v2.DeleteCustomClassRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteCustomClassRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteCustomClassRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequestOrBuilder.java new file mode 100644 index 000000000000..5654d75a604d --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteCustomClassRequestOrBuilder.java @@ -0,0 +1,115 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface DeleteCustomClassRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.DeleteCustomClassRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the CustomClass to delete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the CustomClass to delete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * If set, validate the request and preview the deleted CustomClass, but do
+   * not actually delete it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * If set to true, and the CustomClass is not found, the request will succeed
+   * and  be a no-op (no Operation is recorded in this case).
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + boolean getAllowMissing(); + + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequest.java new file mode 100644 index 000000000000..79dec7a95921 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequest.java @@ -0,0 +1,1042 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [DeletePhraseSet][google.cloud.speech.v2.Speech.DeletePhraseSet] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.DeletePhraseSetRequest} + */ +public final class DeletePhraseSetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.DeletePhraseSetRequest) + DeletePhraseSetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeletePhraseSetRequest.newBuilder() to construct. + private DeletePhraseSetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeletePhraseSetRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeletePhraseSetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeletePhraseSetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: + { + validateOnly_ = input.readBool(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 32: + { + allowMissing_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeletePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeletePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.DeletePhraseSetRequest.class, + com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the PhraseSet to delete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the PhraseSet to delete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the deleted PhraseSet, but do not
+   * actually delete it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ALLOW_MISSING_FIELD_NUMBER = 4; + private boolean allowMissing_; + /** + * + * + *
+   * If set to true, and the PhraseSet is not found, the request will succeed
+   * and  be a no-op (no Operation is recorded in this case).
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + + public static final int ETAG_FIELD_NUMBER = 3; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, etag_); + } + if (allowMissing_ != false) { + output.writeBool(4, allowMissing_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, etag_); + } + if (allowMissing_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, allowMissing_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.DeletePhraseSetRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.DeletePhraseSetRequest other = + (com.google.cloud.speech.v2.DeletePhraseSetRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (getAllowMissing() != other.getAllowMissing()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ALLOW_MISSING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowMissing()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.DeletePhraseSetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [DeletePhraseSet][google.cloud.speech.v2.Speech.DeletePhraseSet] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.DeletePhraseSetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.DeletePhraseSetRequest) + com.google.cloud.speech.v2.DeletePhraseSetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeletePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeletePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.DeletePhraseSetRequest.class, + com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.DeletePhraseSetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + allowMissing_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeletePhraseSetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequest build() { + com.google.cloud.speech.v2.DeletePhraseSetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequest buildPartial() { + com.google.cloud.speech.v2.DeletePhraseSetRequest result = + new com.google.cloud.speech.v2.DeletePhraseSetRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.allowMissing_ = allowMissing_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.DeletePhraseSetRequest) { + return mergeFrom((com.google.cloud.speech.v2.DeletePhraseSetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.DeletePhraseSetRequest other) { + if (other == com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (other.getAllowMissing() != false) { + setAllowMissing(other.getAllowMissing()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.DeletePhraseSetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.DeletePhraseSetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the PhraseSet to delete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the PhraseSet to delete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the PhraseSet to delete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the PhraseSet to delete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the PhraseSet to delete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the deleted PhraseSet, but do not
+     * actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the deleted PhraseSet, but do not
+     * actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the deleted PhraseSet, but do not
+     * actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private boolean allowMissing_; + /** + * + * + *
+     * If set to true, and the PhraseSet is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + /** + * + * + *
+     * If set to true, and the PhraseSet is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @param value The allowMissing to set. + * @return This builder for chaining. + */ + public Builder setAllowMissing(boolean value) { + + allowMissing_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to true, and the PhraseSet is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @return This builder for chaining. + */ + public Builder clearAllowMissing() { + + allowMissing_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.DeletePhraseSetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.DeletePhraseSetRequest) + private static final com.google.cloud.speech.v2.DeletePhraseSetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.DeletePhraseSetRequest(); + } + + public static com.google.cloud.speech.v2.DeletePhraseSetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeletePhraseSetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeletePhraseSetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequestOrBuilder.java new file mode 100644 index 000000000000..090a269f9461 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeletePhraseSetRequestOrBuilder.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface DeletePhraseSetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.DeletePhraseSetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the PhraseSet to delete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the PhraseSet to delete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * If set, validate the request and preview the deleted PhraseSet, but do not
+   * actually delete it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * If set to true, and the PhraseSet is not found, the request will succeed
+   * and  be a no-op (no Operation is recorded in this case).
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + boolean getAllowMissing(); + + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequest.java new file mode 100644 index 000000000000..3c96604fbc77 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequest.java @@ -0,0 +1,1042 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [DeleteRecognizer][google.cloud.speech.v2.Speech.DeleteRecognizer] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.DeleteRecognizerRequest} + */ +public final class DeleteRecognizerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.DeleteRecognizerRequest) + DeleteRecognizerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteRecognizerRequest.newBuilder() to construct. + private DeleteRecognizerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteRecognizerRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteRecognizerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteRecognizerRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: + { + validateOnly_ = input.readBool(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 32: + { + allowMissing_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.DeleteRecognizerRequest.class, + com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the Recognizer to delete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Recognizer to delete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the deleted Recognizer, but do not
+   * actually delete it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ALLOW_MISSING_FIELD_NUMBER = 4; + private boolean allowMissing_; + /** + * + * + *
+   * If set to true, and the Recognizer is not found, the request will succeed
+   * and  be a no-op (no Operation is recorded in this case).
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + + public static final int ETAG_FIELD_NUMBER = 3; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, etag_); + } + if (allowMissing_ != false) { + output.writeBool(4, allowMissing_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, etag_); + } + if (allowMissing_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, allowMissing_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.DeleteRecognizerRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.DeleteRecognizerRequest other = + (com.google.cloud.speech.v2.DeleteRecognizerRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (getAllowMissing() != other.getAllowMissing()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ALLOW_MISSING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowMissing()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.DeleteRecognizerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [DeleteRecognizer][google.cloud.speech.v2.Speech.DeleteRecognizer] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.DeleteRecognizerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.DeleteRecognizerRequest) + com.google.cloud.speech.v2.DeleteRecognizerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.DeleteRecognizerRequest.class, + com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.DeleteRecognizerRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + allowMissing_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_DeleteRecognizerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequest build() { + com.google.cloud.speech.v2.DeleteRecognizerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequest buildPartial() { + com.google.cloud.speech.v2.DeleteRecognizerRequest result = + new com.google.cloud.speech.v2.DeleteRecognizerRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.allowMissing_ = allowMissing_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.DeleteRecognizerRequest) { + return mergeFrom((com.google.cloud.speech.v2.DeleteRecognizerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.DeleteRecognizerRequest other) { + if (other == com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (other.getAllowMissing() != false) { + setAllowMissing(other.getAllowMissing()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.DeleteRecognizerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.DeleteRecognizerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Recognizer to delete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to delete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to delete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to delete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to delete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the deleted Recognizer, but do not
+     * actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the deleted Recognizer, but do not
+     * actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the deleted Recognizer, but do not
+     * actually delete it.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private boolean allowMissing_; + /** + * + * + *
+     * If set to true, and the Recognizer is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + /** + * + * + *
+     * If set to true, and the Recognizer is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @param value The allowMissing to set. + * @return This builder for chaining. + */ + public Builder setAllowMissing(boolean value) { + + allowMissing_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to true, and the Recognizer is not found, the request will succeed
+     * and  be a no-op (no Operation is recorded in this case).
+     * 
+ * + * bool allow_missing = 4; + * + * @return This builder for chaining. + */ + public Builder clearAllowMissing() { + + allowMissing_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 3; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.DeleteRecognizerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.DeleteRecognizerRequest) + private static final com.google.cloud.speech.v2.DeleteRecognizerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.DeleteRecognizerRequest(); + } + + public static com.google.cloud.speech.v2.DeleteRecognizerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteRecognizerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteRecognizerRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequestOrBuilder.java new file mode 100644 index 000000000000..929c1f8a9d5d --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/DeleteRecognizerRequestOrBuilder.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface DeleteRecognizerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.DeleteRecognizerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Recognizer to delete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Recognizer to delete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * If set, validate the request and preview the deleted Recognizer, but do not
+   * actually delete it.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * If set to true, and the Recognizer is not found, the request will succeed
+   * and  be a no-op (no Operation is recorded in this case).
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + boolean getAllowMissing(); + + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfig.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfig.java new file mode 100644 index 000000000000..580d60fa9b4e --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfig.java @@ -0,0 +1,1039 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Explicitly specified decoding parameters.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ExplicitDecodingConfig} + */ +public final class ExplicitDecodingConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.ExplicitDecodingConfig) + ExplicitDecodingConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExplicitDecodingConfig.newBuilder() to construct. + private ExplicitDecodingConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExplicitDecodingConfig() { + encoding_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExplicitDecodingConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ExplicitDecodingConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + + encoding_ = rawValue; + break; + } + case 16: + { + sampleRateHertz_ = input.readInt32(); + break; + } + case 24: + { + audioChannelCount_ = input.readInt32(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ExplicitDecodingConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ExplicitDecodingConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ExplicitDecodingConfig.class, + com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder.class); + } + + /** + * + * + *
+   * Supported audio data encodings.
+   * 
+ * + * Protobuf enum {@code google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding} + */ + public enum AudioEncoding implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * AUDIO_ENCODING_UNSPECIFIED = 0; + */ + AUDIO_ENCODING_UNSPECIFIED(0), + /** + * + * + *
+     * Headerless 16-bit signed little-endian PCM samples.
+     * 
+ * + * LINEAR16 = 1; + */ + LINEAR16(1), + /** + * + * + *
+     * Headerless 8-bit companded mulaw samples.
+     * 
+ * + * MULAW = 2; + */ + MULAW(2), + /** + * + * + *
+     * Headerless 8-bit companded alaw samples.
+     * 
+ * + * ALAW = 3; + */ + ALAW(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * AUDIO_ENCODING_UNSPECIFIED = 0; + */ + public static final int AUDIO_ENCODING_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Headerless 16-bit signed little-endian PCM samples.
+     * 
+ * + * LINEAR16 = 1; + */ + public static final int LINEAR16_VALUE = 1; + /** + * + * + *
+     * Headerless 8-bit companded mulaw samples.
+     * 
+ * + * MULAW = 2; + */ + public static final int MULAW_VALUE = 2; + /** + * + * + *
+     * Headerless 8-bit companded alaw samples.
+     * 
+ * + * ALAW = 3; + */ + public static final int ALAW_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AudioEncoding valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static AudioEncoding forNumber(int value) { + switch (value) { + case 0: + return AUDIO_ENCODING_UNSPECIFIED; + case 1: + return LINEAR16; + case 2: + return MULAW; + case 3: + return ALAW; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public AudioEncoding findValueByNumber(int number) { + return AudioEncoding.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.speech.v2.ExplicitDecodingConfig.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final AudioEncoding[] VALUES = values(); + + public static AudioEncoding valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private AudioEncoding(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding) + } + + public static final int ENCODING_FIELD_NUMBER = 1; + private int encoding_; + /** + * + * + *
+   * Required. Encoding of the audio data sent for recognition.
+   * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for encoding. + */ + @java.lang.Override + public int getEncodingValue() { + return encoding_; + } + /** + * + * + *
+   * Required. Encoding of the audio data sent for recognition.
+   * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The encoding. + */ + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding getEncoding() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding result = + com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding.valueOf(encoding_); + return result == null + ? com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding.UNRECOGNIZED + : result; + } + + public static final int SAMPLE_RATE_HERTZ_FIELD_NUMBER = 2; + private int sampleRateHertz_; + /** + * + * + *
+   * Sample rate in Hertz of the audio data sent for recognition. Valid
+   * values are: 8000-48000. 16000 is optimal. For best results, set the
+   * sampling rate of the audio source to 16000 Hz. If that's not possible, use
+   * the native sample rate of the audio source (instead of re-sampling).
+   * Supported for the following encodings:
+   * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+   * * MULAW: Headerless 8-bit companded mulaw samples.
+   * * ALAW: Headerless 8-bit companded alaw samples.
+   * 
+ * + * int32 sample_rate_hertz = 2; + * + * @return The sampleRateHertz. + */ + @java.lang.Override + public int getSampleRateHertz() { + return sampleRateHertz_; + } + + public static final int AUDIO_CHANNEL_COUNT_FIELD_NUMBER = 3; + private int audioChannelCount_; + /** + * + * + *
+   * Number of channels present in the audio data sent for recognition.
+   * Supported for the following encodings:
+   * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+   * * MULAW: Headerless 8-bit companded mulaw samples.
+   * * ALAW: Headerless 8-bit companded alaw samples.
+   * 
+ * + * int32 audio_channel_count = 3; + * + * @return The audioChannelCount. + */ + @java.lang.Override + public int getAudioChannelCount() { + return audioChannelCount_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (encoding_ + != com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding + .AUDIO_ENCODING_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, encoding_); + } + if (sampleRateHertz_ != 0) { + output.writeInt32(2, sampleRateHertz_); + } + if (audioChannelCount_ != 0) { + output.writeInt32(3, audioChannelCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (encoding_ + != com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding + .AUDIO_ENCODING_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, encoding_); + } + if (sampleRateHertz_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, sampleRateHertz_); + } + if (audioChannelCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, audioChannelCount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.ExplicitDecodingConfig)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.ExplicitDecodingConfig other = + (com.google.cloud.speech.v2.ExplicitDecodingConfig) obj; + + if (encoding_ != other.encoding_) return false; + if (getSampleRateHertz() != other.getSampleRateHertz()) return false; + if (getAudioChannelCount() != other.getAudioChannelCount()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENCODING_FIELD_NUMBER; + hash = (53 * hash) + encoding_; + hash = (37 * hash) + SAMPLE_RATE_HERTZ_FIELD_NUMBER; + hash = (53 * hash) + getSampleRateHertz(); + hash = (37 * hash) + AUDIO_CHANNEL_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getAudioChannelCount(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.ExplicitDecodingConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Explicitly specified decoding parameters.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ExplicitDecodingConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.ExplicitDecodingConfig) + com.google.cloud.speech.v2.ExplicitDecodingConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ExplicitDecodingConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ExplicitDecodingConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ExplicitDecodingConfig.class, + com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.ExplicitDecodingConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + encoding_ = 0; + + sampleRateHertz_ = 0; + + audioChannelCount_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ExplicitDecodingConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig getDefaultInstanceForType() { + return com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig build() { + com.google.cloud.speech.v2.ExplicitDecodingConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig buildPartial() { + com.google.cloud.speech.v2.ExplicitDecodingConfig result = + new com.google.cloud.speech.v2.ExplicitDecodingConfig(this); + result.encoding_ = encoding_; + result.sampleRateHertz_ = sampleRateHertz_; + result.audioChannelCount_ = audioChannelCount_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.ExplicitDecodingConfig) { + return mergeFrom((com.google.cloud.speech.v2.ExplicitDecodingConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.ExplicitDecodingConfig other) { + if (other == com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance()) + return this; + if (other.encoding_ != 0) { + setEncodingValue(other.getEncodingValue()); + } + if (other.getSampleRateHertz() != 0) { + setSampleRateHertz(other.getSampleRateHertz()); + } + if (other.getAudioChannelCount() != 0) { + setAudioChannelCount(other.getAudioChannelCount()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.ExplicitDecodingConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.ExplicitDecodingConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int encoding_ = 0; + /** + * + * + *
+     * Required. Encoding of the audio data sent for recognition.
+     * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for encoding. + */ + @java.lang.Override + public int getEncodingValue() { + return encoding_; + } + /** + * + * + *
+     * Required. Encoding of the audio data sent for recognition.
+     * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The enum numeric value on the wire for encoding to set. + * @return This builder for chaining. + */ + public Builder setEncodingValue(int value) { + + encoding_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Encoding of the audio data sent for recognition.
+     * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The encoding. + */ + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding getEncoding() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding result = + com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding.valueOf(encoding_); + return result == null + ? com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Required. Encoding of the audio data sent for recognition.
+     * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The encoding to set. + * @return This builder for chaining. + */ + public Builder setEncoding( + com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding value) { + if (value == null) { + throw new NullPointerException(); + } + + encoding_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Encoding of the audio data sent for recognition.
+     * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return This builder for chaining. + */ + public Builder clearEncoding() { + + encoding_ = 0; + onChanged(); + return this; + } + + private int sampleRateHertz_; + /** + * + * + *
+     * Sample rate in Hertz of the audio data sent for recognition. Valid
+     * values are: 8000-48000. 16000 is optimal. For best results, set the
+     * sampling rate of the audio source to 16000 Hz. If that's not possible, use
+     * the native sample rate of the audio source (instead of re-sampling).
+     * Supported for the following encodings:
+     * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+     * * MULAW: Headerless 8-bit companded mulaw samples.
+     * * ALAW: Headerless 8-bit companded alaw samples.
+     * 
+ * + * int32 sample_rate_hertz = 2; + * + * @return The sampleRateHertz. + */ + @java.lang.Override + public int getSampleRateHertz() { + return sampleRateHertz_; + } + /** + * + * + *
+     * Sample rate in Hertz of the audio data sent for recognition. Valid
+     * values are: 8000-48000. 16000 is optimal. For best results, set the
+     * sampling rate of the audio source to 16000 Hz. If that's not possible, use
+     * the native sample rate of the audio source (instead of re-sampling).
+     * Supported for the following encodings:
+     * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+     * * MULAW: Headerless 8-bit companded mulaw samples.
+     * * ALAW: Headerless 8-bit companded alaw samples.
+     * 
+ * + * int32 sample_rate_hertz = 2; + * + * @param value The sampleRateHertz to set. + * @return This builder for chaining. + */ + public Builder setSampleRateHertz(int value) { + + sampleRateHertz_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Sample rate in Hertz of the audio data sent for recognition. Valid
+     * values are: 8000-48000. 16000 is optimal. For best results, set the
+     * sampling rate of the audio source to 16000 Hz. If that's not possible, use
+     * the native sample rate of the audio source (instead of re-sampling).
+     * Supported for the following encodings:
+     * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+     * * MULAW: Headerless 8-bit companded mulaw samples.
+     * * ALAW: Headerless 8-bit companded alaw samples.
+     * 
+ * + * int32 sample_rate_hertz = 2; + * + * @return This builder for chaining. + */ + public Builder clearSampleRateHertz() { + + sampleRateHertz_ = 0; + onChanged(); + return this; + } + + private int audioChannelCount_; + /** + * + * + *
+     * Number of channels present in the audio data sent for recognition.
+     * Supported for the following encodings:
+     * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+     * * MULAW: Headerless 8-bit companded mulaw samples.
+     * * ALAW: Headerless 8-bit companded alaw samples.
+     * 
+ * + * int32 audio_channel_count = 3; + * + * @return The audioChannelCount. + */ + @java.lang.Override + public int getAudioChannelCount() { + return audioChannelCount_; + } + /** + * + * + *
+     * Number of channels present in the audio data sent for recognition.
+     * Supported for the following encodings:
+     * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+     * * MULAW: Headerless 8-bit companded mulaw samples.
+     * * ALAW: Headerless 8-bit companded alaw samples.
+     * 
+ * + * int32 audio_channel_count = 3; + * + * @param value The audioChannelCount to set. + * @return This builder for chaining. + */ + public Builder setAudioChannelCount(int value) { + + audioChannelCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of channels present in the audio data sent for recognition.
+     * Supported for the following encodings:
+     * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+     * * MULAW: Headerless 8-bit companded mulaw samples.
+     * * ALAW: Headerless 8-bit companded alaw samples.
+     * 
+ * + * int32 audio_channel_count = 3; + * + * @return This builder for chaining. + */ + public Builder clearAudioChannelCount() { + + audioChannelCount_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.ExplicitDecodingConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.ExplicitDecodingConfig) + private static final com.google.cloud.speech.v2.ExplicitDecodingConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.ExplicitDecodingConfig(); + } + + public static com.google.cloud.speech.v2.ExplicitDecodingConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExplicitDecodingConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExplicitDecodingConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfigOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfigOrBuilder.java new file mode 100644 index 000000000000..6ccfdbb1b03f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ExplicitDecodingConfigOrBuilder.java @@ -0,0 +1,91 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ExplicitDecodingConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.ExplicitDecodingConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Encoding of the audio data sent for recognition.
+   * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for encoding. + */ + int getEncodingValue(); + /** + * + * + *
+   * Required. Encoding of the audio data sent for recognition.
+   * 
+ * + * + * .google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The encoding. + */ + com.google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding getEncoding(); + + /** + * + * + *
+   * Sample rate in Hertz of the audio data sent for recognition. Valid
+   * values are: 8000-48000. 16000 is optimal. For best results, set the
+   * sampling rate of the audio source to 16000 Hz. If that's not possible, use
+   * the native sample rate of the audio source (instead of re-sampling).
+   * Supported for the following encodings:
+   * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+   * * MULAW: Headerless 8-bit companded mulaw samples.
+   * * ALAW: Headerless 8-bit companded alaw samples.
+   * 
+ * + * int32 sample_rate_hertz = 2; + * + * @return The sampleRateHertz. + */ + int getSampleRateHertz(); + + /** + * + * + *
+   * Number of channels present in the audio data sent for recognition.
+   * Supported for the following encodings:
+   * * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
+   * * MULAW: Headerless 8-bit companded mulaw samples.
+   * * ALAW: Headerless 8-bit companded alaw samples.
+   * 
+ * + * int32 audio_channel_count = 3; + * + * @return The audioChannelCount. + */ + int getAudioChannelCount(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequest.java new file mode 100644 index 000000000000..43374c3bdeb9 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequest.java @@ -0,0 +1,666 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [GetConfig][google.cloud.speech.v2.Speech.GetConfig] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetConfigRequest} + */ +public final class GetConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.GetConfigRequest) + GetConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetConfigRequest.newBuilder() to construct. + private GetConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetConfigRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetConfigRequest.class, + com.google.cloud.speech.v2.GetConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the config to retrieve. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the config to retrieve. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.GetConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.GetConfigRequest other = + (com.google.cloud.speech.v2.GetConfigRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.GetConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [GetConfig][google.cloud.speech.v2.Speech.GetConfig] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.GetConfigRequest) + com.google.cloud.speech.v2.GetConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetConfigRequest.class, + com.google.cloud.speech.v2.GetConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.GetConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetConfigRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.GetConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetConfigRequest build() { + com.google.cloud.speech.v2.GetConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetConfigRequest buildPartial() { + com.google.cloud.speech.v2.GetConfigRequest result = + new com.google.cloud.speech.v2.GetConfigRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.GetConfigRequest) { + return mergeFrom((com.google.cloud.speech.v2.GetConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.GetConfigRequest other) { + if (other == com.google.cloud.speech.v2.GetConfigRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.GetConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.GetConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the config to retrieve. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the config to retrieve. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the config to retrieve. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the config to retrieve. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the config to retrieve. There is exactly one config
+     * resource per project per location. The expected format is
+     * `projects/{project}/locations/{location}/config`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.GetConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.GetConfigRequest) + private static final com.google.cloud.speech.v2.GetConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.GetConfigRequest(); + } + + public static com.google.cloud.speech.v2.GetConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequestOrBuilder.java new file mode 100644 index 000000000000..b69d7aefe5d0 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetConfigRequestOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface GetConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.GetConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the config to retrieve. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the config to retrieve. There is exactly one config
+   * resource per project per location. The expected format is
+   * `projects/{project}/locations/{location}/config`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequest.java new file mode 100644 index 000000000000..a327e582ab89 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequest.java @@ -0,0 +1,660 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [GetCustomClass][google.cloud.speech.v2.Speech.GetCustomClass] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetCustomClassRequest} + */ +public final class GetCustomClassRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.GetCustomClassRequest) + GetCustomClassRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetCustomClassRequest.newBuilder() to construct. + private GetCustomClassRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetCustomClassRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetCustomClassRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetCustomClassRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetCustomClassRequest.class, + com.google.cloud.speech.v2.GetCustomClassRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the CustomClass to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the CustomClass to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.GetCustomClassRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.GetCustomClassRequest other = + (com.google.cloud.speech.v2.GetCustomClassRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.GetCustomClassRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [GetCustomClass][google.cloud.speech.v2.Speech.GetCustomClass] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetCustomClassRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.GetCustomClassRequest) + com.google.cloud.speech.v2.GetCustomClassRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetCustomClassRequest.class, + com.google.cloud.speech.v2.GetCustomClassRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.GetCustomClassRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetCustomClassRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetCustomClassRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.GetCustomClassRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetCustomClassRequest build() { + com.google.cloud.speech.v2.GetCustomClassRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetCustomClassRequest buildPartial() { + com.google.cloud.speech.v2.GetCustomClassRequest result = + new com.google.cloud.speech.v2.GetCustomClassRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.GetCustomClassRequest) { + return mergeFrom((com.google.cloud.speech.v2.GetCustomClassRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.GetCustomClassRequest other) { + if (other == com.google.cloud.speech.v2.GetCustomClassRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.GetCustomClassRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.GetCustomClassRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the CustomClass to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the CustomClass to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the CustomClass to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the CustomClass to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the CustomClass to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.GetCustomClassRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.GetCustomClassRequest) + private static final com.google.cloud.speech.v2.GetCustomClassRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.GetCustomClassRequest(); + } + + public static com.google.cloud.speech.v2.GetCustomClassRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetCustomClassRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetCustomClassRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetCustomClassRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequestOrBuilder.java new file mode 100644 index 000000000000..4988dd99a937 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetCustomClassRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface GetCustomClassRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.GetCustomClassRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the CustomClass to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the CustomClass to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequest.java new file mode 100644 index 000000000000..c4441d59df15 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequest.java @@ -0,0 +1,659 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [GetPhraseSet][google.cloud.speech.v2.Speech.GetPhraseSet] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetPhraseSetRequest} + */ +public final class GetPhraseSetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.GetPhraseSetRequest) + GetPhraseSetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetPhraseSetRequest.newBuilder() to construct. + private GetPhraseSetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetPhraseSetRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetPhraseSetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetPhraseSetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetPhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetPhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetPhraseSetRequest.class, + com.google.cloud.speech.v2.GetPhraseSetRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the PhraseSet to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the PhraseSet to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.GetPhraseSetRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.GetPhraseSetRequest other = + (com.google.cloud.speech.v2.GetPhraseSetRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.GetPhraseSetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [GetPhraseSet][google.cloud.speech.v2.Speech.GetPhraseSet] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetPhraseSetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.GetPhraseSetRequest) + com.google.cloud.speech.v2.GetPhraseSetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetPhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetPhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetPhraseSetRequest.class, + com.google.cloud.speech.v2.GetPhraseSetRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.GetPhraseSetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetPhraseSetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetPhraseSetRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.GetPhraseSetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetPhraseSetRequest build() { + com.google.cloud.speech.v2.GetPhraseSetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetPhraseSetRequest buildPartial() { + com.google.cloud.speech.v2.GetPhraseSetRequest result = + new com.google.cloud.speech.v2.GetPhraseSetRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.GetPhraseSetRequest) { + return mergeFrom((com.google.cloud.speech.v2.GetPhraseSetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.GetPhraseSetRequest other) { + if (other == com.google.cloud.speech.v2.GetPhraseSetRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.GetPhraseSetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.GetPhraseSetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the PhraseSet to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the PhraseSet to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the PhraseSet to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the PhraseSet to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the PhraseSet to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.GetPhraseSetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.GetPhraseSetRequest) + private static final com.google.cloud.speech.v2.GetPhraseSetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.GetPhraseSetRequest(); + } + + public static com.google.cloud.speech.v2.GetPhraseSetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetPhraseSetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetPhraseSetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetPhraseSetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequestOrBuilder.java new file mode 100644 index 000000000000..d1e52870afb2 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetPhraseSetRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface GetPhraseSetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.GetPhraseSetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the PhraseSet to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the PhraseSet to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequest.java new file mode 100644 index 000000000000..87b2ed44852e --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequest.java @@ -0,0 +1,660 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [GetRecognizer][google.cloud.speech.v2.Speech.GetRecognizer] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetRecognizerRequest} + */ +public final class GetRecognizerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.GetRecognizerRequest) + GetRecognizerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetRecognizerRequest.newBuilder() to construct. + private GetRecognizerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetRecognizerRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetRecognizerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetRecognizerRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetRecognizerRequest.class, + com.google.cloud.speech.v2.GetRecognizerRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the Recognizer to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Recognizer to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.GetRecognizerRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.GetRecognizerRequest other = + (com.google.cloud.speech.v2.GetRecognizerRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.GetRecognizerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [GetRecognizer][google.cloud.speech.v2.Speech.GetRecognizer] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.GetRecognizerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.GetRecognizerRequest) + com.google.cloud.speech.v2.GetRecognizerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.GetRecognizerRequest.class, + com.google.cloud.speech.v2.GetRecognizerRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.GetRecognizerRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_GetRecognizerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetRecognizerRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.GetRecognizerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetRecognizerRequest build() { + com.google.cloud.speech.v2.GetRecognizerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetRecognizerRequest buildPartial() { + com.google.cloud.speech.v2.GetRecognizerRequest result = + new com.google.cloud.speech.v2.GetRecognizerRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.GetRecognizerRequest) { + return mergeFrom((com.google.cloud.speech.v2.GetRecognizerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.GetRecognizerRequest other) { + if (other == com.google.cloud.speech.v2.GetRecognizerRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.GetRecognizerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.GetRecognizerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Recognizer to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to retrieve. The expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.GetRecognizerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.GetRecognizerRequest) + private static final com.google.cloud.speech.v2.GetRecognizerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.GetRecognizerRequest(); + } + + public static com.google.cloud.speech.v2.GetRecognizerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetRecognizerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetRecognizerRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.GetRecognizerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequestOrBuilder.java new file mode 100644 index 000000000000..0b709d73d3e5 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/GetRecognizerRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface GetRecognizerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.GetRecognizerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Recognizer to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Recognizer to retrieve. The expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequest.java new file mode 100644 index 000000000000..27f1c56c0b9e --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequest.java @@ -0,0 +1,1067 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListCustomClassesRequest} + */ +public final class ListCustomClassesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.ListCustomClassesRequest) + ListCustomClassesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListCustomClassesRequest.newBuilder() to construct. + private ListCustomClassesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListCustomClassesRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListCustomClassesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListCustomClassesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 32: + { + showDeleted_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListCustomClassesRequest.class, + com.google.cloud.speech.v2.ListCustomClassesRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project and location of CustomClass resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project and location of CustomClass resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Number of results per requests. A valid page_size ranges from 0 to 20
+   * inclusive. If the page_size is zero or unspecified, a page size of 5 will
+   * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note
+   * that a call might return fewer results than the requested page size.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A page token, received from a previous
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+   * match the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token, received from a previous
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+   * match the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SHOW_DELETED_FIELD_NUMBER = 4; + private boolean showDeleted_; + /** + * + * + *
+   * Whether, or not, to show resources that have been deleted.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (showDeleted_ != false) { + output.writeBool(4, showDeleted_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (showDeleted_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, showDeleted_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.ListCustomClassesRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.ListCustomClassesRequest other = + (com.google.cloud.speech.v2.ListCustomClassesRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getShowDeleted() != other.getShowDeleted()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + SHOW_DELETED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getShowDeleted()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.ListCustomClassesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListCustomClassesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.ListCustomClassesRequest) + com.google.cloud.speech.v2.ListCustomClassesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListCustomClassesRequest.class, + com.google.cloud.speech.v2.ListCustomClassesRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.ListCustomClassesRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + showDeleted_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.ListCustomClassesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesRequest build() { + com.google.cloud.speech.v2.ListCustomClassesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesRequest buildPartial() { + com.google.cloud.speech.v2.ListCustomClassesRequest result = + new com.google.cloud.speech.v2.ListCustomClassesRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.showDeleted_ = showDeleted_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.ListCustomClassesRequest) { + return mergeFrom((com.google.cloud.speech.v2.ListCustomClassesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.ListCustomClassesRequest other) { + if (other == com.google.cloud.speech.v2.ListCustomClassesRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getShowDeleted() != false) { + setShowDeleted(other.getShowDeleted()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.ListCustomClassesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.ListCustomClassesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project and location of CustomClass resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project and location of CustomClass resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project and location of CustomClass resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location of CustomClass resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location of CustomClass resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Number of results per requests. A valid page_size ranges from 0 to 20
+     * inclusive. If the page_size is zero or unspecified, a page size of 5 will
+     * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note
+     * that a call might return fewer results than the requested page size.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Number of results per requests. A valid page_size ranges from 0 to 20
+     * inclusive. If the page_size is zero or unspecified, a page size of 5 will
+     * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note
+     * that a call might return fewer results than the requested page size.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of results per requests. A valid page_size ranges from 0 to 20
+     * inclusive. If the page_size is zero or unspecified, a page size of 5 will
+     * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note
+     * that a call might return fewer results than the requested page size.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token, received from a previous
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+     * match the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+     * match the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+     * match the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+     * match the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+     * match the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private boolean showDeleted_; + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @param value The showDeleted to set. + * @return This builder for chaining. + */ + public Builder setShowDeleted(boolean value) { + + showDeleted_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @return This builder for chaining. + */ + public Builder clearShowDeleted() { + + showDeleted_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.ListCustomClassesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.ListCustomClassesRequest) + private static final com.google.cloud.speech.v2.ListCustomClassesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.ListCustomClassesRequest(); + } + + public static com.google.cloud.speech.v2.ListCustomClassesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListCustomClassesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCustomClassesRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequestOrBuilder.java new file mode 100644 index 000000000000..86ead68f92f1 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesRequestOrBuilder.java @@ -0,0 +1,120 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ListCustomClassesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.ListCustomClassesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The project and location of CustomClass resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project and location of CustomClass resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Number of results per requests. A valid page_size ranges from 0 to 20
+   * inclusive. If the page_size is zero or unspecified, a page size of 5 will
+   * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note
+   * that a call might return fewer results than the requested page size.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token, received from a previous
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+   * match the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token, received from a previous
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
+   * match the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Whether, or not, to show resources that have been deleted.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + boolean getShowDeleted(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponse.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponse.java new file mode 100644 index 000000000000..1fa421812df2 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponse.java @@ -0,0 +1,1158 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Response message for the
+ * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListCustomClassesResponse} + */ +public final class ListCustomClassesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.ListCustomClassesResponse) + ListCustomClassesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListCustomClassesResponse.newBuilder() to construct. + private ListCustomClassesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListCustomClassesResponse() { + customClasses_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListCustomClassesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListCustomClassesResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + customClasses_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + customClasses_.add( + input.readMessage( + com.google.cloud.speech.v2.CustomClass.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + customClasses_ = java.util.Collections.unmodifiableList(customClasses_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListCustomClassesResponse.class, + com.google.cloud.speech.v2.ListCustomClassesResponse.Builder.class); + } + + public static final int CUSTOM_CLASSES_FIELD_NUMBER = 1; + private java.util.List customClasses_; + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + @java.lang.Override + public java.util.List getCustomClassesList() { + return customClasses_; + } + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + @java.lang.Override + public java.util.List + getCustomClassesOrBuilderList() { + return customClasses_; + } + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + @java.lang.Override + public int getCustomClassesCount() { + return customClasses_.size(); + } + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass getCustomClasses(int index) { + return customClasses_.get(index); + } + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassesOrBuilder(int index) { + return customClasses_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < customClasses_.size(); i++) { + output.writeMessage(1, customClasses_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < customClasses_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, customClasses_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.ListCustomClassesResponse)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.ListCustomClassesResponse other = + (com.google.cloud.speech.v2.ListCustomClassesResponse) obj; + + if (!getCustomClassesList().equals(other.getCustomClassesList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getCustomClassesCount() > 0) { + hash = (37 * hash) + CUSTOM_CLASSES_FIELD_NUMBER; + hash = (53 * hash) + getCustomClassesList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.ListCustomClassesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the
+   * [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListCustomClassesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.ListCustomClassesResponse) + com.google.cloud.speech.v2.ListCustomClassesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListCustomClassesResponse.class, + com.google.cloud.speech.v2.ListCustomClassesResponse.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.ListCustomClassesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getCustomClassesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (customClassesBuilder_ == null) { + customClasses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + customClassesBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListCustomClassesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesResponse getDefaultInstanceForType() { + return com.google.cloud.speech.v2.ListCustomClassesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesResponse build() { + com.google.cloud.speech.v2.ListCustomClassesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesResponse buildPartial() { + com.google.cloud.speech.v2.ListCustomClassesResponse result = + new com.google.cloud.speech.v2.ListCustomClassesResponse(this); + int from_bitField0_ = bitField0_; + if (customClassesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + customClasses_ = java.util.Collections.unmodifiableList(customClasses_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.customClasses_ = customClasses_; + } else { + result.customClasses_ = customClassesBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.ListCustomClassesResponse) { + return mergeFrom((com.google.cloud.speech.v2.ListCustomClassesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.ListCustomClassesResponse other) { + if (other == com.google.cloud.speech.v2.ListCustomClassesResponse.getDefaultInstance()) + return this; + if (customClassesBuilder_ == null) { + if (!other.customClasses_.isEmpty()) { + if (customClasses_.isEmpty()) { + customClasses_ = other.customClasses_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCustomClassesIsMutable(); + customClasses_.addAll(other.customClasses_); + } + onChanged(); + } + } else { + if (!other.customClasses_.isEmpty()) { + if (customClassesBuilder_.isEmpty()) { + customClassesBuilder_.dispose(); + customClassesBuilder_ = null; + customClasses_ = other.customClasses_; + bitField0_ = (bitField0_ & ~0x00000001); + customClassesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getCustomClassesFieldBuilder() + : null; + } else { + customClassesBuilder_.addAllMessages(other.customClasses_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.ListCustomClassesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.ListCustomClassesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List customClasses_ = + java.util.Collections.emptyList(); + + private void ensureCustomClassesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + customClasses_ = + new java.util.ArrayList(customClasses_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + customClassesBuilder_; + + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public java.util.List getCustomClassesList() { + if (customClassesBuilder_ == null) { + return java.util.Collections.unmodifiableList(customClasses_); + } else { + return customClassesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public int getCustomClassesCount() { + if (customClassesBuilder_ == null) { + return customClasses_.size(); + } else { + return customClassesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public com.google.cloud.speech.v2.CustomClass getCustomClasses(int index) { + if (customClassesBuilder_ == null) { + return customClasses_.get(index); + } else { + return customClassesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder setCustomClasses(int index, com.google.cloud.speech.v2.CustomClass value) { + if (customClassesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCustomClassesIsMutable(); + customClasses_.set(index, value); + onChanged(); + } else { + customClassesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder setCustomClasses( + int index, com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.set(index, builderForValue.build()); + onChanged(); + } else { + customClassesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder addCustomClasses(com.google.cloud.speech.v2.CustomClass value) { + if (customClassesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCustomClassesIsMutable(); + customClasses_.add(value); + onChanged(); + } else { + customClassesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder addCustomClasses(int index, com.google.cloud.speech.v2.CustomClass value) { + if (customClassesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCustomClassesIsMutable(); + customClasses_.add(index, value); + onChanged(); + } else { + customClassesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder addCustomClasses( + com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.add(builderForValue.build()); + onChanged(); + } else { + customClassesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder addCustomClasses( + int index, com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.add(index, builderForValue.build()); + onChanged(); + } else { + customClassesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder addAllCustomClasses( + java.lang.Iterable values) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, customClasses_); + onChanged(); + } else { + customClassesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder clearCustomClasses() { + if (customClassesBuilder_ == null) { + customClasses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + customClassesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public Builder removeCustomClasses(int index) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.remove(index); + onChanged(); + } else { + customClassesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public com.google.cloud.speech.v2.CustomClass.Builder getCustomClassesBuilder(int index) { + return getCustomClassesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassesOrBuilder(int index) { + if (customClassesBuilder_ == null) { + return customClasses_.get(index); + } else { + return customClassesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public java.util.List + getCustomClassesOrBuilderList() { + if (customClassesBuilder_ != null) { + return customClassesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(customClasses_); + } + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public com.google.cloud.speech.v2.CustomClass.Builder addCustomClassesBuilder() { + return getCustomClassesFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.CustomClass.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public com.google.cloud.speech.v2.CustomClass.Builder addCustomClassesBuilder(int index) { + return getCustomClassesFieldBuilder() + .addBuilder(index, com.google.cloud.speech.v2.CustomClass.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested CustomClasses.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + public java.util.List + getCustomClassesBuilderList() { + return getCustomClassesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + getCustomClassesFieldBuilder() { + if (customClassesBuilder_ == null) { + customClassesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder>( + customClasses_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + customClasses_ = null; + } + return customClassesBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.ListCustomClassesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.ListCustomClassesResponse) + private static final com.google.cloud.speech.v2.ListCustomClassesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.ListCustomClassesResponse(); + } + + public static com.google.cloud.speech.v2.ListCustomClassesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListCustomClassesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCustomClassesResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListCustomClassesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponseOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponseOrBuilder.java new file mode 100644 index 000000000000..0177a87b7564 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListCustomClassesResponseOrBuilder.java @@ -0,0 +1,108 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ListCustomClassesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.ListCustomClassesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + java.util.List getCustomClassesList(); + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + com.google.cloud.speech.v2.CustomClass getCustomClasses(int index); + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + int getCustomClassesCount(); + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + java.util.List + getCustomClassesOrBuilderList(); + /** + * + * + *
+   * The list of requested CustomClasses.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 1; + */ + com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassesOrBuilder(int index); + + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequest.java new file mode 100644 index 000000000000..ad9c4e6433b6 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequest.java @@ -0,0 +1,1062 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListPhraseSetsRequest} + */ +public final class ListPhraseSetsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.ListPhraseSetsRequest) + ListPhraseSetsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListPhraseSetsRequest.newBuilder() to construct. + private ListPhraseSetsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListPhraseSetsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListPhraseSetsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListPhraseSetsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 32: + { + showDeleted_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListPhraseSetsRequest.class, + com.google.cloud.speech.v2.ListPhraseSetsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project and location of PhraseSet resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project and location of PhraseSet resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * The maximum number of PhraseSets to return. The service may return fewer
+   * than this value. If unspecified, at most 20 PhraseSets will be returned.
+   * The maximum value is 20; values above 20 will be coerced to 20.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A page token, received from a previous
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token, received from a previous
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SHOW_DELETED_FIELD_NUMBER = 4; + private boolean showDeleted_; + /** + * + * + *
+   * Whether, or not, to show resources that have been deleted.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (showDeleted_ != false) { + output.writeBool(4, showDeleted_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (showDeleted_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, showDeleted_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.ListPhraseSetsRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.ListPhraseSetsRequest other = + (com.google.cloud.speech.v2.ListPhraseSetsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getShowDeleted() != other.getShowDeleted()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + SHOW_DELETED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getShowDeleted()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.ListPhraseSetsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListPhraseSetsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.ListPhraseSetsRequest) + com.google.cloud.speech.v2.ListPhraseSetsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListPhraseSetsRequest.class, + com.google.cloud.speech.v2.ListPhraseSetsRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.ListPhraseSetsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + showDeleted_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.ListPhraseSetsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsRequest build() { + com.google.cloud.speech.v2.ListPhraseSetsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsRequest buildPartial() { + com.google.cloud.speech.v2.ListPhraseSetsRequest result = + new com.google.cloud.speech.v2.ListPhraseSetsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.showDeleted_ = showDeleted_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.ListPhraseSetsRequest) { + return mergeFrom((com.google.cloud.speech.v2.ListPhraseSetsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.ListPhraseSetsRequest other) { + if (other == com.google.cloud.speech.v2.ListPhraseSetsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getShowDeleted() != false) { + setShowDeleted(other.getShowDeleted()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.ListPhraseSetsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.ListPhraseSetsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project and location of PhraseSet resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project and location of PhraseSet resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project and location of PhraseSet resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location of PhraseSet resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location of PhraseSet resources to list. The
+     * expected format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * The maximum number of PhraseSets to return. The service may return fewer
+     * than this value. If unspecified, at most 20 PhraseSets will be returned.
+     * The maximum value is 20; values above 20 will be coerced to 20.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * The maximum number of PhraseSets to return. The service may return fewer
+     * than this value. If unspecified, at most 20 PhraseSets will be returned.
+     * The maximum value is 20; values above 20 will be coerced to 20.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The maximum number of PhraseSets to return. The service may return fewer
+     * than this value. If unspecified, at most 20 PhraseSets will be returned.
+     * The maximum value is 20; values above 20 will be coerced to 20.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token, received from a previous
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private boolean showDeleted_; + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @param value The showDeleted to set. + * @return This builder for chaining. + */ + public Builder setShowDeleted(boolean value) { + + showDeleted_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @return This builder for chaining. + */ + public Builder clearShowDeleted() { + + showDeleted_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.ListPhraseSetsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.ListPhraseSetsRequest) + private static final com.google.cloud.speech.v2.ListPhraseSetsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.ListPhraseSetsRequest(); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListPhraseSetsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListPhraseSetsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequestOrBuilder.java new file mode 100644 index 000000000000..0d0d9c9ab953 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsRequestOrBuilder.java @@ -0,0 +1,119 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ListPhraseSetsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.ListPhraseSetsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The project and location of PhraseSet resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project and location of PhraseSet resources to list. The
+   * expected format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The maximum number of PhraseSets to return. The service may return fewer
+   * than this value. If unspecified, at most 20 PhraseSets will be returned.
+   * The maximum value is 20; values above 20 will be coerced to 20.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token, received from a previous
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token, received from a previous
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Whether, or not, to show resources that have been deleted.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + boolean getShowDeleted(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponse.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponse.java new file mode 100644 index 000000000000..eebdfcc3c5d0 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponse.java @@ -0,0 +1,1152 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Response message for the
+ * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListPhraseSetsResponse} + */ +public final class ListPhraseSetsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.ListPhraseSetsResponse) + ListPhraseSetsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListPhraseSetsResponse.newBuilder() to construct. + private ListPhraseSetsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListPhraseSetsResponse() { + phraseSets_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListPhraseSetsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListPhraseSetsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + phraseSets_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + phraseSets_.add( + input.readMessage( + com.google.cloud.speech.v2.PhraseSet.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + phraseSets_ = java.util.Collections.unmodifiableList(phraseSets_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListPhraseSetsResponse.class, + com.google.cloud.speech.v2.ListPhraseSetsResponse.Builder.class); + } + + public static final int PHRASE_SETS_FIELD_NUMBER = 1; + private java.util.List phraseSets_; + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + @java.lang.Override + public java.util.List getPhraseSetsList() { + return phraseSets_; + } + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + @java.lang.Override + public java.util.List + getPhraseSetsOrBuilderList() { + return phraseSets_; + } + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + @java.lang.Override + public int getPhraseSetsCount() { + return phraseSets_.size(); + } + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet getPhraseSets(int index) { + return phraseSets_.get(index); + } + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetsOrBuilder(int index) { + return phraseSets_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < phraseSets_.size(); i++) { + output.writeMessage(1, phraseSets_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < phraseSets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, phraseSets_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.ListPhraseSetsResponse)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.ListPhraseSetsResponse other = + (com.google.cloud.speech.v2.ListPhraseSetsResponse) obj; + + if (!getPhraseSetsList().equals(other.getPhraseSetsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getPhraseSetsCount() > 0) { + hash = (37 * hash) + PHRASE_SETS_FIELD_NUMBER; + hash = (53 * hash) + getPhraseSetsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.ListPhraseSetsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the
+   * [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListPhraseSetsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.ListPhraseSetsResponse) + com.google.cloud.speech.v2.ListPhraseSetsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListPhraseSetsResponse.class, + com.google.cloud.speech.v2.ListPhraseSetsResponse.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.ListPhraseSetsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getPhraseSetsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (phraseSetsBuilder_ == null) { + phraseSets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + phraseSetsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListPhraseSetsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsResponse getDefaultInstanceForType() { + return com.google.cloud.speech.v2.ListPhraseSetsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsResponse build() { + com.google.cloud.speech.v2.ListPhraseSetsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsResponse buildPartial() { + com.google.cloud.speech.v2.ListPhraseSetsResponse result = + new com.google.cloud.speech.v2.ListPhraseSetsResponse(this); + int from_bitField0_ = bitField0_; + if (phraseSetsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + phraseSets_ = java.util.Collections.unmodifiableList(phraseSets_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.phraseSets_ = phraseSets_; + } else { + result.phraseSets_ = phraseSetsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.ListPhraseSetsResponse) { + return mergeFrom((com.google.cloud.speech.v2.ListPhraseSetsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.ListPhraseSetsResponse other) { + if (other == com.google.cloud.speech.v2.ListPhraseSetsResponse.getDefaultInstance()) + return this; + if (phraseSetsBuilder_ == null) { + if (!other.phraseSets_.isEmpty()) { + if (phraseSets_.isEmpty()) { + phraseSets_ = other.phraseSets_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePhraseSetsIsMutable(); + phraseSets_.addAll(other.phraseSets_); + } + onChanged(); + } + } else { + if (!other.phraseSets_.isEmpty()) { + if (phraseSetsBuilder_.isEmpty()) { + phraseSetsBuilder_.dispose(); + phraseSetsBuilder_ = null; + phraseSets_ = other.phraseSets_; + bitField0_ = (bitField0_ & ~0x00000001); + phraseSetsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getPhraseSetsFieldBuilder() + : null; + } else { + phraseSetsBuilder_.addAllMessages(other.phraseSets_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.ListPhraseSetsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.ListPhraseSetsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List phraseSets_ = + java.util.Collections.emptyList(); + + private void ensurePhraseSetsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + phraseSets_ = new java.util.ArrayList(phraseSets_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + phraseSetsBuilder_; + + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public java.util.List getPhraseSetsList() { + if (phraseSetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(phraseSets_); + } else { + return phraseSetsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public int getPhraseSetsCount() { + if (phraseSetsBuilder_ == null) { + return phraseSets_.size(); + } else { + return phraseSetsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public com.google.cloud.speech.v2.PhraseSet getPhraseSets(int index) { + if (phraseSetsBuilder_ == null) { + return phraseSets_.get(index); + } else { + return phraseSetsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder setPhraseSets(int index, com.google.cloud.speech.v2.PhraseSet value) { + if (phraseSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhraseSetsIsMutable(); + phraseSets_.set(index, value); + onChanged(); + } else { + phraseSetsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder setPhraseSets( + int index, com.google.cloud.speech.v2.PhraseSet.Builder builderForValue) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.set(index, builderForValue.build()); + onChanged(); + } else { + phraseSetsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder addPhraseSets(com.google.cloud.speech.v2.PhraseSet value) { + if (phraseSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhraseSetsIsMutable(); + phraseSets_.add(value); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder addPhraseSets(int index, com.google.cloud.speech.v2.PhraseSet value) { + if (phraseSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhraseSetsIsMutable(); + phraseSets_.add(index, value); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder addPhraseSets(com.google.cloud.speech.v2.PhraseSet.Builder builderForValue) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.add(builderForValue.build()); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder addPhraseSets( + int index, com.google.cloud.speech.v2.PhraseSet.Builder builderForValue) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.add(index, builderForValue.build()); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder addAllPhraseSets( + java.lang.Iterable values) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, phraseSets_); + onChanged(); + } else { + phraseSetsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder clearPhraseSets() { + if (phraseSetsBuilder_ == null) { + phraseSets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + phraseSetsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public Builder removePhraseSets(int index) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.remove(index); + onChanged(); + } else { + phraseSetsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public com.google.cloud.speech.v2.PhraseSet.Builder getPhraseSetsBuilder(int index) { + return getPhraseSetsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetsOrBuilder(int index) { + if (phraseSetsBuilder_ == null) { + return phraseSets_.get(index); + } else { + return phraseSetsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public java.util.List + getPhraseSetsOrBuilderList() { + if (phraseSetsBuilder_ != null) { + return phraseSetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(phraseSets_); + } + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public com.google.cloud.speech.v2.PhraseSet.Builder addPhraseSetsBuilder() { + return getPhraseSetsFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.PhraseSet.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public com.google.cloud.speech.v2.PhraseSet.Builder addPhraseSetsBuilder(int index) { + return getPhraseSetsFieldBuilder() + .addBuilder(index, com.google.cloud.speech.v2.PhraseSet.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested PhraseSets.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + public java.util.List getPhraseSetsBuilderList() { + return getPhraseSetsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + getPhraseSetsFieldBuilder() { + if (phraseSetsBuilder_ == null) { + phraseSetsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder>( + phraseSets_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + phraseSets_ = null; + } + return phraseSetsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.ListPhraseSetsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.ListPhraseSetsResponse) + private static final com.google.cloud.speech.v2.ListPhraseSetsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.ListPhraseSetsResponse(); + } + + public static com.google.cloud.speech.v2.ListPhraseSetsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListPhraseSetsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListPhraseSetsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListPhraseSetsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponseOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponseOrBuilder.java new file mode 100644 index 000000000000..3d9cdca0eefa --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListPhraseSetsResponseOrBuilder.java @@ -0,0 +1,108 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ListPhraseSetsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.ListPhraseSetsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + java.util.List getPhraseSetsList(); + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + com.google.cloud.speech.v2.PhraseSet getPhraseSets(int index); + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + int getPhraseSetsCount(); + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + java.util.List + getPhraseSetsOrBuilderList(); + /** + * + * + *
+   * The list of requested PhraseSets.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet phrase_sets = 1; + */ + com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetsOrBuilder(int index); + + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequest.java new file mode 100644 index 000000000000..034d8f4e776d --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequest.java @@ -0,0 +1,1063 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListRecognizersRequest} + */ +public final class ListRecognizersRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.ListRecognizersRequest) + ListRecognizersRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListRecognizersRequest.newBuilder() to construct. + private ListRecognizersRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListRecognizersRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListRecognizersRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListRecognizersRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 32: + { + showDeleted_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListRecognizersRequest.class, + com.google.cloud.speech.v2.ListRecognizersRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project and location of Recognizers to list. The expected
+   * format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project and location of Recognizers to list. The expected
+   * format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * The maximum number of Recognizers to return. The service may return fewer
+   * than this value. If unspecified, at most 20 Recognizers will be returned.
+   * The maximum value is 20; values above 20 will be coerced to 20.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A page token, received from a previous
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token, received from a previous
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SHOW_DELETED_FIELD_NUMBER = 4; + private boolean showDeleted_; + /** + * + * + *
+   * Whether, or not, to show resources that have been deleted.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (showDeleted_ != false) { + output.writeBool(4, showDeleted_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (showDeleted_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, showDeleted_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.ListRecognizersRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.ListRecognizersRequest other = + (com.google.cloud.speech.v2.ListRecognizersRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getShowDeleted() != other.getShowDeleted()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + SHOW_DELETED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getShowDeleted()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.ListRecognizersRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListRecognizersRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.ListRecognizersRequest) + com.google.cloud.speech.v2.ListRecognizersRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListRecognizersRequest.class, + com.google.cloud.speech.v2.ListRecognizersRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.ListRecognizersRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + showDeleted_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.ListRecognizersRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersRequest build() { + com.google.cloud.speech.v2.ListRecognizersRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersRequest buildPartial() { + com.google.cloud.speech.v2.ListRecognizersRequest result = + new com.google.cloud.speech.v2.ListRecognizersRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.showDeleted_ = showDeleted_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.ListRecognizersRequest) { + return mergeFrom((com.google.cloud.speech.v2.ListRecognizersRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.ListRecognizersRequest other) { + if (other == com.google.cloud.speech.v2.ListRecognizersRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getShowDeleted() != false) { + setShowDeleted(other.getShowDeleted()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.ListRecognizersRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.ListRecognizersRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project and location of Recognizers to list. The expected
+     * format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project and location of Recognizers to list. The expected
+     * format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project and location of Recognizers to list. The expected
+     * format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location of Recognizers to list. The expected
+     * format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project and location of Recognizers to list. The expected
+     * format is `projects/{project}/locations/{location}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * The maximum number of Recognizers to return. The service may return fewer
+     * than this value. If unspecified, at most 20 Recognizers will be returned.
+     * The maximum value is 20; values above 20 will be coerced to 20.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * The maximum number of Recognizers to return. The service may return fewer
+     * than this value. If unspecified, at most 20 Recognizers will be returned.
+     * The maximum value is 20; values above 20 will be coerced to 20.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The maximum number of Recognizers to return. The service may return fewer
+     * than this value. If unspecified, at most 20 Recognizers will be returned.
+     * The maximum value is 20; values above 20 will be coerced to 20.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token, received from a previous
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private boolean showDeleted_; + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @param value The showDeleted to set. + * @return This builder for chaining. + */ + public Builder setShowDeleted(boolean value) { + + showDeleted_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Whether, or not, to show resources that have been deleted.
+     * 
+ * + * bool show_deleted = 4; + * + * @return This builder for chaining. + */ + public Builder clearShowDeleted() { + + showDeleted_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.ListRecognizersRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.ListRecognizersRequest) + private static final com.google.cloud.speech.v2.ListRecognizersRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.ListRecognizersRequest(); + } + + public static com.google.cloud.speech.v2.ListRecognizersRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListRecognizersRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListRecognizersRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequestOrBuilder.java new file mode 100644 index 000000000000..96ffdcaa9487 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersRequestOrBuilder.java @@ -0,0 +1,119 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ListRecognizersRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.ListRecognizersRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The project and location of Recognizers to list. The expected
+   * format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project and location of Recognizers to list. The expected
+   * format is `projects/{project}/locations/{location}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The maximum number of Recognizers to return. The service may return fewer
+   * than this value. If unspecified, at most 20 Recognizers will be returned.
+   * The maximum value is 20; values above 20 will be coerced to 20.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token, received from a previous
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token, received from a previous
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Whether, or not, to show resources that have been deleted.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + boolean getShowDeleted(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponse.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponse.java new file mode 100644 index 000000000000..29d883f48167 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponse.java @@ -0,0 +1,1153 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Response message for the
+ * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListRecognizersResponse} + */ +public final class ListRecognizersResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.ListRecognizersResponse) + ListRecognizersResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListRecognizersResponse.newBuilder() to construct. + private ListRecognizersResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListRecognizersResponse() { + recognizers_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListRecognizersResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListRecognizersResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + recognizers_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + recognizers_.add( + input.readMessage( + com.google.cloud.speech.v2.Recognizer.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + recognizers_ = java.util.Collections.unmodifiableList(recognizers_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListRecognizersResponse.class, + com.google.cloud.speech.v2.ListRecognizersResponse.Builder.class); + } + + public static final int RECOGNIZERS_FIELD_NUMBER = 1; + private java.util.List recognizers_; + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + @java.lang.Override + public java.util.List getRecognizersList() { + return recognizers_; + } + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + @java.lang.Override + public java.util.List + getRecognizersOrBuilderList() { + return recognizers_; + } + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + @java.lang.Override + public int getRecognizersCount() { + return recognizers_.size(); + } + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer getRecognizers(int index) { + return recognizers_.get(index); + } + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizersOrBuilder(int index) { + return recognizers_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < recognizers_.size(); i++) { + output.writeMessage(1, recognizers_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < recognizers_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, recognizers_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.ListRecognizersResponse)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.ListRecognizersResponse other = + (com.google.cloud.speech.v2.ListRecognizersResponse) obj; + + if (!getRecognizersList().equals(other.getRecognizersList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getRecognizersCount() > 0) { + hash = (37 * hash) + RECOGNIZERS_FIELD_NUMBER; + hash = (53 * hash) + getRecognizersList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.ListRecognizersResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the
+   * [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.ListRecognizersResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.ListRecognizersResponse) + com.google.cloud.speech.v2.ListRecognizersResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.ListRecognizersResponse.class, + com.google.cloud.speech.v2.ListRecognizersResponse.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.ListRecognizersResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getRecognizersFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (recognizersBuilder_ == null) { + recognizers_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + recognizersBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_ListRecognizersResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersResponse getDefaultInstanceForType() { + return com.google.cloud.speech.v2.ListRecognizersResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersResponse build() { + com.google.cloud.speech.v2.ListRecognizersResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersResponse buildPartial() { + com.google.cloud.speech.v2.ListRecognizersResponse result = + new com.google.cloud.speech.v2.ListRecognizersResponse(this); + int from_bitField0_ = bitField0_; + if (recognizersBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + recognizers_ = java.util.Collections.unmodifiableList(recognizers_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.recognizers_ = recognizers_; + } else { + result.recognizers_ = recognizersBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.ListRecognizersResponse) { + return mergeFrom((com.google.cloud.speech.v2.ListRecognizersResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.ListRecognizersResponse other) { + if (other == com.google.cloud.speech.v2.ListRecognizersResponse.getDefaultInstance()) + return this; + if (recognizersBuilder_ == null) { + if (!other.recognizers_.isEmpty()) { + if (recognizers_.isEmpty()) { + recognizers_ = other.recognizers_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureRecognizersIsMutable(); + recognizers_.addAll(other.recognizers_); + } + onChanged(); + } + } else { + if (!other.recognizers_.isEmpty()) { + if (recognizersBuilder_.isEmpty()) { + recognizersBuilder_.dispose(); + recognizersBuilder_ = null; + recognizers_ = other.recognizers_; + bitField0_ = (bitField0_ & ~0x00000001); + recognizersBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getRecognizersFieldBuilder() + : null; + } else { + recognizersBuilder_.addAllMessages(other.recognizers_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.ListRecognizersResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.ListRecognizersResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List recognizers_ = + java.util.Collections.emptyList(); + + private void ensureRecognizersIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + recognizers_ = new java.util.ArrayList(recognizers_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder> + recognizersBuilder_; + + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public java.util.List getRecognizersList() { + if (recognizersBuilder_ == null) { + return java.util.Collections.unmodifiableList(recognizers_); + } else { + return recognizersBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public int getRecognizersCount() { + if (recognizersBuilder_ == null) { + return recognizers_.size(); + } else { + return recognizersBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public com.google.cloud.speech.v2.Recognizer getRecognizers(int index) { + if (recognizersBuilder_ == null) { + return recognizers_.get(index); + } else { + return recognizersBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder setRecognizers(int index, com.google.cloud.speech.v2.Recognizer value) { + if (recognizersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRecognizersIsMutable(); + recognizers_.set(index, value); + onChanged(); + } else { + recognizersBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder setRecognizers( + int index, com.google.cloud.speech.v2.Recognizer.Builder builderForValue) { + if (recognizersBuilder_ == null) { + ensureRecognizersIsMutable(); + recognizers_.set(index, builderForValue.build()); + onChanged(); + } else { + recognizersBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder addRecognizers(com.google.cloud.speech.v2.Recognizer value) { + if (recognizersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRecognizersIsMutable(); + recognizers_.add(value); + onChanged(); + } else { + recognizersBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder addRecognizers(int index, com.google.cloud.speech.v2.Recognizer value) { + if (recognizersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRecognizersIsMutable(); + recognizers_.add(index, value); + onChanged(); + } else { + recognizersBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder addRecognizers(com.google.cloud.speech.v2.Recognizer.Builder builderForValue) { + if (recognizersBuilder_ == null) { + ensureRecognizersIsMutable(); + recognizers_.add(builderForValue.build()); + onChanged(); + } else { + recognizersBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder addRecognizers( + int index, com.google.cloud.speech.v2.Recognizer.Builder builderForValue) { + if (recognizersBuilder_ == null) { + ensureRecognizersIsMutable(); + recognizers_.add(index, builderForValue.build()); + onChanged(); + } else { + recognizersBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder addAllRecognizers( + java.lang.Iterable values) { + if (recognizersBuilder_ == null) { + ensureRecognizersIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, recognizers_); + onChanged(); + } else { + recognizersBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder clearRecognizers() { + if (recognizersBuilder_ == null) { + recognizers_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + recognizersBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public Builder removeRecognizers(int index) { + if (recognizersBuilder_ == null) { + ensureRecognizersIsMutable(); + recognizers_.remove(index); + onChanged(); + } else { + recognizersBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public com.google.cloud.speech.v2.Recognizer.Builder getRecognizersBuilder(int index) { + return getRecognizersFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizersOrBuilder(int index) { + if (recognizersBuilder_ == null) { + return recognizers_.get(index); + } else { + return recognizersBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public java.util.List + getRecognizersOrBuilderList() { + if (recognizersBuilder_ != null) { + return recognizersBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(recognizers_); + } + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public com.google.cloud.speech.v2.Recognizer.Builder addRecognizersBuilder() { + return getRecognizersFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.Recognizer.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public com.google.cloud.speech.v2.Recognizer.Builder addRecognizersBuilder(int index) { + return getRecognizersFieldBuilder() + .addBuilder(index, com.google.cloud.speech.v2.Recognizer.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested Recognizers.
+     * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + public java.util.List + getRecognizersBuilderList() { + return getRecognizersFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder> + getRecognizersFieldBuilder() { + if (recognizersBuilder_ == null) { + recognizersBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder>( + recognizers_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + recognizers_ = null; + } + return recognizersBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token, which can be sent as
+     * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+     * retrieve the next page. If this field is omitted, there are no subsequent
+     * pages. This token expires after 72 hours.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.ListRecognizersResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.ListRecognizersResponse) + private static final com.google.cloud.speech.v2.ListRecognizersResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.ListRecognizersResponse(); + } + + public static com.google.cloud.speech.v2.ListRecognizersResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListRecognizersResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListRecognizersResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.ListRecognizersResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponseOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponseOrBuilder.java new file mode 100644 index 000000000000..a1760558e343 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/ListRecognizersResponseOrBuilder.java @@ -0,0 +1,108 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface ListRecognizersResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.ListRecognizersResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + java.util.List getRecognizersList(); + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + com.google.cloud.speech.v2.Recognizer getRecognizers(int index); + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + int getRecognizersCount(); + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + java.util.List + getRecognizersOrBuilderList(); + /** + * + * + *
+   * The list of requested Recognizers.
+   * 
+ * + * repeated .google.cloud.speech.v2.Recognizer recognizers = 1; + */ + com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizersOrBuilder(int index); + + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token, which can be sent as
+   * [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
+   * retrieve the next page. If this field is omitted, there are no subsequent
+   * pages. This token expires after 72 hours.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/LocationName.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/LocationName.java new file mode 100644 index 000000000000..99df4c3f8588 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/LocationName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class LocationName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static LocationName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static LocationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION.validatedMatch( + formattedString, "LocationName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (LocationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate("project", project, "location", location); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { + private String project; + private String location; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(LocationName locationName) { + this.project = locationName.project; + this.location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadata.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadata.java new file mode 100644 index 000000000000..1cf4a80bbdea --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadata.java @@ -0,0 +1,6785 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Represents the metadata of a long-running operation.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.OperationMetadata} + */ +public final class OperationMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.OperationMetadata) + OperationMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use OperationMetadata.newBuilder() to construct. + private OperationMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private OperationMetadata() { + resource_ = ""; + method_ = ""; + kmsKeyName_ = ""; + kmsKeyVersionName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new OperationMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private OperationMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + resource_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + method_ = s; + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyName_ = s; + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyVersionName_ = s; + break; + } + case 66: + { + com.google.cloud.speech.v2.BatchRecognizeRequest.Builder subBuilder = null; + if (requestCase_ == 8) { + subBuilder = + ((com.google.cloud.speech.v2.BatchRecognizeRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.BatchRecognizeRequest.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.BatchRecognizeRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 8; + break; + } + case 74: + { + com.google.cloud.speech.v2.CreateRecognizerRequest.Builder subBuilder = null; + if (requestCase_ == 9) { + subBuilder = + ((com.google.cloud.speech.v2.CreateRecognizerRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.CreateRecognizerRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.CreateRecognizerRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 9; + break; + } + case 82: + { + com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder subBuilder = null; + if (requestCase_ == 10) { + subBuilder = + ((com.google.cloud.speech.v2.UpdateRecognizerRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.UpdateRecognizerRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.UpdateRecognizerRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 10; + break; + } + case 90: + { + com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder subBuilder = null; + if (requestCase_ == 11) { + subBuilder = + ((com.google.cloud.speech.v2.DeleteRecognizerRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.DeleteRecognizerRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.DeleteRecognizerRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 11; + break; + } + case 98: + { + com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder subBuilder = null; + if (requestCase_ == 12) { + subBuilder = + ((com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.UndeleteRecognizerRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 12; + break; + } + case 106: + { + com.google.cloud.speech.v2.CreateCustomClassRequest.Builder subBuilder = null; + if (requestCase_ == 13) { + subBuilder = + ((com.google.cloud.speech.v2.CreateCustomClassRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.CreateCustomClassRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.CreateCustomClassRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 13; + break; + } + case 114: + { + com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder subBuilder = null; + if (requestCase_ == 14) { + subBuilder = + ((com.google.cloud.speech.v2.UpdateCustomClassRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.UpdateCustomClassRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 14; + break; + } + case 122: + { + com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder subBuilder = null; + if (requestCase_ == 15) { + subBuilder = + ((com.google.cloud.speech.v2.DeleteCustomClassRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.DeleteCustomClassRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 15; + break; + } + case 130: + { + com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder subBuilder = null; + if (requestCase_ == 16) { + subBuilder = + ((com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.UndeleteCustomClassRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 16; + break; + } + case 138: + { + com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder subBuilder = null; + if (requestCase_ == 17) { + subBuilder = + ((com.google.cloud.speech.v2.CreatePhraseSetRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.CreatePhraseSetRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.CreatePhraseSetRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 17; + break; + } + case 146: + { + com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder subBuilder = null; + if (requestCase_ == 18) { + subBuilder = + ((com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.UpdatePhraseSetRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 18; + break; + } + case 154: + { + com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder subBuilder = null; + if (requestCase_ == 19) { + subBuilder = + ((com.google.cloud.speech.v2.DeletePhraseSetRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.DeletePhraseSetRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.DeletePhraseSetRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 19; + break; + } + case 162: + { + com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder subBuilder = null; + if (requestCase_ == 20) { + subBuilder = + ((com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.UndeletePhraseSetRequest.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 20; + break; + } + case 170: + { + com.google.cloud.speech.v2.UpdateConfigRequest.Builder subBuilder = null; + if (requestCase_ == 21) { + subBuilder = + ((com.google.cloud.speech.v2.UpdateConfigRequest) request_).toBuilder(); + } + request_ = + input.readMessage( + com.google.cloud.speech.v2.UpdateConfigRequest.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.UpdateConfigRequest) request_); + request_ = subBuilder.buildPartial(); + } + requestCase_ = 21; + break; + } + case 176: + { + progressPercent_ = input.readInt32(); + break; + } + case 186: + { + com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder subBuilder = null; + if (metadataCase_ == 23) { + subBuilder = + ((com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_).toBuilder(); + } + metadata_ = + input.readMessage( + com.google.cloud.speech.v2.BatchRecognizeMetadata.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_); + metadata_ = subBuilder.buildPartial(); + } + metadataCase_ = 23; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_OperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_OperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.OperationMetadata.class, + com.google.cloud.speech.v2.OperationMetadata.Builder.class); + } + + private int requestCase_ = 0; + private java.lang.Object request_; + + public enum RequestCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + BATCH_RECOGNIZE_REQUEST(8), + CREATE_RECOGNIZER_REQUEST(9), + UPDATE_RECOGNIZER_REQUEST(10), + DELETE_RECOGNIZER_REQUEST(11), + UNDELETE_RECOGNIZER_REQUEST(12), + CREATE_CUSTOM_CLASS_REQUEST(13), + UPDATE_CUSTOM_CLASS_REQUEST(14), + DELETE_CUSTOM_CLASS_REQUEST(15), + UNDELETE_CUSTOM_CLASS_REQUEST(16), + CREATE_PHRASE_SET_REQUEST(17), + UPDATE_PHRASE_SET_REQUEST(18), + DELETE_PHRASE_SET_REQUEST(19), + UNDELETE_PHRASE_SET_REQUEST(20), + UPDATE_CONFIG_REQUEST(21), + REQUEST_NOT_SET(0); + private final int value; + + private RequestCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RequestCase valueOf(int value) { + return forNumber(value); + } + + public static RequestCase forNumber(int value) { + switch (value) { + case 8: + return BATCH_RECOGNIZE_REQUEST; + case 9: + return CREATE_RECOGNIZER_REQUEST; + case 10: + return UPDATE_RECOGNIZER_REQUEST; + case 11: + return DELETE_RECOGNIZER_REQUEST; + case 12: + return UNDELETE_RECOGNIZER_REQUEST; + case 13: + return CREATE_CUSTOM_CLASS_REQUEST; + case 14: + return UPDATE_CUSTOM_CLASS_REQUEST; + case 15: + return DELETE_CUSTOM_CLASS_REQUEST; + case 16: + return UNDELETE_CUSTOM_CLASS_REQUEST; + case 17: + return CREATE_PHRASE_SET_REQUEST; + case 18: + return UPDATE_PHRASE_SET_REQUEST; + case 19: + return DELETE_PHRASE_SET_REQUEST; + case 20: + return UNDELETE_PHRASE_SET_REQUEST; + case 21: + return UPDATE_CONFIG_REQUEST; + case 0: + return REQUEST_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public RequestCase getRequestCase() { + return RequestCase.forNumber(requestCase_); + } + + private int metadataCase_ = 0; + private java.lang.Object metadata_; + + public enum MetadataCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + BATCH_RECOGNIZE_METADATA(23), + METADATA_NOT_SET(0); + private final int value; + + private MetadataCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MetadataCase valueOf(int value) { + return forNumber(value); + } + + public static MetadataCase forNumber(int value) { + switch (value) { + case 23: + return BATCH_RECOGNIZE_METADATA; + case 0: + return METADATA_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public MetadataCase getMetadataCase() { + return MetadataCase.forNumber(metadataCase_); + } + + public static final int CREATE_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * The time the operation was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * The time the operation was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * The time the operation was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int RESOURCE_FIELD_NUMBER = 3; + private volatile java.lang.Object resource_; + /** + * + * + *
+   * The resource path for the target of the operation.
+   * 
+ * + * string resource = 3; + * + * @return The resource. + */ + @java.lang.Override + public java.lang.String getResource() { + java.lang.Object ref = resource_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resource_ = s; + return s; + } + } + /** + * + * + *
+   * The resource path for the target of the operation.
+   * 
+ * + * string resource = 3; + * + * @return The bytes for resource. + */ + @java.lang.Override + public com.google.protobuf.ByteString getResourceBytes() { + java.lang.Object ref = resource_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int METHOD_FIELD_NUMBER = 4; + private volatile java.lang.Object method_; + /** + * + * + *
+   * The method that triggered the operation.
+   * 
+ * + * string method = 4; + * + * @return The method. + */ + @java.lang.Override + public java.lang.String getMethod() { + java.lang.Object ref = method_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + method_ = s; + return s; + } + } + /** + * + * + *
+   * The method that triggered the operation.
+   * 
+ * + * string method = 4; + * + * @return The bytes for method. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMethodBytes() { + java.lang.Object ref = method_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + method_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KMS_KEY_NAME_FIELD_NUMBER = 6; + private volatile java.lang.Object kmsKeyName_; + /** + * + * + *
+   * The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @return The kmsKeyName. + */ + @java.lang.Override + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } + } + /** + * + * + *
+   * The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for kmsKeyName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KMS_KEY_VERSION_NAME_FIELD_NUMBER = 7; + private volatile java.lang.Object kmsKeyVersionName_; + /** + * + * + *
+   * The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @return The kmsKeyVersionName. + */ + @java.lang.Override + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } + } + /** + * + * + *
+   * The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for kmsKeyVersionName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BATCH_RECOGNIZE_REQUEST_FIELD_NUMBER = 8; + /** + * + * + *
+   * The BatchRecognizeRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + * + * @return Whether the batchRecognizeRequest field is set. + */ + @java.lang.Override + public boolean hasBatchRecognizeRequest() { + return requestCase_ == 8; + } + /** + * + * + *
+   * The BatchRecognizeRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + * + * @return The batchRecognizeRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequest getBatchRecognizeRequest() { + if (requestCase_ == 8) { + return (com.google.cloud.speech.v2.BatchRecognizeRequest) request_; + } + return com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The BatchRecognizeRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequestOrBuilder + getBatchRecognizeRequestOrBuilder() { + if (requestCase_ == 8) { + return (com.google.cloud.speech.v2.BatchRecognizeRequest) request_; + } + return com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance(); + } + + public static final int CREATE_RECOGNIZER_REQUEST_FIELD_NUMBER = 9; + /** + * + * + *
+   * The CreateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + * + * @return Whether the createRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasCreateRecognizerRequest() { + return requestCase_ == 9; + } + /** + * + * + *
+   * The CreateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + * + * @return The createRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequest getCreateRecognizerRequest() { + if (requestCase_ == 9) { + return (com.google.cloud.speech.v2.CreateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The CreateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequestOrBuilder + getCreateRecognizerRequestOrBuilder() { + if (requestCase_ == 9) { + return (com.google.cloud.speech.v2.CreateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance(); + } + + public static final int UPDATE_RECOGNIZER_REQUEST_FIELD_NUMBER = 10; + /** + * + * + *
+   * The UpdateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + * + * @return Whether the updateRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasUpdateRecognizerRequest() { + return requestCase_ == 10; + } + /** + * + * + *
+   * The UpdateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + * + * @return The updateRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequest getUpdateRecognizerRequest() { + if (requestCase_ == 10) { + return (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The UpdateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequestOrBuilder + getUpdateRecognizerRequestOrBuilder() { + if (requestCase_ == 10) { + return (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance(); + } + + public static final int DELETE_RECOGNIZER_REQUEST_FIELD_NUMBER = 11; + /** + * + * + *
+   * The DeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + * + * @return Whether the deleteRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasDeleteRecognizerRequest() { + return requestCase_ == 11; + } + /** + * + * + *
+   * The DeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + * + * @return The deleteRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequest getDeleteRecognizerRequest() { + if (requestCase_ == 11) { + return (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The DeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequestOrBuilder + getDeleteRecognizerRequestOrBuilder() { + if (requestCase_ == 11) { + return (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance(); + } + + public static final int UNDELETE_RECOGNIZER_REQUEST_FIELD_NUMBER = 12; + /** + * + * + *
+   * The UndeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + * + * @return Whether the undeleteRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasUndeleteRecognizerRequest() { + return requestCase_ == 12; + } + /** + * + * + *
+   * The UndeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + * + * @return The undeleteRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequest getUndeleteRecognizerRequest() { + if (requestCase_ == 12) { + return (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The UndeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequestOrBuilder + getUndeleteRecognizerRequestOrBuilder() { + if (requestCase_ == 12) { + return (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance(); + } + + public static final int CREATE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER = 13; + /** + * + * + *
+   * The CreateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + * @return Whether the createCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasCreateCustomClassRequest() { + return requestCase_ == 13; + } + /** + * + * + *
+   * The CreateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + * @return The createCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequest getCreateCustomClassRequest() { + if (requestCase_ == 13) { + return (com.google.cloud.speech.v2.CreateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The CreateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequestOrBuilder + getCreateCustomClassRequestOrBuilder() { + if (requestCase_ == 13) { + return (com.google.cloud.speech.v2.CreateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance(); + } + + public static final int UPDATE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER = 14; + /** + * + * + *
+   * The UpdateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + * @return Whether the updateCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasUpdateCustomClassRequest() { + return requestCase_ == 14; + } + /** + * + * + *
+   * The UpdateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + * @return The updateCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequest getUpdateCustomClassRequest() { + if (requestCase_ == 14) { + return (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The UpdateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequestOrBuilder + getUpdateCustomClassRequestOrBuilder() { + if (requestCase_ == 14) { + return (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance(); + } + + public static final int DELETE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER = 15; + /** + * + * + *
+   * The DeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + * @return Whether the deleteCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasDeleteCustomClassRequest() { + return requestCase_ == 15; + } + /** + * + * + *
+   * The DeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + * @return The deleteCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequest getDeleteCustomClassRequest() { + if (requestCase_ == 15) { + return (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The DeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequestOrBuilder + getDeleteCustomClassRequestOrBuilder() { + if (requestCase_ == 15) { + return (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance(); + } + + public static final int UNDELETE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER = 16; + /** + * + * + *
+   * The UndeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + * + * @return Whether the undeleteCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasUndeleteCustomClassRequest() { + return requestCase_ == 16; + } + /** + * + * + *
+   * The UndeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + * + * @return The undeleteCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequest getUndeleteCustomClassRequest() { + if (requestCase_ == 16) { + return (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The UndeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequestOrBuilder + getUndeleteCustomClassRequestOrBuilder() { + if (requestCase_ == 16) { + return (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance(); + } + + public static final int CREATE_PHRASE_SET_REQUEST_FIELD_NUMBER = 17; + /** + * + * + *
+   * The CreatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + * + * @return Whether the createPhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasCreatePhraseSetRequest() { + return requestCase_ == 17; + } + /** + * + * + *
+   * The CreatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + * + * @return The createPhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequest getCreatePhraseSetRequest() { + if (requestCase_ == 17) { + return (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The CreatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequestOrBuilder + getCreatePhraseSetRequestOrBuilder() { + if (requestCase_ == 17) { + return (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance(); + } + + public static final int UPDATE_PHRASE_SET_REQUEST_FIELD_NUMBER = 18; + /** + * + * + *
+   * The UpdatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + * + * @return Whether the updatePhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasUpdatePhraseSetRequest() { + return requestCase_ == 18; + } + /** + * + * + *
+   * The UpdatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + * + * @return The updatePhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequest getUpdatePhraseSetRequest() { + if (requestCase_ == 18) { + return (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The UpdatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequestOrBuilder + getUpdatePhraseSetRequestOrBuilder() { + if (requestCase_ == 18) { + return (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance(); + } + + public static final int DELETE_PHRASE_SET_REQUEST_FIELD_NUMBER = 19; + /** + * + * + *
+   * The DeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + * + * @return Whether the deletePhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasDeletePhraseSetRequest() { + return requestCase_ == 19; + } + /** + * + * + *
+   * The DeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + * + * @return The deletePhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequest getDeletePhraseSetRequest() { + if (requestCase_ == 19) { + return (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The DeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequestOrBuilder + getDeletePhraseSetRequestOrBuilder() { + if (requestCase_ == 19) { + return (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance(); + } + + public static final int UNDELETE_PHRASE_SET_REQUEST_FIELD_NUMBER = 20; + /** + * + * + *
+   * The UndeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + * @return Whether the undeletePhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasUndeletePhraseSetRequest() { + return requestCase_ == 20; + } + /** + * + * + *
+   * The UndeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + * @return The undeletePhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequest getUndeletePhraseSetRequest() { + if (requestCase_ == 20) { + return (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The UndeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequestOrBuilder + getUndeletePhraseSetRequestOrBuilder() { + if (requestCase_ == 20) { + return (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance(); + } + + public static final int UPDATE_CONFIG_REQUEST_FIELD_NUMBER = 21; + /** + * + * + *
+   * The UpdateConfigRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + * + * @return Whether the updateConfigRequest field is set. + */ + @java.lang.Override + public boolean hasUpdateConfigRequest() { + return requestCase_ == 21; + } + /** + * + * + *
+   * The UpdateConfigRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + * + * @return The updateConfigRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequest getUpdateConfigRequest() { + if (requestCase_ == 21) { + return (com.google.cloud.speech.v2.UpdateConfigRequest) request_; + } + return com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance(); + } + /** + * + * + *
+   * The UpdateConfigRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequestOrBuilder getUpdateConfigRequestOrBuilder() { + if (requestCase_ == 21) { + return (com.google.cloud.speech.v2.UpdateConfigRequest) request_; + } + return com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance(); + } + + public static final int PROGRESS_PERCENT_FIELD_NUMBER = 22; + private int progressPercent_; + /** + * + * + *
+   * The percent progress of the Operation. Values can range from 0-100. If the
+   * value is 100, then the operation is finished.
+   * 
+ * + * int32 progress_percent = 22; + * + * @return The progressPercent. + */ + @java.lang.Override + public int getProgressPercent() { + return progressPercent_; + } + + public static final int BATCH_RECOGNIZE_METADATA_FIELD_NUMBER = 23; + /** + * + * + *
+   * Metadata specific to the BatchRecognize method.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + * + * @return Whether the batchRecognizeMetadata field is set. + */ + @java.lang.Override + public boolean hasBatchRecognizeMetadata() { + return metadataCase_ == 23; + } + /** + * + * + *
+   * Metadata specific to the BatchRecognize method.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + * + * @return The batchRecognizeMetadata. + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadata getBatchRecognizeMetadata() { + if (metadataCase_ == 23) { + return (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_; + } + return com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance(); + } + /** + * + * + *
+   * Metadata specific to the BatchRecognize method.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadataOrBuilder + getBatchRecognizeMetadataOrBuilder() { + if (metadataCase_ == 23) { + return (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_; + } + return com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (createTime_ != null) { + output.writeMessage(1, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(2, getUpdateTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resource_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, resource_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(method_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, method_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, kmsKeyVersionName_); + } + if (requestCase_ == 8) { + output.writeMessage(8, (com.google.cloud.speech.v2.BatchRecognizeRequest) request_); + } + if (requestCase_ == 9) { + output.writeMessage(9, (com.google.cloud.speech.v2.CreateRecognizerRequest) request_); + } + if (requestCase_ == 10) { + output.writeMessage(10, (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_); + } + if (requestCase_ == 11) { + output.writeMessage(11, (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_); + } + if (requestCase_ == 12) { + output.writeMessage(12, (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_); + } + if (requestCase_ == 13) { + output.writeMessage(13, (com.google.cloud.speech.v2.CreateCustomClassRequest) request_); + } + if (requestCase_ == 14) { + output.writeMessage(14, (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_); + } + if (requestCase_ == 15) { + output.writeMessage(15, (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_); + } + if (requestCase_ == 16) { + output.writeMessage(16, (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_); + } + if (requestCase_ == 17) { + output.writeMessage(17, (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_); + } + if (requestCase_ == 18) { + output.writeMessage(18, (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_); + } + if (requestCase_ == 19) { + output.writeMessage(19, (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_); + } + if (requestCase_ == 20) { + output.writeMessage(20, (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_); + } + if (requestCase_ == 21) { + output.writeMessage(21, (com.google.cloud.speech.v2.UpdateConfigRequest) request_); + } + if (progressPercent_ != 0) { + output.writeInt32(22, progressPercent_); + } + if (metadataCase_ == 23) { + output.writeMessage(23, (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resource_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, resource_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(method_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, method_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, kmsKeyVersionName_); + } + if (requestCase_ == 8) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 8, (com.google.cloud.speech.v2.BatchRecognizeRequest) request_); + } + if (requestCase_ == 9) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 9, (com.google.cloud.speech.v2.CreateRecognizerRequest) request_); + } + if (requestCase_ == 10) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 10, (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_); + } + if (requestCase_ == 11) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 11, (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_); + } + if (requestCase_ == 12) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 12, (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_); + } + if (requestCase_ == 13) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 13, (com.google.cloud.speech.v2.CreateCustomClassRequest) request_); + } + if (requestCase_ == 14) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 14, (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_); + } + if (requestCase_ == 15) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 15, (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_); + } + if (requestCase_ == 16) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 16, (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_); + } + if (requestCase_ == 17) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 17, (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_); + } + if (requestCase_ == 18) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 18, (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_); + } + if (requestCase_ == 19) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 19, (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_); + } + if (requestCase_ == 20) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 20, (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_); + } + if (requestCase_ == 21) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 21, (com.google.cloud.speech.v2.UpdateConfigRequest) request_); + } + if (progressPercent_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(22, progressPercent_); + } + if (metadataCase_ == 23) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 23, (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.OperationMetadata)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.OperationMetadata other = + (com.google.cloud.speech.v2.OperationMetadata) obj; + + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getResource().equals(other.getResource())) return false; + if (!getMethod().equals(other.getMethod())) return false; + if (!getKmsKeyName().equals(other.getKmsKeyName())) return false; + if (!getKmsKeyVersionName().equals(other.getKmsKeyVersionName())) return false; + if (getProgressPercent() != other.getProgressPercent()) return false; + if (!getRequestCase().equals(other.getRequestCase())) return false; + switch (requestCase_) { + case 8: + if (!getBatchRecognizeRequest().equals(other.getBatchRecognizeRequest())) return false; + break; + case 9: + if (!getCreateRecognizerRequest().equals(other.getCreateRecognizerRequest())) return false; + break; + case 10: + if (!getUpdateRecognizerRequest().equals(other.getUpdateRecognizerRequest())) return false; + break; + case 11: + if (!getDeleteRecognizerRequest().equals(other.getDeleteRecognizerRequest())) return false; + break; + case 12: + if (!getUndeleteRecognizerRequest().equals(other.getUndeleteRecognizerRequest())) + return false; + break; + case 13: + if (!getCreateCustomClassRequest().equals(other.getCreateCustomClassRequest())) + return false; + break; + case 14: + if (!getUpdateCustomClassRequest().equals(other.getUpdateCustomClassRequest())) + return false; + break; + case 15: + if (!getDeleteCustomClassRequest().equals(other.getDeleteCustomClassRequest())) + return false; + break; + case 16: + if (!getUndeleteCustomClassRequest().equals(other.getUndeleteCustomClassRequest())) + return false; + break; + case 17: + if (!getCreatePhraseSetRequest().equals(other.getCreatePhraseSetRequest())) return false; + break; + case 18: + if (!getUpdatePhraseSetRequest().equals(other.getUpdatePhraseSetRequest())) return false; + break; + case 19: + if (!getDeletePhraseSetRequest().equals(other.getDeletePhraseSetRequest())) return false; + break; + case 20: + if (!getUndeletePhraseSetRequest().equals(other.getUndeletePhraseSetRequest())) + return false; + break; + case 21: + if (!getUpdateConfigRequest().equals(other.getUpdateConfigRequest())) return false; + break; + case 0: + default: + } + if (!getMetadataCase().equals(other.getMetadataCase())) return false; + switch (metadataCase_) { + case 23: + if (!getBatchRecognizeMetadata().equals(other.getBatchRecognizeMetadata())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + hash = (37 * hash) + RESOURCE_FIELD_NUMBER; + hash = (53 * hash) + getResource().hashCode(); + hash = (37 * hash) + METHOD_FIELD_NUMBER; + hash = (53 * hash) + getMethod().hashCode(); + hash = (37 * hash) + KMS_KEY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyName().hashCode(); + hash = (37 * hash) + KMS_KEY_VERSION_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyVersionName().hashCode(); + hash = (37 * hash) + PROGRESS_PERCENT_FIELD_NUMBER; + hash = (53 * hash) + getProgressPercent(); + switch (requestCase_) { + case 8: + hash = (37 * hash) + BATCH_RECOGNIZE_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getBatchRecognizeRequest().hashCode(); + break; + case 9: + hash = (37 * hash) + CREATE_RECOGNIZER_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getCreateRecognizerRequest().hashCode(); + break; + case 10: + hash = (37 * hash) + UPDATE_RECOGNIZER_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getUpdateRecognizerRequest().hashCode(); + break; + case 11: + hash = (37 * hash) + DELETE_RECOGNIZER_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getDeleteRecognizerRequest().hashCode(); + break; + case 12: + hash = (37 * hash) + UNDELETE_RECOGNIZER_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getUndeleteRecognizerRequest().hashCode(); + break; + case 13: + hash = (37 * hash) + CREATE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getCreateCustomClassRequest().hashCode(); + break; + case 14: + hash = (37 * hash) + UPDATE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getUpdateCustomClassRequest().hashCode(); + break; + case 15: + hash = (37 * hash) + DELETE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getDeleteCustomClassRequest().hashCode(); + break; + case 16: + hash = (37 * hash) + UNDELETE_CUSTOM_CLASS_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getUndeleteCustomClassRequest().hashCode(); + break; + case 17: + hash = (37 * hash) + CREATE_PHRASE_SET_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getCreatePhraseSetRequest().hashCode(); + break; + case 18: + hash = (37 * hash) + UPDATE_PHRASE_SET_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getUpdatePhraseSetRequest().hashCode(); + break; + case 19: + hash = (37 * hash) + DELETE_PHRASE_SET_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getDeletePhraseSetRequest().hashCode(); + break; + case 20: + hash = (37 * hash) + UNDELETE_PHRASE_SET_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getUndeletePhraseSetRequest().hashCode(); + break; + case 21: + hash = (37 * hash) + UPDATE_CONFIG_REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getUpdateConfigRequest().hashCode(); + break; + case 0: + default: + } + switch (metadataCase_) { + case 23: + hash = (37 * hash) + BATCH_RECOGNIZE_METADATA_FIELD_NUMBER; + hash = (53 * hash) + getBatchRecognizeMetadata().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.OperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.OperationMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents the metadata of a long-running operation.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.OperationMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.OperationMetadata) + com.google.cloud.speech.v2.OperationMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_OperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_OperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.OperationMetadata.class, + com.google.cloud.speech.v2.OperationMetadata.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.OperationMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + resource_ = ""; + + method_ = ""; + + kmsKeyName_ = ""; + + kmsKeyVersionName_ = ""; + + progressPercent_ = 0; + + requestCase_ = 0; + request_ = null; + metadataCase_ = 0; + metadata_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_OperationMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.OperationMetadata getDefaultInstanceForType() { + return com.google.cloud.speech.v2.OperationMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.OperationMetadata build() { + com.google.cloud.speech.v2.OperationMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.OperationMetadata buildPartial() { + com.google.cloud.speech.v2.OperationMetadata result = + new com.google.cloud.speech.v2.OperationMetadata(this); + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + result.resource_ = resource_; + result.method_ = method_; + result.kmsKeyName_ = kmsKeyName_; + result.kmsKeyVersionName_ = kmsKeyVersionName_; + if (requestCase_ == 8) { + if (batchRecognizeRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = batchRecognizeRequestBuilder_.build(); + } + } + if (requestCase_ == 9) { + if (createRecognizerRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = createRecognizerRequestBuilder_.build(); + } + } + if (requestCase_ == 10) { + if (updateRecognizerRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = updateRecognizerRequestBuilder_.build(); + } + } + if (requestCase_ == 11) { + if (deleteRecognizerRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = deleteRecognizerRequestBuilder_.build(); + } + } + if (requestCase_ == 12) { + if (undeleteRecognizerRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = undeleteRecognizerRequestBuilder_.build(); + } + } + if (requestCase_ == 13) { + if (createCustomClassRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = createCustomClassRequestBuilder_.build(); + } + } + if (requestCase_ == 14) { + if (updateCustomClassRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = updateCustomClassRequestBuilder_.build(); + } + } + if (requestCase_ == 15) { + if (deleteCustomClassRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = deleteCustomClassRequestBuilder_.build(); + } + } + if (requestCase_ == 16) { + if (undeleteCustomClassRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = undeleteCustomClassRequestBuilder_.build(); + } + } + if (requestCase_ == 17) { + if (createPhraseSetRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = createPhraseSetRequestBuilder_.build(); + } + } + if (requestCase_ == 18) { + if (updatePhraseSetRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = updatePhraseSetRequestBuilder_.build(); + } + } + if (requestCase_ == 19) { + if (deletePhraseSetRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = deletePhraseSetRequestBuilder_.build(); + } + } + if (requestCase_ == 20) { + if (undeletePhraseSetRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = undeletePhraseSetRequestBuilder_.build(); + } + } + if (requestCase_ == 21) { + if (updateConfigRequestBuilder_ == null) { + result.request_ = request_; + } else { + result.request_ = updateConfigRequestBuilder_.build(); + } + } + result.progressPercent_ = progressPercent_; + if (metadataCase_ == 23) { + if (batchRecognizeMetadataBuilder_ == null) { + result.metadata_ = metadata_; + } else { + result.metadata_ = batchRecognizeMetadataBuilder_.build(); + } + } + result.requestCase_ = requestCase_; + result.metadataCase_ = metadataCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.OperationMetadata) { + return mergeFrom((com.google.cloud.speech.v2.OperationMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.OperationMetadata other) { + if (other == com.google.cloud.speech.v2.OperationMetadata.getDefaultInstance()) return this; + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (!other.getResource().isEmpty()) { + resource_ = other.resource_; + onChanged(); + } + if (!other.getMethod().isEmpty()) { + method_ = other.method_; + onChanged(); + } + if (!other.getKmsKeyName().isEmpty()) { + kmsKeyName_ = other.kmsKeyName_; + onChanged(); + } + if (!other.getKmsKeyVersionName().isEmpty()) { + kmsKeyVersionName_ = other.kmsKeyVersionName_; + onChanged(); + } + if (other.getProgressPercent() != 0) { + setProgressPercent(other.getProgressPercent()); + } + switch (other.getRequestCase()) { + case BATCH_RECOGNIZE_REQUEST: + { + mergeBatchRecognizeRequest(other.getBatchRecognizeRequest()); + break; + } + case CREATE_RECOGNIZER_REQUEST: + { + mergeCreateRecognizerRequest(other.getCreateRecognizerRequest()); + break; + } + case UPDATE_RECOGNIZER_REQUEST: + { + mergeUpdateRecognizerRequest(other.getUpdateRecognizerRequest()); + break; + } + case DELETE_RECOGNIZER_REQUEST: + { + mergeDeleteRecognizerRequest(other.getDeleteRecognizerRequest()); + break; + } + case UNDELETE_RECOGNIZER_REQUEST: + { + mergeUndeleteRecognizerRequest(other.getUndeleteRecognizerRequest()); + break; + } + case CREATE_CUSTOM_CLASS_REQUEST: + { + mergeCreateCustomClassRequest(other.getCreateCustomClassRequest()); + break; + } + case UPDATE_CUSTOM_CLASS_REQUEST: + { + mergeUpdateCustomClassRequest(other.getUpdateCustomClassRequest()); + break; + } + case DELETE_CUSTOM_CLASS_REQUEST: + { + mergeDeleteCustomClassRequest(other.getDeleteCustomClassRequest()); + break; + } + case UNDELETE_CUSTOM_CLASS_REQUEST: + { + mergeUndeleteCustomClassRequest(other.getUndeleteCustomClassRequest()); + break; + } + case CREATE_PHRASE_SET_REQUEST: + { + mergeCreatePhraseSetRequest(other.getCreatePhraseSetRequest()); + break; + } + case UPDATE_PHRASE_SET_REQUEST: + { + mergeUpdatePhraseSetRequest(other.getUpdatePhraseSetRequest()); + break; + } + case DELETE_PHRASE_SET_REQUEST: + { + mergeDeletePhraseSetRequest(other.getDeletePhraseSetRequest()); + break; + } + case UNDELETE_PHRASE_SET_REQUEST: + { + mergeUndeletePhraseSetRequest(other.getUndeletePhraseSetRequest()); + break; + } + case UPDATE_CONFIG_REQUEST: + { + mergeUpdateConfigRequest(other.getUpdateConfigRequest()); + break; + } + case REQUEST_NOT_SET: + { + break; + } + } + switch (other.getMetadataCase()) { + case BATCH_RECOGNIZE_METADATA: + { + mergeBatchRecognizeMetadata(other.getBatchRecognizeMetadata()); + break; + } + case METADATA_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.OperationMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.OperationMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int requestCase_ = 0; + private java.lang.Object request_; + + public RequestCase getRequestCase() { + return RequestCase.forNumber(requestCase_); + } + + public Builder clearRequest() { + requestCase_ = 0; + request_ = null; + onChanged(); + return this; + } + + private int metadataCase_ = 0; + private java.lang.Object metadata_; + + public MetadataCase getMetadataCase() { + return MetadataCase.forNumber(metadataCase_); + } + + public Builder clearMetadata() { + metadataCase_ = 0; + metadata_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * The time the operation was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * The time the operation was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private java.lang.Object resource_ = ""; + /** + * + * + *
+     * The resource path for the target of the operation.
+     * 
+ * + * string resource = 3; + * + * @return The resource. + */ + public java.lang.String getResource() { + java.lang.Object ref = resource_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resource_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource path for the target of the operation.
+     * 
+ * + * string resource = 3; + * + * @return The bytes for resource. + */ + public com.google.protobuf.ByteString getResourceBytes() { + java.lang.Object ref = resource_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource path for the target of the operation.
+     * 
+ * + * string resource = 3; + * + * @param value The resource to set. + * @return This builder for chaining. + */ + public Builder setResource(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + resource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource path for the target of the operation.
+     * 
+ * + * string resource = 3; + * + * @return This builder for chaining. + */ + public Builder clearResource() { + + resource_ = getDefaultInstance().getResource(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource path for the target of the operation.
+     * 
+ * + * string resource = 3; + * + * @param value The bytes for resource to set. + * @return This builder for chaining. + */ + public Builder setResourceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + resource_ = value; + onChanged(); + return this; + } + + private java.lang.Object method_ = ""; + /** + * + * + *
+     * The method that triggered the operation.
+     * 
+ * + * string method = 4; + * + * @return The method. + */ + public java.lang.String getMethod() { + java.lang.Object ref = method_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + method_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The method that triggered the operation.
+     * 
+ * + * string method = 4; + * + * @return The bytes for method. + */ + public com.google.protobuf.ByteString getMethodBytes() { + java.lang.Object ref = method_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + method_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The method that triggered the operation.
+     * 
+ * + * string method = 4; + * + * @param value The method to set. + * @return This builder for chaining. + */ + public Builder setMethod(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + method_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The method that triggered the operation.
+     * 
+ * + * string method = 4; + * + * @return This builder for chaining. + */ + public Builder clearMethod() { + + method_ = getDefaultInstance().getMethod(); + onChanged(); + return this; + } + /** + * + * + *
+     * The method that triggered the operation.
+     * 
+ * + * string method = 4; + * + * @param value The bytes for method to set. + * @return This builder for chaining. + */ + public Builder setMethodBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + method_ = value; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyName_ = ""; + /** + * + * + *
+     * The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @return The kmsKeyName. + */ + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for kmsKeyName. + */ + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @param value The kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyName() { + + kmsKeyName_ = getDefaultInstance().getKmsKeyName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @param value The bytes for kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyName_ = value; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyVersionName_ = ""; + /** + * + * + *
+     * The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @return The kmsKeyVersionName. + */ + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for kmsKeyVersionName. + */ + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @param value The kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyVersionName() { + + kmsKeyVersionName_ = getDefaultInstance().getKmsKeyVersionName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which content of the Operation is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @param value The bytes for kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeRequest, + com.google.cloud.speech.v2.BatchRecognizeRequest.Builder, + com.google.cloud.speech.v2.BatchRecognizeRequestOrBuilder> + batchRecognizeRequestBuilder_; + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + * + * @return Whether the batchRecognizeRequest field is set. + */ + @java.lang.Override + public boolean hasBatchRecognizeRequest() { + return requestCase_ == 8; + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + * + * @return The batchRecognizeRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequest getBatchRecognizeRequest() { + if (batchRecognizeRequestBuilder_ == null) { + if (requestCase_ == 8) { + return (com.google.cloud.speech.v2.BatchRecognizeRequest) request_; + } + return com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance(); + } else { + if (requestCase_ == 8) { + return batchRecognizeRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + public Builder setBatchRecognizeRequest( + com.google.cloud.speech.v2.BatchRecognizeRequest value) { + if (batchRecognizeRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + batchRecognizeRequestBuilder_.setMessage(value); + } + requestCase_ = 8; + return this; + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + public Builder setBatchRecognizeRequest( + com.google.cloud.speech.v2.BatchRecognizeRequest.Builder builderForValue) { + if (batchRecognizeRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + batchRecognizeRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 8; + return this; + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + public Builder mergeBatchRecognizeRequest( + com.google.cloud.speech.v2.BatchRecognizeRequest value) { + if (batchRecognizeRequestBuilder_ == null) { + if (requestCase_ == 8 + && request_ != com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.BatchRecognizeRequest.newBuilder( + (com.google.cloud.speech.v2.BatchRecognizeRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 8) { + batchRecognizeRequestBuilder_.mergeFrom(value); + } else { + batchRecognizeRequestBuilder_.setMessage(value); + } + } + requestCase_ = 8; + return this; + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + public Builder clearBatchRecognizeRequest() { + if (batchRecognizeRequestBuilder_ == null) { + if (requestCase_ == 8) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 8) { + requestCase_ = 0; + request_ = null; + } + batchRecognizeRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + public com.google.cloud.speech.v2.BatchRecognizeRequest.Builder + getBatchRecognizeRequestBuilder() { + return getBatchRecognizeRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeRequestOrBuilder + getBatchRecognizeRequestOrBuilder() { + if ((requestCase_ == 8) && (batchRecognizeRequestBuilder_ != null)) { + return batchRecognizeRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 8) { + return (com.google.cloud.speech.v2.BatchRecognizeRequest) request_; + } + return com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The BatchRecognizeRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeRequest, + com.google.cloud.speech.v2.BatchRecognizeRequest.Builder, + com.google.cloud.speech.v2.BatchRecognizeRequestOrBuilder> + getBatchRecognizeRequestFieldBuilder() { + if (batchRecognizeRequestBuilder_ == null) { + if (!(requestCase_ == 8)) { + request_ = com.google.cloud.speech.v2.BatchRecognizeRequest.getDefaultInstance(); + } + batchRecognizeRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeRequest, + com.google.cloud.speech.v2.BatchRecognizeRequest.Builder, + com.google.cloud.speech.v2.BatchRecognizeRequestOrBuilder>( + (com.google.cloud.speech.v2.BatchRecognizeRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 8; + onChanged(); + ; + return batchRecognizeRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreateRecognizerRequest, + com.google.cloud.speech.v2.CreateRecognizerRequest.Builder, + com.google.cloud.speech.v2.CreateRecognizerRequestOrBuilder> + createRecognizerRequestBuilder_; + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + * + * @return Whether the createRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasCreateRecognizerRequest() { + return requestCase_ == 9; + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + * + * @return The createRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequest getCreateRecognizerRequest() { + if (createRecognizerRequestBuilder_ == null) { + if (requestCase_ == 9) { + return (com.google.cloud.speech.v2.CreateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance(); + } else { + if (requestCase_ == 9) { + return createRecognizerRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + public Builder setCreateRecognizerRequest( + com.google.cloud.speech.v2.CreateRecognizerRequest value) { + if (createRecognizerRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + createRecognizerRequestBuilder_.setMessage(value); + } + requestCase_ = 9; + return this; + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + public Builder setCreateRecognizerRequest( + com.google.cloud.speech.v2.CreateRecognizerRequest.Builder builderForValue) { + if (createRecognizerRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + createRecognizerRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 9; + return this; + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + public Builder mergeCreateRecognizerRequest( + com.google.cloud.speech.v2.CreateRecognizerRequest value) { + if (createRecognizerRequestBuilder_ == null) { + if (requestCase_ == 9 + && request_ + != com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.CreateRecognizerRequest.newBuilder( + (com.google.cloud.speech.v2.CreateRecognizerRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 9) { + createRecognizerRequestBuilder_.mergeFrom(value); + } else { + createRecognizerRequestBuilder_.setMessage(value); + } + } + requestCase_ = 9; + return this; + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + public Builder clearCreateRecognizerRequest() { + if (createRecognizerRequestBuilder_ == null) { + if (requestCase_ == 9) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 9) { + requestCase_ = 0; + request_ = null; + } + createRecognizerRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + public com.google.cloud.speech.v2.CreateRecognizerRequest.Builder + getCreateRecognizerRequestBuilder() { + return getCreateRecognizerRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateRecognizerRequestOrBuilder + getCreateRecognizerRequestOrBuilder() { + if ((requestCase_ == 9) && (createRecognizerRequestBuilder_ != null)) { + return createRecognizerRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 9) { + return (com.google.cloud.speech.v2.CreateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The CreateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreateRecognizerRequest, + com.google.cloud.speech.v2.CreateRecognizerRequest.Builder, + com.google.cloud.speech.v2.CreateRecognizerRequestOrBuilder> + getCreateRecognizerRequestFieldBuilder() { + if (createRecognizerRequestBuilder_ == null) { + if (!(requestCase_ == 9)) { + request_ = com.google.cloud.speech.v2.CreateRecognizerRequest.getDefaultInstance(); + } + createRecognizerRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreateRecognizerRequest, + com.google.cloud.speech.v2.CreateRecognizerRequest.Builder, + com.google.cloud.speech.v2.CreateRecognizerRequestOrBuilder>( + (com.google.cloud.speech.v2.CreateRecognizerRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 9; + onChanged(); + ; + return createRecognizerRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateRecognizerRequest, + com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder, + com.google.cloud.speech.v2.UpdateRecognizerRequestOrBuilder> + updateRecognizerRequestBuilder_; + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + * + * @return Whether the updateRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasUpdateRecognizerRequest() { + return requestCase_ == 10; + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + * + * @return The updateRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequest getUpdateRecognizerRequest() { + if (updateRecognizerRequestBuilder_ == null) { + if (requestCase_ == 10) { + return (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance(); + } else { + if (requestCase_ == 10) { + return updateRecognizerRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + public Builder setUpdateRecognizerRequest( + com.google.cloud.speech.v2.UpdateRecognizerRequest value) { + if (updateRecognizerRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + updateRecognizerRequestBuilder_.setMessage(value); + } + requestCase_ = 10; + return this; + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + public Builder setUpdateRecognizerRequest( + com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder builderForValue) { + if (updateRecognizerRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + updateRecognizerRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 10; + return this; + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + public Builder mergeUpdateRecognizerRequest( + com.google.cloud.speech.v2.UpdateRecognizerRequest value) { + if (updateRecognizerRequestBuilder_ == null) { + if (requestCase_ == 10 + && request_ + != com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.UpdateRecognizerRequest.newBuilder( + (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 10) { + updateRecognizerRequestBuilder_.mergeFrom(value); + } else { + updateRecognizerRequestBuilder_.setMessage(value); + } + } + requestCase_ = 10; + return this; + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + public Builder clearUpdateRecognizerRequest() { + if (updateRecognizerRequestBuilder_ == null) { + if (requestCase_ == 10) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 10) { + requestCase_ = 0; + request_ = null; + } + updateRecognizerRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + public com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder + getUpdateRecognizerRequestBuilder() { + return getUpdateRecognizerRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequestOrBuilder + getUpdateRecognizerRequestOrBuilder() { + if ((requestCase_ == 10) && (updateRecognizerRequestBuilder_ != null)) { + return updateRecognizerRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 10) { + return (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdateRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateRecognizerRequest, + com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder, + com.google.cloud.speech.v2.UpdateRecognizerRequestOrBuilder> + getUpdateRecognizerRequestFieldBuilder() { + if (updateRecognizerRequestBuilder_ == null) { + if (!(requestCase_ == 10)) { + request_ = com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance(); + } + updateRecognizerRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateRecognizerRequest, + com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder, + com.google.cloud.speech.v2.UpdateRecognizerRequestOrBuilder>( + (com.google.cloud.speech.v2.UpdateRecognizerRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 10; + onChanged(); + ; + return updateRecognizerRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeleteRecognizerRequest, + com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder, + com.google.cloud.speech.v2.DeleteRecognizerRequestOrBuilder> + deleteRecognizerRequestBuilder_; + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + * + * @return Whether the deleteRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasDeleteRecognizerRequest() { + return requestCase_ == 11; + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + * + * @return The deleteRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequest getDeleteRecognizerRequest() { + if (deleteRecognizerRequestBuilder_ == null) { + if (requestCase_ == 11) { + return (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance(); + } else { + if (requestCase_ == 11) { + return deleteRecognizerRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + public Builder setDeleteRecognizerRequest( + com.google.cloud.speech.v2.DeleteRecognizerRequest value) { + if (deleteRecognizerRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + deleteRecognizerRequestBuilder_.setMessage(value); + } + requestCase_ = 11; + return this; + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + public Builder setDeleteRecognizerRequest( + com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder builderForValue) { + if (deleteRecognizerRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + deleteRecognizerRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 11; + return this; + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + public Builder mergeDeleteRecognizerRequest( + com.google.cloud.speech.v2.DeleteRecognizerRequest value) { + if (deleteRecognizerRequestBuilder_ == null) { + if (requestCase_ == 11 + && request_ + != com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.DeleteRecognizerRequest.newBuilder( + (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 11) { + deleteRecognizerRequestBuilder_.mergeFrom(value); + } else { + deleteRecognizerRequestBuilder_.setMessage(value); + } + } + requestCase_ = 11; + return this; + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + public Builder clearDeleteRecognizerRequest() { + if (deleteRecognizerRequestBuilder_ == null) { + if (requestCase_ == 11) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 11) { + requestCase_ = 0; + request_ = null; + } + deleteRecognizerRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + public com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder + getDeleteRecognizerRequestBuilder() { + return getDeleteRecognizerRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteRecognizerRequestOrBuilder + getDeleteRecognizerRequestOrBuilder() { + if ((requestCase_ == 11) && (deleteRecognizerRequestBuilder_ != null)) { + return deleteRecognizerRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 11) { + return (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The DeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeleteRecognizerRequest, + com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder, + com.google.cloud.speech.v2.DeleteRecognizerRequestOrBuilder> + getDeleteRecognizerRequestFieldBuilder() { + if (deleteRecognizerRequestBuilder_ == null) { + if (!(requestCase_ == 11)) { + request_ = com.google.cloud.speech.v2.DeleteRecognizerRequest.getDefaultInstance(); + } + deleteRecognizerRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeleteRecognizerRequest, + com.google.cloud.speech.v2.DeleteRecognizerRequest.Builder, + com.google.cloud.speech.v2.DeleteRecognizerRequestOrBuilder>( + (com.google.cloud.speech.v2.DeleteRecognizerRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 11; + onChanged(); + ; + return deleteRecognizerRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeleteRecognizerRequest, + com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder, + com.google.cloud.speech.v2.UndeleteRecognizerRequestOrBuilder> + undeleteRecognizerRequestBuilder_; + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + * + * @return Whether the undeleteRecognizerRequest field is set. + */ + @java.lang.Override + public boolean hasUndeleteRecognizerRequest() { + return requestCase_ == 12; + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + * + * @return The undeleteRecognizerRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequest getUndeleteRecognizerRequest() { + if (undeleteRecognizerRequestBuilder_ == null) { + if (requestCase_ == 12) { + return (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance(); + } else { + if (requestCase_ == 12) { + return undeleteRecognizerRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + public Builder setUndeleteRecognizerRequest( + com.google.cloud.speech.v2.UndeleteRecognizerRequest value) { + if (undeleteRecognizerRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + undeleteRecognizerRequestBuilder_.setMessage(value); + } + requestCase_ = 12; + return this; + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + public Builder setUndeleteRecognizerRequest( + com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder builderForValue) { + if (undeleteRecognizerRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + undeleteRecognizerRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 12; + return this; + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + public Builder mergeUndeleteRecognizerRequest( + com.google.cloud.speech.v2.UndeleteRecognizerRequest value) { + if (undeleteRecognizerRequestBuilder_ == null) { + if (requestCase_ == 12 + && request_ + != com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.UndeleteRecognizerRequest.newBuilder( + (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 12) { + undeleteRecognizerRequestBuilder_.mergeFrom(value); + } else { + undeleteRecognizerRequestBuilder_.setMessage(value); + } + } + requestCase_ = 12; + return this; + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + public Builder clearUndeleteRecognizerRequest() { + if (undeleteRecognizerRequestBuilder_ == null) { + if (requestCase_ == 12) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 12) { + requestCase_ = 0; + request_ = null; + } + undeleteRecognizerRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + public com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder + getUndeleteRecognizerRequestBuilder() { + return getUndeleteRecognizerRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequestOrBuilder + getUndeleteRecognizerRequestOrBuilder() { + if ((requestCase_ == 12) && (undeleteRecognizerRequestBuilder_ != null)) { + return undeleteRecognizerRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 12) { + return (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UndeleteRecognizerRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeleteRecognizerRequest, + com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder, + com.google.cloud.speech.v2.UndeleteRecognizerRequestOrBuilder> + getUndeleteRecognizerRequestFieldBuilder() { + if (undeleteRecognizerRequestBuilder_ == null) { + if (!(requestCase_ == 12)) { + request_ = com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance(); + } + undeleteRecognizerRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeleteRecognizerRequest, + com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder, + com.google.cloud.speech.v2.UndeleteRecognizerRequestOrBuilder>( + (com.google.cloud.speech.v2.UndeleteRecognizerRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 12; + onChanged(); + ; + return undeleteRecognizerRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreateCustomClassRequest, + com.google.cloud.speech.v2.CreateCustomClassRequest.Builder, + com.google.cloud.speech.v2.CreateCustomClassRequestOrBuilder> + createCustomClassRequestBuilder_; + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + * + * @return Whether the createCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasCreateCustomClassRequest() { + return requestCase_ == 13; + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + * + * @return The createCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequest getCreateCustomClassRequest() { + if (createCustomClassRequestBuilder_ == null) { + if (requestCase_ == 13) { + return (com.google.cloud.speech.v2.CreateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance(); + } else { + if (requestCase_ == 13) { + return createCustomClassRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + */ + public Builder setCreateCustomClassRequest( + com.google.cloud.speech.v2.CreateCustomClassRequest value) { + if (createCustomClassRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + createCustomClassRequestBuilder_.setMessage(value); + } + requestCase_ = 13; + return this; + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + */ + public Builder setCreateCustomClassRequest( + com.google.cloud.speech.v2.CreateCustomClassRequest.Builder builderForValue) { + if (createCustomClassRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + createCustomClassRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 13; + return this; + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + */ + public Builder mergeCreateCustomClassRequest( + com.google.cloud.speech.v2.CreateCustomClassRequest value) { + if (createCustomClassRequestBuilder_ == null) { + if (requestCase_ == 13 + && request_ + != com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.CreateCustomClassRequest.newBuilder( + (com.google.cloud.speech.v2.CreateCustomClassRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 13) { + createCustomClassRequestBuilder_.mergeFrom(value); + } else { + createCustomClassRequestBuilder_.setMessage(value); + } + } + requestCase_ = 13; + return this; + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + */ + public Builder clearCreateCustomClassRequest() { + if (createCustomClassRequestBuilder_ == null) { + if (requestCase_ == 13) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 13) { + requestCase_ = 0; + request_ = null; + } + createCustomClassRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + */ + public com.google.cloud.speech.v2.CreateCustomClassRequest.Builder + getCreateCustomClassRequestBuilder() { + return getCreateCustomClassRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreateCustomClassRequestOrBuilder + getCreateCustomClassRequestOrBuilder() { + if ((requestCase_ == 13) && (createCustomClassRequestBuilder_ != null)) { + return createCustomClassRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 13) { + return (com.google.cloud.speech.v2.CreateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The CreateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreateCustomClassRequest, + com.google.cloud.speech.v2.CreateCustomClassRequest.Builder, + com.google.cloud.speech.v2.CreateCustomClassRequestOrBuilder> + getCreateCustomClassRequestFieldBuilder() { + if (createCustomClassRequestBuilder_ == null) { + if (!(requestCase_ == 13)) { + request_ = com.google.cloud.speech.v2.CreateCustomClassRequest.getDefaultInstance(); + } + createCustomClassRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreateCustomClassRequest, + com.google.cloud.speech.v2.CreateCustomClassRequest.Builder, + com.google.cloud.speech.v2.CreateCustomClassRequestOrBuilder>( + (com.google.cloud.speech.v2.CreateCustomClassRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 13; + onChanged(); + ; + return createCustomClassRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateCustomClassRequest, + com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder, + com.google.cloud.speech.v2.UpdateCustomClassRequestOrBuilder> + updateCustomClassRequestBuilder_; + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + * + * @return Whether the updateCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasUpdateCustomClassRequest() { + return requestCase_ == 14; + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + * + * @return The updateCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequest getUpdateCustomClassRequest() { + if (updateCustomClassRequestBuilder_ == null) { + if (requestCase_ == 14) { + return (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance(); + } else { + if (requestCase_ == 14) { + return updateCustomClassRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + */ + public Builder setUpdateCustomClassRequest( + com.google.cloud.speech.v2.UpdateCustomClassRequest value) { + if (updateCustomClassRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + updateCustomClassRequestBuilder_.setMessage(value); + } + requestCase_ = 14; + return this; + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + */ + public Builder setUpdateCustomClassRequest( + com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder builderForValue) { + if (updateCustomClassRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + updateCustomClassRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 14; + return this; + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + */ + public Builder mergeUpdateCustomClassRequest( + com.google.cloud.speech.v2.UpdateCustomClassRequest value) { + if (updateCustomClassRequestBuilder_ == null) { + if (requestCase_ == 14 + && request_ + != com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.UpdateCustomClassRequest.newBuilder( + (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 14) { + updateCustomClassRequestBuilder_.mergeFrom(value); + } else { + updateCustomClassRequestBuilder_.setMessage(value); + } + } + requestCase_ = 14; + return this; + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + */ + public Builder clearUpdateCustomClassRequest() { + if (updateCustomClassRequestBuilder_ == null) { + if (requestCase_ == 14) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 14) { + requestCase_ = 0; + request_ = null; + } + updateCustomClassRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + */ + public com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder + getUpdateCustomClassRequestBuilder() { + return getUpdateCustomClassRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequestOrBuilder + getUpdateCustomClassRequestOrBuilder() { + if ((requestCase_ == 14) && (updateCustomClassRequestBuilder_ != null)) { + return updateCustomClassRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 14) { + return (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdateCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateCustomClassRequest, + com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder, + com.google.cloud.speech.v2.UpdateCustomClassRequestOrBuilder> + getUpdateCustomClassRequestFieldBuilder() { + if (updateCustomClassRequestBuilder_ == null) { + if (!(requestCase_ == 14)) { + request_ = com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance(); + } + updateCustomClassRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateCustomClassRequest, + com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder, + com.google.cloud.speech.v2.UpdateCustomClassRequestOrBuilder>( + (com.google.cloud.speech.v2.UpdateCustomClassRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 14; + onChanged(); + ; + return updateCustomClassRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeleteCustomClassRequest, + com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder, + com.google.cloud.speech.v2.DeleteCustomClassRequestOrBuilder> + deleteCustomClassRequestBuilder_; + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + * + * @return Whether the deleteCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasDeleteCustomClassRequest() { + return requestCase_ == 15; + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + * + * @return The deleteCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequest getDeleteCustomClassRequest() { + if (deleteCustomClassRequestBuilder_ == null) { + if (requestCase_ == 15) { + return (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance(); + } else { + if (requestCase_ == 15) { + return deleteCustomClassRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + */ + public Builder setDeleteCustomClassRequest( + com.google.cloud.speech.v2.DeleteCustomClassRequest value) { + if (deleteCustomClassRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + deleteCustomClassRequestBuilder_.setMessage(value); + } + requestCase_ = 15; + return this; + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + */ + public Builder setDeleteCustomClassRequest( + com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder builderForValue) { + if (deleteCustomClassRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + deleteCustomClassRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 15; + return this; + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + */ + public Builder mergeDeleteCustomClassRequest( + com.google.cloud.speech.v2.DeleteCustomClassRequest value) { + if (deleteCustomClassRequestBuilder_ == null) { + if (requestCase_ == 15 + && request_ + != com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.DeleteCustomClassRequest.newBuilder( + (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 15) { + deleteCustomClassRequestBuilder_.mergeFrom(value); + } else { + deleteCustomClassRequestBuilder_.setMessage(value); + } + } + requestCase_ = 15; + return this; + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + */ + public Builder clearDeleteCustomClassRequest() { + if (deleteCustomClassRequestBuilder_ == null) { + if (requestCase_ == 15) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 15) { + requestCase_ = 0; + request_ = null; + } + deleteCustomClassRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + */ + public com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder + getDeleteCustomClassRequestBuilder() { + return getDeleteCustomClassRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeleteCustomClassRequestOrBuilder + getDeleteCustomClassRequestOrBuilder() { + if ((requestCase_ == 15) && (deleteCustomClassRequestBuilder_ != null)) { + return deleteCustomClassRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 15) { + return (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The DeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeleteCustomClassRequest, + com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder, + com.google.cloud.speech.v2.DeleteCustomClassRequestOrBuilder> + getDeleteCustomClassRequestFieldBuilder() { + if (deleteCustomClassRequestBuilder_ == null) { + if (!(requestCase_ == 15)) { + request_ = com.google.cloud.speech.v2.DeleteCustomClassRequest.getDefaultInstance(); + } + deleteCustomClassRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeleteCustomClassRequest, + com.google.cloud.speech.v2.DeleteCustomClassRequest.Builder, + com.google.cloud.speech.v2.DeleteCustomClassRequestOrBuilder>( + (com.google.cloud.speech.v2.DeleteCustomClassRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 15; + onChanged(); + ; + return deleteCustomClassRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeleteCustomClassRequest, + com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder, + com.google.cloud.speech.v2.UndeleteCustomClassRequestOrBuilder> + undeleteCustomClassRequestBuilder_; + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + * + * @return Whether the undeleteCustomClassRequest field is set. + */ + @java.lang.Override + public boolean hasUndeleteCustomClassRequest() { + return requestCase_ == 16; + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + * + * @return The undeleteCustomClassRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequest getUndeleteCustomClassRequest() { + if (undeleteCustomClassRequestBuilder_ == null) { + if (requestCase_ == 16) { + return (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance(); + } else { + if (requestCase_ == 16) { + return undeleteCustomClassRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + public Builder setUndeleteCustomClassRequest( + com.google.cloud.speech.v2.UndeleteCustomClassRequest value) { + if (undeleteCustomClassRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + undeleteCustomClassRequestBuilder_.setMessage(value); + } + requestCase_ = 16; + return this; + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + public Builder setUndeleteCustomClassRequest( + com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder builderForValue) { + if (undeleteCustomClassRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + undeleteCustomClassRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 16; + return this; + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + public Builder mergeUndeleteCustomClassRequest( + com.google.cloud.speech.v2.UndeleteCustomClassRequest value) { + if (undeleteCustomClassRequestBuilder_ == null) { + if (requestCase_ == 16 + && request_ + != com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.UndeleteCustomClassRequest.newBuilder( + (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 16) { + undeleteCustomClassRequestBuilder_.mergeFrom(value); + } else { + undeleteCustomClassRequestBuilder_.setMessage(value); + } + } + requestCase_ = 16; + return this; + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + public Builder clearUndeleteCustomClassRequest() { + if (undeleteCustomClassRequestBuilder_ == null) { + if (requestCase_ == 16) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 16) { + requestCase_ = 0; + request_ = null; + } + undeleteCustomClassRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + public com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder + getUndeleteCustomClassRequestBuilder() { + return getUndeleteCustomClassRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequestOrBuilder + getUndeleteCustomClassRequestOrBuilder() { + if ((requestCase_ == 16) && (undeleteCustomClassRequestBuilder_ != null)) { + return undeleteCustomClassRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 16) { + return (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_; + } + return com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UndeleteCustomClassRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeleteCustomClassRequest, + com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder, + com.google.cloud.speech.v2.UndeleteCustomClassRequestOrBuilder> + getUndeleteCustomClassRequestFieldBuilder() { + if (undeleteCustomClassRequestBuilder_ == null) { + if (!(requestCase_ == 16)) { + request_ = com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance(); + } + undeleteCustomClassRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeleteCustomClassRequest, + com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder, + com.google.cloud.speech.v2.UndeleteCustomClassRequestOrBuilder>( + (com.google.cloud.speech.v2.UndeleteCustomClassRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 16; + onChanged(); + ; + return undeleteCustomClassRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreatePhraseSetRequest, + com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder, + com.google.cloud.speech.v2.CreatePhraseSetRequestOrBuilder> + createPhraseSetRequestBuilder_; + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + * + * @return Whether the createPhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasCreatePhraseSetRequest() { + return requestCase_ == 17; + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + * + * @return The createPhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequest getCreatePhraseSetRequest() { + if (createPhraseSetRequestBuilder_ == null) { + if (requestCase_ == 17) { + return (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance(); + } else { + if (requestCase_ == 17) { + return createPhraseSetRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + public Builder setCreatePhraseSetRequest( + com.google.cloud.speech.v2.CreatePhraseSetRequest value) { + if (createPhraseSetRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + createPhraseSetRequestBuilder_.setMessage(value); + } + requestCase_ = 17; + return this; + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + public Builder setCreatePhraseSetRequest( + com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder builderForValue) { + if (createPhraseSetRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + createPhraseSetRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 17; + return this; + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + public Builder mergeCreatePhraseSetRequest( + com.google.cloud.speech.v2.CreatePhraseSetRequest value) { + if (createPhraseSetRequestBuilder_ == null) { + if (requestCase_ == 17 + && request_ != com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.CreatePhraseSetRequest.newBuilder( + (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 17) { + createPhraseSetRequestBuilder_.mergeFrom(value); + } else { + createPhraseSetRequestBuilder_.setMessage(value); + } + } + requestCase_ = 17; + return this; + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + public Builder clearCreatePhraseSetRequest() { + if (createPhraseSetRequestBuilder_ == null) { + if (requestCase_ == 17) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 17) { + requestCase_ = 0; + request_ = null; + } + createPhraseSetRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + public com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder + getCreatePhraseSetRequestBuilder() { + return getCreatePhraseSetRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CreatePhraseSetRequestOrBuilder + getCreatePhraseSetRequestOrBuilder() { + if ((requestCase_ == 17) && (createPhraseSetRequestBuilder_ != null)) { + return createPhraseSetRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 17) { + return (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The CreatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreatePhraseSetRequest, + com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder, + com.google.cloud.speech.v2.CreatePhraseSetRequestOrBuilder> + getCreatePhraseSetRequestFieldBuilder() { + if (createPhraseSetRequestBuilder_ == null) { + if (!(requestCase_ == 17)) { + request_ = com.google.cloud.speech.v2.CreatePhraseSetRequest.getDefaultInstance(); + } + createPhraseSetRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CreatePhraseSetRequest, + com.google.cloud.speech.v2.CreatePhraseSetRequest.Builder, + com.google.cloud.speech.v2.CreatePhraseSetRequestOrBuilder>( + (com.google.cloud.speech.v2.CreatePhraseSetRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 17; + onChanged(); + ; + return createPhraseSetRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdatePhraseSetRequest, + com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder, + com.google.cloud.speech.v2.UpdatePhraseSetRequestOrBuilder> + updatePhraseSetRequestBuilder_; + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + * + * @return Whether the updatePhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasUpdatePhraseSetRequest() { + return requestCase_ == 18; + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + * + * @return The updatePhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequest getUpdatePhraseSetRequest() { + if (updatePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 18) { + return (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance(); + } else { + if (requestCase_ == 18) { + return updatePhraseSetRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + public Builder setUpdatePhraseSetRequest( + com.google.cloud.speech.v2.UpdatePhraseSetRequest value) { + if (updatePhraseSetRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + updatePhraseSetRequestBuilder_.setMessage(value); + } + requestCase_ = 18; + return this; + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + public Builder setUpdatePhraseSetRequest( + com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder builderForValue) { + if (updatePhraseSetRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + updatePhraseSetRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 18; + return this; + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + public Builder mergeUpdatePhraseSetRequest( + com.google.cloud.speech.v2.UpdatePhraseSetRequest value) { + if (updatePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 18 + && request_ != com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.UpdatePhraseSetRequest.newBuilder( + (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 18) { + updatePhraseSetRequestBuilder_.mergeFrom(value); + } else { + updatePhraseSetRequestBuilder_.setMessage(value); + } + } + requestCase_ = 18; + return this; + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + public Builder clearUpdatePhraseSetRequest() { + if (updatePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 18) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 18) { + requestCase_ = 0; + request_ = null; + } + updatePhraseSetRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + public com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder + getUpdatePhraseSetRequestBuilder() { + return getUpdatePhraseSetRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequestOrBuilder + getUpdatePhraseSetRequestOrBuilder() { + if ((requestCase_ == 18) && (updatePhraseSetRequestBuilder_ != null)) { + return updatePhraseSetRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 18) { + return (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdatePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdatePhraseSetRequest, + com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder, + com.google.cloud.speech.v2.UpdatePhraseSetRequestOrBuilder> + getUpdatePhraseSetRequestFieldBuilder() { + if (updatePhraseSetRequestBuilder_ == null) { + if (!(requestCase_ == 18)) { + request_ = com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance(); + } + updatePhraseSetRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdatePhraseSetRequest, + com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder, + com.google.cloud.speech.v2.UpdatePhraseSetRequestOrBuilder>( + (com.google.cloud.speech.v2.UpdatePhraseSetRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 18; + onChanged(); + ; + return updatePhraseSetRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeletePhraseSetRequest, + com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder, + com.google.cloud.speech.v2.DeletePhraseSetRequestOrBuilder> + deletePhraseSetRequestBuilder_; + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + * + * @return Whether the deletePhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasDeletePhraseSetRequest() { + return requestCase_ == 19; + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + * + * @return The deletePhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequest getDeletePhraseSetRequest() { + if (deletePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 19) { + return (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance(); + } else { + if (requestCase_ == 19) { + return deletePhraseSetRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + public Builder setDeletePhraseSetRequest( + com.google.cloud.speech.v2.DeletePhraseSetRequest value) { + if (deletePhraseSetRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + deletePhraseSetRequestBuilder_.setMessage(value); + } + requestCase_ = 19; + return this; + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + public Builder setDeletePhraseSetRequest( + com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder builderForValue) { + if (deletePhraseSetRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + deletePhraseSetRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 19; + return this; + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + public Builder mergeDeletePhraseSetRequest( + com.google.cloud.speech.v2.DeletePhraseSetRequest value) { + if (deletePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 19 + && request_ != com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.DeletePhraseSetRequest.newBuilder( + (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 19) { + deletePhraseSetRequestBuilder_.mergeFrom(value); + } else { + deletePhraseSetRequestBuilder_.setMessage(value); + } + } + requestCase_ = 19; + return this; + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + public Builder clearDeletePhraseSetRequest() { + if (deletePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 19) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 19) { + requestCase_ = 0; + request_ = null; + } + deletePhraseSetRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + public com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder + getDeletePhraseSetRequestBuilder() { + return getDeletePhraseSetRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + @java.lang.Override + public com.google.cloud.speech.v2.DeletePhraseSetRequestOrBuilder + getDeletePhraseSetRequestOrBuilder() { + if ((requestCase_ == 19) && (deletePhraseSetRequestBuilder_ != null)) { + return deletePhraseSetRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 19) { + return (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The DeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeletePhraseSetRequest, + com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder, + com.google.cloud.speech.v2.DeletePhraseSetRequestOrBuilder> + getDeletePhraseSetRequestFieldBuilder() { + if (deletePhraseSetRequestBuilder_ == null) { + if (!(requestCase_ == 19)) { + request_ = com.google.cloud.speech.v2.DeletePhraseSetRequest.getDefaultInstance(); + } + deletePhraseSetRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.DeletePhraseSetRequest, + com.google.cloud.speech.v2.DeletePhraseSetRequest.Builder, + com.google.cloud.speech.v2.DeletePhraseSetRequestOrBuilder>( + (com.google.cloud.speech.v2.DeletePhraseSetRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 19; + onChanged(); + ; + return deletePhraseSetRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeletePhraseSetRequest, + com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder, + com.google.cloud.speech.v2.UndeletePhraseSetRequestOrBuilder> + undeletePhraseSetRequestBuilder_; + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + * + * @return Whether the undeletePhraseSetRequest field is set. + */ + @java.lang.Override + public boolean hasUndeletePhraseSetRequest() { + return requestCase_ == 20; + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + * + * @return The undeletePhraseSetRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequest getUndeletePhraseSetRequest() { + if (undeletePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 20) { + return (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance(); + } else { + if (requestCase_ == 20) { + return undeletePhraseSetRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + */ + public Builder setUndeletePhraseSetRequest( + com.google.cloud.speech.v2.UndeletePhraseSetRequest value) { + if (undeletePhraseSetRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + undeletePhraseSetRequestBuilder_.setMessage(value); + } + requestCase_ = 20; + return this; + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + */ + public Builder setUndeletePhraseSetRequest( + com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder builderForValue) { + if (undeletePhraseSetRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + undeletePhraseSetRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 20; + return this; + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + */ + public Builder mergeUndeletePhraseSetRequest( + com.google.cloud.speech.v2.UndeletePhraseSetRequest value) { + if (undeletePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 20 + && request_ + != com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.UndeletePhraseSetRequest.newBuilder( + (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 20) { + undeletePhraseSetRequestBuilder_.mergeFrom(value); + } else { + undeletePhraseSetRequestBuilder_.setMessage(value); + } + } + requestCase_ = 20; + return this; + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + */ + public Builder clearUndeletePhraseSetRequest() { + if (undeletePhraseSetRequestBuilder_ == null) { + if (requestCase_ == 20) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 20) { + requestCase_ = 0; + request_ = null; + } + undeletePhraseSetRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + */ + public com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder + getUndeletePhraseSetRequestBuilder() { + return getUndeletePhraseSetRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequestOrBuilder + getUndeletePhraseSetRequestOrBuilder() { + if ((requestCase_ == 20) && (undeletePhraseSetRequestBuilder_ != null)) { + return undeletePhraseSetRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 20) { + return (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_; + } + return com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UndeletePhraseSetRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeletePhraseSetRequest, + com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder, + com.google.cloud.speech.v2.UndeletePhraseSetRequestOrBuilder> + getUndeletePhraseSetRequestFieldBuilder() { + if (undeletePhraseSetRequestBuilder_ == null) { + if (!(requestCase_ == 20)) { + request_ = com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance(); + } + undeletePhraseSetRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UndeletePhraseSetRequest, + com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder, + com.google.cloud.speech.v2.UndeletePhraseSetRequestOrBuilder>( + (com.google.cloud.speech.v2.UndeletePhraseSetRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 20; + onChanged(); + ; + return undeletePhraseSetRequestBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateConfigRequest, + com.google.cloud.speech.v2.UpdateConfigRequest.Builder, + com.google.cloud.speech.v2.UpdateConfigRequestOrBuilder> + updateConfigRequestBuilder_; + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + * + * @return Whether the updateConfigRequest field is set. + */ + @java.lang.Override + public boolean hasUpdateConfigRequest() { + return requestCase_ == 21; + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + * + * @return The updateConfigRequest. + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequest getUpdateConfigRequest() { + if (updateConfigRequestBuilder_ == null) { + if (requestCase_ == 21) { + return (com.google.cloud.speech.v2.UpdateConfigRequest) request_; + } + return com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance(); + } else { + if (requestCase_ == 21) { + return updateConfigRequestBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + public Builder setUpdateConfigRequest(com.google.cloud.speech.v2.UpdateConfigRequest value) { + if (updateConfigRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + onChanged(); + } else { + updateConfigRequestBuilder_.setMessage(value); + } + requestCase_ = 21; + return this; + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + public Builder setUpdateConfigRequest( + com.google.cloud.speech.v2.UpdateConfigRequest.Builder builderForValue) { + if (updateConfigRequestBuilder_ == null) { + request_ = builderForValue.build(); + onChanged(); + } else { + updateConfigRequestBuilder_.setMessage(builderForValue.build()); + } + requestCase_ = 21; + return this; + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + public Builder mergeUpdateConfigRequest(com.google.cloud.speech.v2.UpdateConfigRequest value) { + if (updateConfigRequestBuilder_ == null) { + if (requestCase_ == 21 + && request_ != com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance()) { + request_ = + com.google.cloud.speech.v2.UpdateConfigRequest.newBuilder( + (com.google.cloud.speech.v2.UpdateConfigRequest) request_) + .mergeFrom(value) + .buildPartial(); + } else { + request_ = value; + } + onChanged(); + } else { + if (requestCase_ == 21) { + updateConfigRequestBuilder_.mergeFrom(value); + } else { + updateConfigRequestBuilder_.setMessage(value); + } + } + requestCase_ = 21; + return this; + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + public Builder clearUpdateConfigRequest() { + if (updateConfigRequestBuilder_ == null) { + if (requestCase_ == 21) { + requestCase_ = 0; + request_ = null; + onChanged(); + } + } else { + if (requestCase_ == 21) { + requestCase_ = 0; + request_ = null; + } + updateConfigRequestBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + public com.google.cloud.speech.v2.UpdateConfigRequest.Builder getUpdateConfigRequestBuilder() { + return getUpdateConfigRequestFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequestOrBuilder + getUpdateConfigRequestOrBuilder() { + if ((requestCase_ == 21) && (updateConfigRequestBuilder_ != null)) { + return updateConfigRequestBuilder_.getMessageOrBuilder(); + } else { + if (requestCase_ == 21) { + return (com.google.cloud.speech.v2.UpdateConfigRequest) request_; + } + return com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance(); + } + } + /** + * + * + *
+     * The UpdateConfigRequest that spawned the Operation.
+     * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateConfigRequest, + com.google.cloud.speech.v2.UpdateConfigRequest.Builder, + com.google.cloud.speech.v2.UpdateConfigRequestOrBuilder> + getUpdateConfigRequestFieldBuilder() { + if (updateConfigRequestBuilder_ == null) { + if (!(requestCase_ == 21)) { + request_ = com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance(); + } + updateConfigRequestBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.UpdateConfigRequest, + com.google.cloud.speech.v2.UpdateConfigRequest.Builder, + com.google.cloud.speech.v2.UpdateConfigRequestOrBuilder>( + (com.google.cloud.speech.v2.UpdateConfigRequest) request_, + getParentForChildren(), + isClean()); + request_ = null; + } + requestCase_ = 21; + onChanged(); + ; + return updateConfigRequestBuilder_; + } + + private int progressPercent_; + /** + * + * + *
+     * The percent progress of the Operation. Values can range from 0-100. If the
+     * value is 100, then the operation is finished.
+     * 
+ * + * int32 progress_percent = 22; + * + * @return The progressPercent. + */ + @java.lang.Override + public int getProgressPercent() { + return progressPercent_; + } + /** + * + * + *
+     * The percent progress of the Operation. Values can range from 0-100. If the
+     * value is 100, then the operation is finished.
+     * 
+ * + * int32 progress_percent = 22; + * + * @param value The progressPercent to set. + * @return This builder for chaining. + */ + public Builder setProgressPercent(int value) { + + progressPercent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The percent progress of the Operation. Values can range from 0-100. If the
+     * value is 100, then the operation is finished.
+     * 
+ * + * int32 progress_percent = 22; + * + * @return This builder for chaining. + */ + public Builder clearProgressPercent() { + + progressPercent_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeMetadata, + com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder, + com.google.cloud.speech.v2.BatchRecognizeMetadataOrBuilder> + batchRecognizeMetadataBuilder_; + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + * + * @return Whether the batchRecognizeMetadata field is set. + */ + @java.lang.Override + public boolean hasBatchRecognizeMetadata() { + return metadataCase_ == 23; + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + * + * @return The batchRecognizeMetadata. + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadata getBatchRecognizeMetadata() { + if (batchRecognizeMetadataBuilder_ == null) { + if (metadataCase_ == 23) { + return (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_; + } + return com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance(); + } else { + if (metadataCase_ == 23) { + return batchRecognizeMetadataBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance(); + } + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + public Builder setBatchRecognizeMetadata( + com.google.cloud.speech.v2.BatchRecognizeMetadata value) { + if (batchRecognizeMetadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + onChanged(); + } else { + batchRecognizeMetadataBuilder_.setMessage(value); + } + metadataCase_ = 23; + return this; + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + public Builder setBatchRecognizeMetadata( + com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder builderForValue) { + if (batchRecognizeMetadataBuilder_ == null) { + metadata_ = builderForValue.build(); + onChanged(); + } else { + batchRecognizeMetadataBuilder_.setMessage(builderForValue.build()); + } + metadataCase_ = 23; + return this; + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + public Builder mergeBatchRecognizeMetadata( + com.google.cloud.speech.v2.BatchRecognizeMetadata value) { + if (batchRecognizeMetadataBuilder_ == null) { + if (metadataCase_ == 23 + && metadata_ + != com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance()) { + metadata_ = + com.google.cloud.speech.v2.BatchRecognizeMetadata.newBuilder( + (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_) + .mergeFrom(value) + .buildPartial(); + } else { + metadata_ = value; + } + onChanged(); + } else { + if (metadataCase_ == 23) { + batchRecognizeMetadataBuilder_.mergeFrom(value); + } else { + batchRecognizeMetadataBuilder_.setMessage(value); + } + } + metadataCase_ = 23; + return this; + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + public Builder clearBatchRecognizeMetadata() { + if (batchRecognizeMetadataBuilder_ == null) { + if (metadataCase_ == 23) { + metadataCase_ = 0; + metadata_ = null; + onChanged(); + } + } else { + if (metadataCase_ == 23) { + metadataCase_ = 0; + metadata_ = null; + } + batchRecognizeMetadataBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + public com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder + getBatchRecognizeMetadataBuilder() { + return getBatchRecognizeMetadataFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + @java.lang.Override + public com.google.cloud.speech.v2.BatchRecognizeMetadataOrBuilder + getBatchRecognizeMetadataOrBuilder() { + if ((metadataCase_ == 23) && (batchRecognizeMetadataBuilder_ != null)) { + return batchRecognizeMetadataBuilder_.getMessageOrBuilder(); + } else { + if (metadataCase_ == 23) { + return (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_; + } + return com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance(); + } + } + /** + * + * + *
+     * Metadata specific to the BatchRecognize method.
+     * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeMetadata, + com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder, + com.google.cloud.speech.v2.BatchRecognizeMetadataOrBuilder> + getBatchRecognizeMetadataFieldBuilder() { + if (batchRecognizeMetadataBuilder_ == null) { + if (!(metadataCase_ == 23)) { + metadata_ = com.google.cloud.speech.v2.BatchRecognizeMetadata.getDefaultInstance(); + } + batchRecognizeMetadataBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.BatchRecognizeMetadata, + com.google.cloud.speech.v2.BatchRecognizeMetadata.Builder, + com.google.cloud.speech.v2.BatchRecognizeMetadataOrBuilder>( + (com.google.cloud.speech.v2.BatchRecognizeMetadata) metadata_, + getParentForChildren(), + isClean()); + metadata_ = null; + } + metadataCase_ = 23; + onChanged(); + ; + return batchRecognizeMetadataBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.OperationMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.OperationMetadata) + private static final com.google.cloud.speech.v2.OperationMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.OperationMetadata(); + } + + public static com.google.cloud.speech.v2.OperationMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OperationMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OperationMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.OperationMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadataOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadataOrBuilder.java new file mode 100644 index 000000000000..8baa2442726f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/OperationMetadataOrBuilder.java @@ -0,0 +1,762 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface OperationMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.OperationMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * The time the operation was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * The time the operation was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * The time the operation was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * The resource path for the target of the operation.
+   * 
+ * + * string resource = 3; + * + * @return The resource. + */ + java.lang.String getResource(); + /** + * + * + *
+   * The resource path for the target of the operation.
+   * 
+ * + * string resource = 3; + * + * @return The bytes for resource. + */ + com.google.protobuf.ByteString getResourceBytes(); + + /** + * + * + *
+   * The method that triggered the operation.
+   * 
+ * + * string method = 4; + * + * @return The method. + */ + java.lang.String getMethod(); + /** + * + * + *
+   * The method that triggered the operation.
+   * 
+ * + * string method = 4; + * + * @return The bytes for method. + */ + com.google.protobuf.ByteString getMethodBytes(); + + /** + * + * + *
+   * The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @return The kmsKeyName. + */ + java.lang.String getKmsKeyName(); + /** + * + * + *
+   * The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * string kms_key_name = 6 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for kmsKeyName. + */ + com.google.protobuf.ByteString getKmsKeyNameBytes(); + + /** + * + * + *
+   * The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @return The kmsKeyVersionName. + */ + java.lang.String getKmsKeyVersionName(); + /** + * + * + *
+   * The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which content of the Operation is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * string kms_key_version_name = 7 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for kmsKeyVersionName. + */ + com.google.protobuf.ByteString getKmsKeyVersionNameBytes(); + + /** + * + * + *
+   * The BatchRecognizeRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + * + * @return Whether the batchRecognizeRequest field is set. + */ + boolean hasBatchRecognizeRequest(); + /** + * + * + *
+   * The BatchRecognizeRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + * + * @return The batchRecognizeRequest. + */ + com.google.cloud.speech.v2.BatchRecognizeRequest getBatchRecognizeRequest(); + /** + * + * + *
+   * The BatchRecognizeRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeRequest batch_recognize_request = 8; + */ + com.google.cloud.speech.v2.BatchRecognizeRequestOrBuilder getBatchRecognizeRequestOrBuilder(); + + /** + * + * + *
+   * The CreateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + * + * @return Whether the createRecognizerRequest field is set. + */ + boolean hasCreateRecognizerRequest(); + /** + * + * + *
+   * The CreateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + * + * @return The createRecognizerRequest. + */ + com.google.cloud.speech.v2.CreateRecognizerRequest getCreateRecognizerRequest(); + /** + * + * + *
+   * The CreateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateRecognizerRequest create_recognizer_request = 9; + */ + com.google.cloud.speech.v2.CreateRecognizerRequestOrBuilder getCreateRecognizerRequestOrBuilder(); + + /** + * + * + *
+   * The UpdateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + * + * @return Whether the updateRecognizerRequest field is set. + */ + boolean hasUpdateRecognizerRequest(); + /** + * + * + *
+   * The UpdateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + * + * @return The updateRecognizerRequest. + */ + com.google.cloud.speech.v2.UpdateRecognizerRequest getUpdateRecognizerRequest(); + /** + * + * + *
+   * The UpdateRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateRecognizerRequest update_recognizer_request = 10; + */ + com.google.cloud.speech.v2.UpdateRecognizerRequestOrBuilder getUpdateRecognizerRequestOrBuilder(); + + /** + * + * + *
+   * The DeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + * + * @return Whether the deleteRecognizerRequest field is set. + */ + boolean hasDeleteRecognizerRequest(); + /** + * + * + *
+   * The DeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + * + * @return The deleteRecognizerRequest. + */ + com.google.cloud.speech.v2.DeleteRecognizerRequest getDeleteRecognizerRequest(); + /** + * + * + *
+   * The DeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteRecognizerRequest delete_recognizer_request = 11; + */ + com.google.cloud.speech.v2.DeleteRecognizerRequestOrBuilder getDeleteRecognizerRequestOrBuilder(); + + /** + * + * + *
+   * The UndeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + * + * @return Whether the undeleteRecognizerRequest field is set. + */ + boolean hasUndeleteRecognizerRequest(); + /** + * + * + *
+   * The UndeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + * + * @return The undeleteRecognizerRequest. + */ + com.google.cloud.speech.v2.UndeleteRecognizerRequest getUndeleteRecognizerRequest(); + /** + * + * + *
+   * The UndeleteRecognizerRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteRecognizerRequest undelete_recognizer_request = 12; + * + */ + com.google.cloud.speech.v2.UndeleteRecognizerRequestOrBuilder + getUndeleteRecognizerRequestOrBuilder(); + + /** + * + * + *
+   * The CreateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + * @return Whether the createCustomClassRequest field is set. + */ + boolean hasCreateCustomClassRequest(); + /** + * + * + *
+   * The CreateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + * + * @return The createCustomClassRequest. + */ + com.google.cloud.speech.v2.CreateCustomClassRequest getCreateCustomClassRequest(); + /** + * + * + *
+   * The CreateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreateCustomClassRequest create_custom_class_request = 13; + */ + com.google.cloud.speech.v2.CreateCustomClassRequestOrBuilder + getCreateCustomClassRequestOrBuilder(); + + /** + * + * + *
+   * The UpdateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + * @return Whether the updateCustomClassRequest field is set. + */ + boolean hasUpdateCustomClassRequest(); + /** + * + * + *
+   * The UpdateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + * + * @return The updateCustomClassRequest. + */ + com.google.cloud.speech.v2.UpdateCustomClassRequest getUpdateCustomClassRequest(); + /** + * + * + *
+   * The UpdateCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateCustomClassRequest update_custom_class_request = 14; + */ + com.google.cloud.speech.v2.UpdateCustomClassRequestOrBuilder + getUpdateCustomClassRequestOrBuilder(); + + /** + * + * + *
+   * The DeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + * @return Whether the deleteCustomClassRequest field is set. + */ + boolean hasDeleteCustomClassRequest(); + /** + * + * + *
+   * The DeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + * + * @return The deleteCustomClassRequest. + */ + com.google.cloud.speech.v2.DeleteCustomClassRequest getDeleteCustomClassRequest(); + /** + * + * + *
+   * The DeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeleteCustomClassRequest delete_custom_class_request = 15; + */ + com.google.cloud.speech.v2.DeleteCustomClassRequestOrBuilder + getDeleteCustomClassRequestOrBuilder(); + + /** + * + * + *
+   * The UndeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + * + * @return Whether the undeleteCustomClassRequest field is set. + */ + boolean hasUndeleteCustomClassRequest(); + /** + * + * + *
+   * The UndeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + * + * @return The undeleteCustomClassRequest. + */ + com.google.cloud.speech.v2.UndeleteCustomClassRequest getUndeleteCustomClassRequest(); + /** + * + * + *
+   * The UndeleteCustomClassRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeleteCustomClassRequest undelete_custom_class_request = 16; + * + */ + com.google.cloud.speech.v2.UndeleteCustomClassRequestOrBuilder + getUndeleteCustomClassRequestOrBuilder(); + + /** + * + * + *
+   * The CreatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + * + * @return Whether the createPhraseSetRequest field is set. + */ + boolean hasCreatePhraseSetRequest(); + /** + * + * + *
+   * The CreatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + * + * @return The createPhraseSetRequest. + */ + com.google.cloud.speech.v2.CreatePhraseSetRequest getCreatePhraseSetRequest(); + /** + * + * + *
+   * The CreatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.CreatePhraseSetRequest create_phrase_set_request = 17; + */ + com.google.cloud.speech.v2.CreatePhraseSetRequestOrBuilder getCreatePhraseSetRequestOrBuilder(); + + /** + * + * + *
+   * The UpdatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + * + * @return Whether the updatePhraseSetRequest field is set. + */ + boolean hasUpdatePhraseSetRequest(); + /** + * + * + *
+   * The UpdatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + * + * @return The updatePhraseSetRequest. + */ + com.google.cloud.speech.v2.UpdatePhraseSetRequest getUpdatePhraseSetRequest(); + /** + * + * + *
+   * The UpdatePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdatePhraseSetRequest update_phrase_set_request = 18; + */ + com.google.cloud.speech.v2.UpdatePhraseSetRequestOrBuilder getUpdatePhraseSetRequestOrBuilder(); + + /** + * + * + *
+   * The DeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + * + * @return Whether the deletePhraseSetRequest field is set. + */ + boolean hasDeletePhraseSetRequest(); + /** + * + * + *
+   * The DeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + * + * @return The deletePhraseSetRequest. + */ + com.google.cloud.speech.v2.DeletePhraseSetRequest getDeletePhraseSetRequest(); + /** + * + * + *
+   * The DeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.DeletePhraseSetRequest delete_phrase_set_request = 19; + */ + com.google.cloud.speech.v2.DeletePhraseSetRequestOrBuilder getDeletePhraseSetRequestOrBuilder(); + + /** + * + * + *
+   * The UndeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + * @return Whether the undeletePhraseSetRequest field is set. + */ + boolean hasUndeletePhraseSetRequest(); + /** + * + * + *
+   * The UndeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + * + * @return The undeletePhraseSetRequest. + */ + com.google.cloud.speech.v2.UndeletePhraseSetRequest getUndeletePhraseSetRequest(); + /** + * + * + *
+   * The UndeletePhraseSetRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UndeletePhraseSetRequest undelete_phrase_set_request = 20; + */ + com.google.cloud.speech.v2.UndeletePhraseSetRequestOrBuilder + getUndeletePhraseSetRequestOrBuilder(); + + /** + * + * + *
+   * The UpdateConfigRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + * + * @return Whether the updateConfigRequest field is set. + */ + boolean hasUpdateConfigRequest(); + /** + * + * + *
+   * The UpdateConfigRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + * + * @return The updateConfigRequest. + */ + com.google.cloud.speech.v2.UpdateConfigRequest getUpdateConfigRequest(); + /** + * + * + *
+   * The UpdateConfigRequest that spawned the Operation.
+   * 
+ * + * .google.cloud.speech.v2.UpdateConfigRequest update_config_request = 21; + */ + com.google.cloud.speech.v2.UpdateConfigRequestOrBuilder getUpdateConfigRequestOrBuilder(); + + /** + * + * + *
+   * The percent progress of the Operation. Values can range from 0-100. If the
+   * value is 100, then the operation is finished.
+   * 
+ * + * int32 progress_percent = 22; + * + * @return The progressPercent. + */ + int getProgressPercent(); + + /** + * + * + *
+   * Metadata specific to the BatchRecognize method.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + * + * @return Whether the batchRecognizeMetadata field is set. + */ + boolean hasBatchRecognizeMetadata(); + /** + * + * + *
+   * Metadata specific to the BatchRecognize method.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + * + * @return The batchRecognizeMetadata. + */ + com.google.cloud.speech.v2.BatchRecognizeMetadata getBatchRecognizeMetadata(); + /** + * + * + *
+   * Metadata specific to the BatchRecognize method.
+   * 
+ * + * .google.cloud.speech.v2.BatchRecognizeMetadata batch_recognize_metadata = 23; + */ + com.google.cloud.speech.v2.BatchRecognizeMetadataOrBuilder getBatchRecognizeMetadataOrBuilder(); + + public com.google.cloud.speech.v2.OperationMetadata.RequestCase getRequestCase(); + + public com.google.cloud.speech.v2.OperationMetadata.MetadataCase getMetadataCase(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSet.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSet.java new file mode 100644 index 000000000000..186a51b24ae1 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSet.java @@ -0,0 +1,4981 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
+ * "hints" to the speech recognizer to favor specific words and phrases in the
+ * results.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.PhraseSet} + */ +public final class PhraseSet extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.PhraseSet) + PhraseSetOrBuilder { + private static final long serialVersionUID = 0L; + // Use PhraseSet.newBuilder() to construct. + private PhraseSet(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PhraseSet() { + name_ = ""; + uid_ = ""; + phrases_ = java.util.Collections.emptyList(); + displayName_ = ""; + state_ = 0; + etag_ = ""; + kmsKeyName_ = ""; + kmsKeyVersionName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PhraseSet(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PhraseSet( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + uid_ = s; + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + phrases_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + phrases_.add( + input.readMessage( + com.google.cloud.speech.v2.PhraseSet.Phrase.parser(), extensionRegistry)); + break; + } + case 37: + { + boost_ = input.readFloat(); + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 50: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (deleteTime_ != null) { + subBuilder = deleteTime_.toBuilder(); + } + deleteTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(deleteTime_); + deleteTime_ = subBuilder.buildPartial(); + } + + break; + } + case 74: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (expireTime_ != null) { + subBuilder = expireTime_.toBuilder(); + } + expireTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(expireTime_); + expireTime_ = subBuilder.buildPartial(); + } + + break; + } + case 82: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + annotations_ = + com.google.protobuf.MapField.newMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + annotations_.getMutableMap().put(annotations__.getKey(), annotations__.getValue()); + break; + } + case 90: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 96: + { + reconciling_ = input.readBool(); + break; + } + case 106: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyName_ = s; + break; + } + case 114: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyVersionName_ = s; + break; + } + case 120: + { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + phrases_ = java.util.Collections.unmodifiableList(phrases_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.PhraseSet.class, + com.google.cloud.speech.v2.PhraseSet.Builder.class); + } + + /** + * + * + *
+   * Set of states that define the lifecycle of a PhraseSet.
+   * 
+ * + * Protobuf enum {@code google.cloud.speech.v2.PhraseSet.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Unspecified state.  This is only used/useful for distinguishing
+     * unset values.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * The normal and active state.
+     * 
+ * + * ACTIVE = 2; + */ + ACTIVE(2), + /** + * + * + *
+     * This PhraseSet has been deleted.
+     * 
+ * + * DELETED = 4; + */ + DELETED(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Unspecified state.  This is only used/useful for distinguishing
+     * unset values.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The normal and active state.
+     * 
+ * + * ACTIVE = 2; + */ + public static final int ACTIVE_VALUE = 2; + /** + * + * + *
+     * This PhraseSet has been deleted.
+     * 
+ * + * DELETED = 4; + */ + public static final int DELETED_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 2: + return ACTIVE; + case 4: + return DELETED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.speech.v2.PhraseSet.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.speech.v2.PhraseSet.State) + } + + public interface PhraseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.PhraseSet.Phrase) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The phrase itself.
+     * 
+ * + * string value = 1; + * + * @return The value. + */ + java.lang.String getValue(); + /** + * + * + *
+     * The phrase itself.
+     * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + com.google.protobuf.ByteString getValueBytes(); + + /** + * + * + *
+     * Hint Boost. Overrides the boost set at the phrase set level.
+     * Positive value will increase the probability that a specific phrase will
+     * be recognized over other similar sounding phrases. The higher the boost,
+     * the higher the chance of false positive recognition as well. Negative
+     * boost values would correspond to anti-biasing. Anti-biasing is not
+     * enabled, so negative boost will simply be ignored. Though `boost` can
+     * accept a wide range of positive values, most use cases are best served
+     * with values between 0 and 20. We recommend using a binary search approach
+     * to finding the optimal value for your use case. Speech recognition
+     * will skip PhraseSets with a boost value of 0.
+     * 
+ * + * float boost = 2; + * + * @return The boost. + */ + float getBoost(); + } + /** + * + * + *
+   * A Phrase contains words and phrase "hints" so that the speech recognition
+   * is more likely to recognize them. This can be used to improve the accuracy
+   * for specific words and phrases, for example, if specific commands are
+   * typically spoken by the user. This can also be used to add additional words
+   * to the vocabulary of the recognizer.
+   * List items can also include CustomClass references containing groups of
+   * words that represent common concepts that occur in natural language.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.PhraseSet.Phrase} + */ + public static final class Phrase extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.PhraseSet.Phrase) + PhraseOrBuilder { + private static final long serialVersionUID = 0L; + // Use Phrase.newBuilder() to construct. + private Phrase(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Phrase() { + value_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Phrase(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Phrase( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + value_ = s; + break; + } + case 21: + { + boost_ = input.readFloat(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_Phrase_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_Phrase_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.PhraseSet.Phrase.class, + com.google.cloud.speech.v2.PhraseSet.Phrase.Builder.class); + } + + public static final int VALUE_FIELD_NUMBER = 1; + private volatile java.lang.Object value_; + /** + * + * + *
+     * The phrase itself.
+     * 
+ * + * string value = 1; + * + * @return The value. + */ + @java.lang.Override + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } + } + /** + * + * + *
+     * The phrase itself.
+     * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + @java.lang.Override + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BOOST_FIELD_NUMBER = 2; + private float boost_; + /** + * + * + *
+     * Hint Boost. Overrides the boost set at the phrase set level.
+     * Positive value will increase the probability that a specific phrase will
+     * be recognized over other similar sounding phrases. The higher the boost,
+     * the higher the chance of false positive recognition as well. Negative
+     * boost values would correspond to anti-biasing. Anti-biasing is not
+     * enabled, so negative boost will simply be ignored. Though `boost` can
+     * accept a wide range of positive values, most use cases are best served
+     * with values between 0 and 20. We recommend using a binary search approach
+     * to finding the optimal value for your use case. Speech recognition
+     * will skip PhraseSets with a boost value of 0.
+     * 
+ * + * float boost = 2; + * + * @return The boost. + */ + @java.lang.Override + public float getBoost() { + return boost_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_); + } + if (java.lang.Float.floatToRawIntBits(boost_) != 0) { + output.writeFloat(2, boost_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_); + } + if (java.lang.Float.floatToRawIntBits(boost_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, boost_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.PhraseSet.Phrase)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.PhraseSet.Phrase other = + (com.google.cloud.speech.v2.PhraseSet.Phrase) obj; + + if (!getValue().equals(other.getValue())) return false; + if (java.lang.Float.floatToIntBits(getBoost()) + != java.lang.Float.floatToIntBits(other.getBoost())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (37 * hash) + BOOST_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getBoost()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.PhraseSet.Phrase prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * A Phrase contains words and phrase "hints" so that the speech recognition
+     * is more likely to recognize them. This can be used to improve the accuracy
+     * for specific words and phrases, for example, if specific commands are
+     * typically spoken by the user. This can also be used to add additional words
+     * to the vocabulary of the recognizer.
+     * List items can also include CustomClass references containing groups of
+     * words that represent common concepts that occur in natural language.
+     * 
+ * + * Protobuf type {@code google.cloud.speech.v2.PhraseSet.Phrase} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.PhraseSet.Phrase) + com.google.cloud.speech.v2.PhraseSet.PhraseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_Phrase_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_Phrase_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.PhraseSet.Phrase.class, + com.google.cloud.speech.v2.PhraseSet.Phrase.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.PhraseSet.Phrase.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + value_ = ""; + + boost_ = 0F; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_Phrase_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.Phrase getDefaultInstanceForType() { + return com.google.cloud.speech.v2.PhraseSet.Phrase.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.Phrase build() { + com.google.cloud.speech.v2.PhraseSet.Phrase result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.Phrase buildPartial() { + com.google.cloud.speech.v2.PhraseSet.Phrase result = + new com.google.cloud.speech.v2.PhraseSet.Phrase(this); + result.value_ = value_; + result.boost_ = boost_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.PhraseSet.Phrase) { + return mergeFrom((com.google.cloud.speech.v2.PhraseSet.Phrase) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.PhraseSet.Phrase other) { + if (other == com.google.cloud.speech.v2.PhraseSet.Phrase.getDefaultInstance()) return this; + if (!other.getValue().isEmpty()) { + value_ = other.value_; + onChanged(); + } + if (other.getBoost() != 0F) { + setBoost(other.getBoost()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.PhraseSet.Phrase parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.PhraseSet.Phrase) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object value_ = ""; + /** + * + * + *
+       * The phrase itself.
+       * 
+ * + * string value = 1; + * + * @return The value. + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The phrase itself.
+       * 
+ * + * string value = 1; + * + * @return The bytes for value. + */ + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The phrase itself.
+       * 
+ * + * string value = 1; + * + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + value_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The phrase itself.
+       * 
+ * + * string value = 1; + * + * @return This builder for chaining. + */ + public Builder clearValue() { + + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * + * + *
+       * The phrase itself.
+       * 
+ * + * string value = 1; + * + * @param value The bytes for value to set. + * @return This builder for chaining. + */ + public Builder setValueBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + value_ = value; + onChanged(); + return this; + } + + private float boost_; + /** + * + * + *
+       * Hint Boost. Overrides the boost set at the phrase set level.
+       * Positive value will increase the probability that a specific phrase will
+       * be recognized over other similar sounding phrases. The higher the boost,
+       * the higher the chance of false positive recognition as well. Negative
+       * boost values would correspond to anti-biasing. Anti-biasing is not
+       * enabled, so negative boost will simply be ignored. Though `boost` can
+       * accept a wide range of positive values, most use cases are best served
+       * with values between 0 and 20. We recommend using a binary search approach
+       * to finding the optimal value for your use case. Speech recognition
+       * will skip PhraseSets with a boost value of 0.
+       * 
+ * + * float boost = 2; + * + * @return The boost. + */ + @java.lang.Override + public float getBoost() { + return boost_; + } + /** + * + * + *
+       * Hint Boost. Overrides the boost set at the phrase set level.
+       * Positive value will increase the probability that a specific phrase will
+       * be recognized over other similar sounding phrases. The higher the boost,
+       * the higher the chance of false positive recognition as well. Negative
+       * boost values would correspond to anti-biasing. Anti-biasing is not
+       * enabled, so negative boost will simply be ignored. Though `boost` can
+       * accept a wide range of positive values, most use cases are best served
+       * with values between 0 and 20. We recommend using a binary search approach
+       * to finding the optimal value for your use case. Speech recognition
+       * will skip PhraseSets with a boost value of 0.
+       * 
+ * + * float boost = 2; + * + * @param value The boost to set. + * @return This builder for chaining. + */ + public Builder setBoost(float value) { + + boost_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Hint Boost. Overrides the boost set at the phrase set level.
+       * Positive value will increase the probability that a specific phrase will
+       * be recognized over other similar sounding phrases. The higher the boost,
+       * the higher the chance of false positive recognition as well. Negative
+       * boost values would correspond to anti-biasing. Anti-biasing is not
+       * enabled, so negative boost will simply be ignored. Though `boost` can
+       * accept a wide range of positive values, most use cases are best served
+       * with values between 0 and 20. We recommend using a binary search approach
+       * to finding the optimal value for your use case. Speech recognition
+       * will skip PhraseSets with a boost value of 0.
+       * 
+ * + * float boost = 2; + * + * @return This builder for chaining. + */ + public Builder clearBoost() { + + boost_ = 0F; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.PhraseSet.Phrase) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.PhraseSet.Phrase) + private static final com.google.cloud.speech.v2.PhraseSet.Phrase DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.PhraseSet.Phrase(); + } + + public static com.google.cloud.speech.v2.PhraseSet.Phrase getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Phrase parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Phrase(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.Phrase getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. The resource name of the PhraseSet.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The resource name of the PhraseSet.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. System-assigned unique identifier for the PhraseSet.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. System-assigned unique identifier for the PhraseSet.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PHRASES_FIELD_NUMBER = 3; + private java.util.List phrases_; + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + @java.lang.Override + public java.util.List getPhrasesList() { + return phrases_; + } + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + @java.lang.Override + public java.util.List + getPhrasesOrBuilderList() { + return phrases_; + } + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + @java.lang.Override + public int getPhrasesCount() { + return phrases_.size(); + } + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.Phrase getPhrases(int index) { + return phrases_.get(index); + } + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.PhraseOrBuilder getPhrasesOrBuilder(int index) { + return phrases_.get(index); + } + + public static final int BOOST_FIELD_NUMBER = 4; + private float boost_; + /** + * + * + *
+   * Hint Boost. Positive value will increase the probability that a specific
+   * phrase will be recognized over other similar sounding phrases. The higher
+   * the boost, the higher the chance of false positive recognition as well.
+   * Valid `boost` values are between 0 (exclusive) and 20. We recommend using a
+   * binary search approach to finding the optimal value for your use case.
+   * 
+ * + * float boost = 4; + * + * @return The boost. + */ + @java.lang.Override + public float getBoost() { + return boost_; + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 5; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * User-settable, human-readable name for the PhraseSet. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 5; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * User-settable, human-readable name for the PhraseSet. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 5; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATE_FIELD_NUMBER = 15; + private int state_; + /** + * + * + *
+   * Output only. The PhraseSet lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Output only. The PhraseSet lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.PhraseSet.State result = + com.google.cloud.speech.v2.PhraseSet.State.valueOf(state_); + return result == null ? com.google.cloud.speech.v2.PhraseSet.State.UNRECOGNIZED : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int EXPIRE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 10; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ETAG_FIELD_NUMBER = 11; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int RECONCILING_FIELD_NUMBER = 12; + private boolean reconciling_; + /** + * + * + *
+   * Output only. Whether or not this PhraseSet is in the process of being
+   * updated.
+   * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + + public static final int KMS_KEY_NAME_FIELD_NUMBER = 13; + private volatile java.lang.Object kmsKeyName_; + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + @java.lang.Override + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KMS_KEY_VERSION_NAME_FIELD_NUMBER = 14; + private volatile java.lang.Object kmsKeyVersionName_; + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + @java.lang.Override + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + for (int i = 0; i < phrases_.size(); i++) { + output.writeMessage(3, phrases_.get(i)); + } + if (java.lang.Float.floatToRawIntBits(boost_) != 0) { + output.writeFloat(4, boost_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, displayName_); + } + if (createTime_ != null) { + output.writeMessage(6, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(7, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(8, getDeleteTime()); + } + if (expireTime_ != null) { + output.writeMessage(9, getExpireTime()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 10); + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, etag_); + } + if (reconciling_ != false) { + output.writeBool(12, reconciling_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 13, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 14, kmsKeyVersionName_); + } + if (state_ != com.google.cloud.speech.v2.PhraseSet.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(15, state_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + for (int i = 0; i < phrases_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, phrases_.get(i)); + } + if (java.lang.Float.floatToRawIntBits(boost_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, boost_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, displayName_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getDeleteTime()); + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getExpireTime()); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, annotations__); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, etag_); + } + if (reconciling_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(12, reconciling_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, kmsKeyVersionName_); + } + if (state_ != com.google.cloud.speech.v2.PhraseSet.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(15, state_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.PhraseSet)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.PhraseSet other = (com.google.cloud.speech.v2.PhraseSet) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (!getPhrasesList().equals(other.getPhrasesList())) return false; + if (java.lang.Float.floatToIntBits(getBoost()) + != java.lang.Float.floatToIntBits(other.getBoost())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (state_ != other.state_) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (getReconciling() != other.getReconciling()) return false; + if (!getKmsKeyName().equals(other.getKmsKeyName())) return false; + if (!getKmsKeyVersionName().equals(other.getKmsKeyVersionName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + if (getPhrasesCount() > 0) { + hash = (37 * hash) + PHRASES_FIELD_NUMBER; + hash = (53 * hash) + getPhrasesList().hashCode(); + } + hash = (37 * hash) + BOOST_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getBoost()); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (37 * hash) + RECONCILING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReconciling()); + hash = (37 * hash) + KMS_KEY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyName().hashCode(); + hash = (37 * hash) + KMS_KEY_VERSION_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyVersionName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.PhraseSet parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.PhraseSet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.PhraseSet prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
+   * "hints" to the speech recognizer to favor specific words and phrases in the
+   * results.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.PhraseSet} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.PhraseSet) + com.google.cloud.speech.v2.PhraseSetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 10: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.PhraseSet.class, + com.google.cloud.speech.v2.PhraseSet.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.PhraseSet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getPhrasesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + if (phrasesBuilder_ == null) { + phrases_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + phrasesBuilder_.clear(); + } + boost_ = 0F; + + displayName_ = ""; + + state_ = 0; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + internalGetMutableAnnotations().clear(); + etag_ = ""; + + reconciling_ = false; + + kmsKeyName_ = ""; + + kmsKeyVersionName_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_PhraseSet_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet getDefaultInstanceForType() { + return com.google.cloud.speech.v2.PhraseSet.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet build() { + com.google.cloud.speech.v2.PhraseSet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet buildPartial() { + com.google.cloud.speech.v2.PhraseSet result = new com.google.cloud.speech.v2.PhraseSet(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + if (phrasesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + phrases_ = java.util.Collections.unmodifiableList(phrases_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.phrases_ = phrases_; + } else { + result.phrases_ = phrasesBuilder_.build(); + } + result.boost_ = boost_; + result.displayName_ = displayName_; + result.state_ = state_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + result.etag_ = etag_; + result.reconciling_ = reconciling_; + result.kmsKeyName_ = kmsKeyName_; + result.kmsKeyVersionName_ = kmsKeyVersionName_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.PhraseSet) { + return mergeFrom((com.google.cloud.speech.v2.PhraseSet) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.PhraseSet other) { + if (other == com.google.cloud.speech.v2.PhraseSet.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (phrasesBuilder_ == null) { + if (!other.phrases_.isEmpty()) { + if (phrases_.isEmpty()) { + phrases_ = other.phrases_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePhrasesIsMutable(); + phrases_.addAll(other.phrases_); + } + onChanged(); + } + } else { + if (!other.phrases_.isEmpty()) { + if (phrasesBuilder_.isEmpty()) { + phrasesBuilder_.dispose(); + phrasesBuilder_ = null; + phrases_ = other.phrases_; + bitField0_ = (bitField0_ & ~0x00000001); + phrasesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getPhrasesFieldBuilder() + : null; + } else { + phrasesBuilder_.addAllMessages(other.phrases_); + } + } + } + if (other.getBoost() != 0F) { + setBoost(other.getBoost()); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + if (other.getReconciling() != false) { + setReconciling(other.getReconciling()); + } + if (!other.getKmsKeyName().isEmpty()) { + kmsKeyName_ = other.kmsKeyName_; + onChanged(); + } + if (!other.getKmsKeyVersionName().isEmpty()) { + kmsKeyVersionName_ = other.kmsKeyVersionName_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.PhraseSet parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.PhraseSet) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The resource name of the PhraseSet.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the PhraseSet.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the PhraseSet.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the PhraseSet.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the PhraseSet.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. System-assigned unique identifier for the PhraseSet.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the PhraseSet.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the PhraseSet.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the PhraseSet.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the PhraseSet.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private java.util.List phrases_ = + java.util.Collections.emptyList(); + + private void ensurePhrasesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + phrases_ = new java.util.ArrayList(phrases_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet.Phrase, + com.google.cloud.speech.v2.PhraseSet.Phrase.Builder, + com.google.cloud.speech.v2.PhraseSet.PhraseOrBuilder> + phrasesBuilder_; + + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public java.util.List getPhrasesList() { + if (phrasesBuilder_ == null) { + return java.util.Collections.unmodifiableList(phrases_); + } else { + return phrasesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public int getPhrasesCount() { + if (phrasesBuilder_ == null) { + return phrases_.size(); + } else { + return phrasesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public com.google.cloud.speech.v2.PhraseSet.Phrase getPhrases(int index) { + if (phrasesBuilder_ == null) { + return phrases_.get(index); + } else { + return phrasesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder setPhrases(int index, com.google.cloud.speech.v2.PhraseSet.Phrase value) { + if (phrasesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhrasesIsMutable(); + phrases_.set(index, value); + onChanged(); + } else { + phrasesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder setPhrases( + int index, com.google.cloud.speech.v2.PhraseSet.Phrase.Builder builderForValue) { + if (phrasesBuilder_ == null) { + ensurePhrasesIsMutable(); + phrases_.set(index, builderForValue.build()); + onChanged(); + } else { + phrasesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder addPhrases(com.google.cloud.speech.v2.PhraseSet.Phrase value) { + if (phrasesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhrasesIsMutable(); + phrases_.add(value); + onChanged(); + } else { + phrasesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder addPhrases(int index, com.google.cloud.speech.v2.PhraseSet.Phrase value) { + if (phrasesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhrasesIsMutable(); + phrases_.add(index, value); + onChanged(); + } else { + phrasesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder addPhrases(com.google.cloud.speech.v2.PhraseSet.Phrase.Builder builderForValue) { + if (phrasesBuilder_ == null) { + ensurePhrasesIsMutable(); + phrases_.add(builderForValue.build()); + onChanged(); + } else { + phrasesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder addPhrases( + int index, com.google.cloud.speech.v2.PhraseSet.Phrase.Builder builderForValue) { + if (phrasesBuilder_ == null) { + ensurePhrasesIsMutable(); + phrases_.add(index, builderForValue.build()); + onChanged(); + } else { + phrasesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder addAllPhrases( + java.lang.Iterable values) { + if (phrasesBuilder_ == null) { + ensurePhrasesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, phrases_); + onChanged(); + } else { + phrasesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder clearPhrases() { + if (phrasesBuilder_ == null) { + phrases_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + phrasesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public Builder removePhrases(int index) { + if (phrasesBuilder_ == null) { + ensurePhrasesIsMutable(); + phrases_.remove(index); + onChanged(); + } else { + phrasesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public com.google.cloud.speech.v2.PhraseSet.Phrase.Builder getPhrasesBuilder(int index) { + return getPhrasesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public com.google.cloud.speech.v2.PhraseSet.PhraseOrBuilder getPhrasesOrBuilder(int index) { + if (phrasesBuilder_ == null) { + return phrases_.get(index); + } else { + return phrasesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public java.util.List + getPhrasesOrBuilderList() { + if (phrasesBuilder_ != null) { + return phrasesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(phrases_); + } + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public com.google.cloud.speech.v2.PhraseSet.Phrase.Builder addPhrasesBuilder() { + return getPhrasesFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.PhraseSet.Phrase.getDefaultInstance()); + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public com.google.cloud.speech.v2.PhraseSet.Phrase.Builder addPhrasesBuilder(int index) { + return getPhrasesFieldBuilder() + .addBuilder(index, com.google.cloud.speech.v2.PhraseSet.Phrase.getDefaultInstance()); + } + /** + * + * + *
+     * A list of word and phrases.
+     * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + public java.util.List + getPhrasesBuilderList() { + return getPhrasesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet.Phrase, + com.google.cloud.speech.v2.PhraseSet.Phrase.Builder, + com.google.cloud.speech.v2.PhraseSet.PhraseOrBuilder> + getPhrasesFieldBuilder() { + if (phrasesBuilder_ == null) { + phrasesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet.Phrase, + com.google.cloud.speech.v2.PhraseSet.Phrase.Builder, + com.google.cloud.speech.v2.PhraseSet.PhraseOrBuilder>( + phrases_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + phrases_ = null; + } + return phrasesBuilder_; + } + + private float boost_; + /** + * + * + *
+     * Hint Boost. Positive value will increase the probability that a specific
+     * phrase will be recognized over other similar sounding phrases. The higher
+     * the boost, the higher the chance of false positive recognition as well.
+     * Valid `boost` values are between 0 (exclusive) and 20. We recommend using a
+     * binary search approach to finding the optimal value for your use case.
+     * 
+ * + * float boost = 4; + * + * @return The boost. + */ + @java.lang.Override + public float getBoost() { + return boost_; + } + /** + * + * + *
+     * Hint Boost. Positive value will increase the probability that a specific
+     * phrase will be recognized over other similar sounding phrases. The higher
+     * the boost, the higher the chance of false positive recognition as well.
+     * Valid `boost` values are between 0 (exclusive) and 20. We recommend using a
+     * binary search approach to finding the optimal value for your use case.
+     * 
+ * + * float boost = 4; + * + * @param value The boost to set. + * @return This builder for chaining. + */ + public Builder setBoost(float value) { + + boost_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Hint Boost. Positive value will increase the probability that a specific
+     * phrase will be recognized over other similar sounding phrases. The higher
+     * the boost, the higher the chance of false positive recognition as well.
+     * Valid `boost` values are between 0 (exclusive) and 20. We recommend using a
+     * binary search approach to finding the optimal value for your use case.
+     * 
+ * + * float boost = 4; + * + * @return This builder for chaining. + */ + public Builder clearBoost() { + + boost_ = 0F; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * User-settable, human-readable name for the PhraseSet. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 5; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User-settable, human-readable name for the PhraseSet. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 5; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User-settable, human-readable name for the PhraseSet. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 5; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User-settable, human-readable name for the PhraseSet. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 5; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * User-settable, human-readable name for the PhraseSet. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 5; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * Output only. The PhraseSet lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Output only. The PhraseSet lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The PhraseSet lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.PhraseSet.State result = + com.google.cloud.speech.v2.PhraseSet.State.valueOf(state_); + return result == null ? com.google.cloud.speech.v2.PhraseSet.State.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Output only. The PhraseSet lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.cloud.speech.v2.PhraseSet.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The PhraseSet lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The most recent time this resource was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. The time at which this resource was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_).mergeFrom(value).buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+     * Output only. The time at which this resource will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 10; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + private boolean reconciling_; + /** + * + * + *
+     * Output only. Whether or not this PhraseSet is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + /** + * + * + *
+     * Output only. Whether or not this PhraseSet is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The reconciling to set. + * @return This builder for chaining. + */ + public Builder setReconciling(boolean value) { + + reconciling_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Whether or not this PhraseSet is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearReconciling() { + + reconciling_ = false; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyName_ = ""; + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyName() { + + kmsKeyName_ = getDefaultInstance().getKmsKeyName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyName_ = value; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyVersionName_ = ""; + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyVersionName() { + + kmsKeyVersionName_ = getDefaultInstance().getKmsKeyVersionName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the PhraseSet is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.PhraseSet) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.PhraseSet) + private static final com.google.cloud.speech.v2.PhraseSet DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.PhraseSet(); + } + + public static com.google.cloud.speech.v2.PhraseSet getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PhraseSet parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PhraseSet(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetName.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetName.java new file mode 100644 index 000000000000..1600db0e2476 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetName.java @@ -0,0 +1,223 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class PhraseSetName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_PHRASE_SET = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/phraseSets/{phrase_set}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String phraseSet; + + @Deprecated + protected PhraseSetName() { + project = null; + location = null; + phraseSet = null; + } + + private PhraseSetName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + phraseSet = Preconditions.checkNotNull(builder.getPhraseSet()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getPhraseSet() { + return phraseSet; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static PhraseSetName of(String project, String location, String phraseSet) { + return newBuilder().setProject(project).setLocation(location).setPhraseSet(phraseSet).build(); + } + + public static String format(String project, String location, String phraseSet) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setPhraseSet(phraseSet) + .build() + .toString(); + } + + public static PhraseSetName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_PHRASE_SET.validatedMatch( + formattedString, "PhraseSetName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("phrase_set")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (PhraseSetName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_PHRASE_SET.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (phraseSet != null) { + fieldMapBuilder.put("phrase_set", phraseSet); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_PHRASE_SET.instantiate( + "project", project, "location", location, "phrase_set", phraseSet); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + PhraseSetName that = ((PhraseSetName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.phraseSet, that.phraseSet); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(phraseSet); + return h; + } + + /** Builder for projects/{project}/locations/{location}/phraseSets/{phrase_set}. */ + public static class Builder { + private String project; + private String location; + private String phraseSet; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getPhraseSet() { + return phraseSet; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setPhraseSet(String phraseSet) { + this.phraseSet = phraseSet; + return this; + } + + private Builder(PhraseSetName phraseSetName) { + this.project = phraseSetName.project; + this.location = phraseSetName.location; + this.phraseSet = phraseSetName.phraseSet; + } + + public PhraseSetName build() { + return new PhraseSetName(this); + } + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetOrBuilder.java new file mode 100644 index 000000000000..5988cccfa92b --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/PhraseSetOrBuilder.java @@ -0,0 +1,536 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface PhraseSetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.PhraseSet) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The resource name of the PhraseSet.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The resource name of the PhraseSet.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. System-assigned unique identifier for the PhraseSet.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. System-assigned unique identifier for the PhraseSet.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + java.util.List getPhrasesList(); + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + com.google.cloud.speech.v2.PhraseSet.Phrase getPhrases(int index); + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + int getPhrasesCount(); + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + java.util.List + getPhrasesOrBuilderList(); + /** + * + * + *
+   * A list of word and phrases.
+   * 
+ * + * repeated .google.cloud.speech.v2.PhraseSet.Phrase phrases = 3; + */ + com.google.cloud.speech.v2.PhraseSet.PhraseOrBuilder getPhrasesOrBuilder(int index); + + /** + * + * + *
+   * Hint Boost. Positive value will increase the probability that a specific
+   * phrase will be recognized over other similar sounding phrases. The higher
+   * the boost, the higher the chance of false positive recognition as well.
+   * Valid `boost` values are between 0 (exclusive) and 20. We recommend using a
+   * binary search approach to finding the optimal value for your use case.
+   * 
+ * + * float boost = 4; + * + * @return The boost. + */ + float getBoost(); + + /** + * + * + *
+   * User-settable, human-readable name for the PhraseSet. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 5; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * User-settable, human-readable name for the PhraseSet. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 5; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Output only. The PhraseSet lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Output only. The PhraseSet lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet.State state = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.cloud.speech.v2.PhraseSet.State getState(); + + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this resource was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. The time at which this resource was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+   * Output only. The time at which this resource will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 10; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); + + /** + * + * + *
+   * Output only. Whether or not this PhraseSet is in the process of being
+   * updated.
+   * 
+ * + * bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + boolean getReconciling(); + + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + java.lang.String getKmsKeyName(); + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + com.google.protobuf.ByteString getKmsKeyNameBytes(); + + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + java.lang.String getKmsKeyVersionName(); + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the PhraseSet is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + com.google.protobuf.ByteString getKmsKeyVersionNameBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfig.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfig.java new file mode 100644 index 000000000000..0f14c50bdc99 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfig.java @@ -0,0 +1,1758 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Provides information to the Recognizer that specifies how to process the
+ * recognition request.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognitionConfig} + */ +public final class RecognitionConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.RecognitionConfig) + RecognitionConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use RecognitionConfig.newBuilder() to construct. + private RecognitionConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RecognitionConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RecognitionConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RecognitionConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + com.google.cloud.speech.v2.RecognitionFeatures.Builder subBuilder = null; + if (features_ != null) { + subBuilder = features_.toBuilder(); + } + features_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionFeatures.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(features_); + features_ = subBuilder.buildPartial(); + } + + break; + } + case 50: + { + com.google.cloud.speech.v2.SpeechAdaptation.Builder subBuilder = null; + if (adaptation_ != null) { + subBuilder = adaptation_.toBuilder(); + } + adaptation_ = + input.readMessage( + com.google.cloud.speech.v2.SpeechAdaptation.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(adaptation_); + adaptation_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder subBuilder = null; + if (decodingConfigCase_ == 7) { + subBuilder = + ((com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_) + .toBuilder(); + } + decodingConfig_ = + input.readMessage( + com.google.cloud.speech.v2.AutoDetectDecodingConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_); + decodingConfig_ = subBuilder.buildPartial(); + } + decodingConfigCase_ = 7; + break; + } + case 66: + { + com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder subBuilder = null; + if (decodingConfigCase_ == 8) { + subBuilder = + ((com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_) + .toBuilder(); + } + decodingConfig_ = + input.readMessage( + com.google.cloud.speech.v2.ExplicitDecodingConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_); + decodingConfig_ = subBuilder.buildPartial(); + } + decodingConfigCase_ = 8; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognitionConfig.class, + com.google.cloud.speech.v2.RecognitionConfig.Builder.class); + } + + private int decodingConfigCase_ = 0; + private java.lang.Object decodingConfig_; + + public enum DecodingConfigCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + AUTO_DECODING_CONFIG(7), + EXPLICIT_DECODING_CONFIG(8), + DECODINGCONFIG_NOT_SET(0); + private final int value; + + private DecodingConfigCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DecodingConfigCase valueOf(int value) { + return forNumber(value); + } + + public static DecodingConfigCase forNumber(int value) { + switch (value) { + case 7: + return AUTO_DECODING_CONFIG; + case 8: + return EXPLICIT_DECODING_CONFIG; + case 0: + return DECODINGCONFIG_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public DecodingConfigCase getDecodingConfigCase() { + return DecodingConfigCase.forNumber(decodingConfigCase_); + } + + public static final int AUTO_DECODING_CONFIG_FIELD_NUMBER = 7; + /** + * + * + *
+   * Automatically detect decoding parameters.
+   * Preferred for supported formats.
+   * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + * + * @return Whether the autoDecodingConfig field is set. + */ + @java.lang.Override + public boolean hasAutoDecodingConfig() { + return decodingConfigCase_ == 7; + } + /** + * + * + *
+   * Automatically detect decoding parameters.
+   * Preferred for supported formats.
+   * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + * + * @return The autoDecodingConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfig getAutoDecodingConfig() { + if (decodingConfigCase_ == 7) { + return (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance(); + } + /** + * + * + *
+   * Automatically detect decoding parameters.
+   * Preferred for supported formats.
+   * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfigOrBuilder + getAutoDecodingConfigOrBuilder() { + if (decodingConfigCase_ == 7) { + return (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance(); + } + + public static final int EXPLICIT_DECODING_CONFIG_FIELD_NUMBER = 8; + /** + * + * + *
+   * Explicitly specified decoding parameters.
+   * Required if using headerless PCM audio (linear16, mulaw, alaw).
+   * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + * + * @return Whether the explicitDecodingConfig field is set. + */ + @java.lang.Override + public boolean hasExplicitDecodingConfig() { + return decodingConfigCase_ == 8; + } + /** + * + * + *
+   * Explicitly specified decoding parameters.
+   * Required if using headerless PCM audio (linear16, mulaw, alaw).
+   * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + * + * @return The explicitDecodingConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig getExplicitDecodingConfig() { + if (decodingConfigCase_ == 8) { + return (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance(); + } + /** + * + * + *
+   * Explicitly specified decoding parameters.
+   * Required if using headerless PCM audio (linear16, mulaw, alaw).
+   * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfigOrBuilder + getExplicitDecodingConfigOrBuilder() { + if (decodingConfigCase_ == 8) { + return (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance(); + } + + public static final int FEATURES_FIELD_NUMBER = 2; + private com.google.cloud.speech.v2.RecognitionFeatures features_; + /** + * + * + *
+   * Speech recognition features to enable.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + * + * @return Whether the features field is set. + */ + @java.lang.Override + public boolean hasFeatures() { + return features_ != null; + } + /** + * + * + *
+   * Speech recognition features to enable.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + * + * @return The features. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeatures getFeatures() { + return features_ == null + ? com.google.cloud.speech.v2.RecognitionFeatures.getDefaultInstance() + : features_; + } + /** + * + * + *
+   * Speech recognition features to enable.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeaturesOrBuilder getFeaturesOrBuilder() { + return getFeatures(); + } + + public static final int ADAPTATION_FIELD_NUMBER = 6; + private com.google.cloud.speech.v2.SpeechAdaptation adaptation_; + /** + * + * + *
+   * Speech adaptation context that weights recognizer predictions for specific
+   * words and phrases.
+   * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + * + * @return Whether the adaptation field is set. + */ + @java.lang.Override + public boolean hasAdaptation() { + return adaptation_ != null; + } + /** + * + * + *
+   * Speech adaptation context that weights recognizer predictions for specific
+   * words and phrases.
+   * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + * + * @return The adaptation. + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation getAdaptation() { + return adaptation_ == null + ? com.google.cloud.speech.v2.SpeechAdaptation.getDefaultInstance() + : adaptation_; + } + /** + * + * + *
+   * Speech adaptation context that weights recognizer predictions for specific
+   * words and phrases.
+   * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptationOrBuilder getAdaptationOrBuilder() { + return getAdaptation(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (features_ != null) { + output.writeMessage(2, getFeatures()); + } + if (adaptation_ != null) { + output.writeMessage(6, getAdaptation()); + } + if (decodingConfigCase_ == 7) { + output.writeMessage(7, (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_); + } + if (decodingConfigCase_ == 8) { + output.writeMessage(8, (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (features_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getFeatures()); + } + if (adaptation_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getAdaptation()); + } + if (decodingConfigCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_); + } + if (decodingConfigCase_ == 8) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 8, (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.RecognitionConfig)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.RecognitionConfig other = + (com.google.cloud.speech.v2.RecognitionConfig) obj; + + if (hasFeatures() != other.hasFeatures()) return false; + if (hasFeatures()) { + if (!getFeatures().equals(other.getFeatures())) return false; + } + if (hasAdaptation() != other.hasAdaptation()) return false; + if (hasAdaptation()) { + if (!getAdaptation().equals(other.getAdaptation())) return false; + } + if (!getDecodingConfigCase().equals(other.getDecodingConfigCase())) return false; + switch (decodingConfigCase_) { + case 7: + if (!getAutoDecodingConfig().equals(other.getAutoDecodingConfig())) return false; + break; + case 8: + if (!getExplicitDecodingConfig().equals(other.getExplicitDecodingConfig())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasFeatures()) { + hash = (37 * hash) + FEATURES_FIELD_NUMBER; + hash = (53 * hash) + getFeatures().hashCode(); + } + if (hasAdaptation()) { + hash = (37 * hash) + ADAPTATION_FIELD_NUMBER; + hash = (53 * hash) + getAdaptation().hashCode(); + } + switch (decodingConfigCase_) { + case 7: + hash = (37 * hash) + AUTO_DECODING_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAutoDecodingConfig().hashCode(); + break; + case 8: + hash = (37 * hash) + EXPLICIT_DECODING_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getExplicitDecodingConfig().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.RecognitionConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Provides information to the Recognizer that specifies how to process the
+   * recognition request.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognitionConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.RecognitionConfig) + com.google.cloud.speech.v2.RecognitionConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognitionConfig.class, + com.google.cloud.speech.v2.RecognitionConfig.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.RecognitionConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (featuresBuilder_ == null) { + features_ = null; + } else { + features_ = null; + featuresBuilder_ = null; + } + if (adaptationBuilder_ == null) { + adaptation_ = null; + } else { + adaptation_ = null; + adaptationBuilder_ = null; + } + decodingConfigCase_ = 0; + decodingConfig_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig getDefaultInstanceForType() { + return com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig build() { + com.google.cloud.speech.v2.RecognitionConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig buildPartial() { + com.google.cloud.speech.v2.RecognitionConfig result = + new com.google.cloud.speech.v2.RecognitionConfig(this); + if (decodingConfigCase_ == 7) { + if (autoDecodingConfigBuilder_ == null) { + result.decodingConfig_ = decodingConfig_; + } else { + result.decodingConfig_ = autoDecodingConfigBuilder_.build(); + } + } + if (decodingConfigCase_ == 8) { + if (explicitDecodingConfigBuilder_ == null) { + result.decodingConfig_ = decodingConfig_; + } else { + result.decodingConfig_ = explicitDecodingConfigBuilder_.build(); + } + } + if (featuresBuilder_ == null) { + result.features_ = features_; + } else { + result.features_ = featuresBuilder_.build(); + } + if (adaptationBuilder_ == null) { + result.adaptation_ = adaptation_; + } else { + result.adaptation_ = adaptationBuilder_.build(); + } + result.decodingConfigCase_ = decodingConfigCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.RecognitionConfig) { + return mergeFrom((com.google.cloud.speech.v2.RecognitionConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.RecognitionConfig other) { + if (other == com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance()) return this; + if (other.hasFeatures()) { + mergeFeatures(other.getFeatures()); + } + if (other.hasAdaptation()) { + mergeAdaptation(other.getAdaptation()); + } + switch (other.getDecodingConfigCase()) { + case AUTO_DECODING_CONFIG: + { + mergeAutoDecodingConfig(other.getAutoDecodingConfig()); + break; + } + case EXPLICIT_DECODING_CONFIG: + { + mergeExplicitDecodingConfig(other.getExplicitDecodingConfig()); + break; + } + case DECODINGCONFIG_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.RecognitionConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.RecognitionConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int decodingConfigCase_ = 0; + private java.lang.Object decodingConfig_; + + public DecodingConfigCase getDecodingConfigCase() { + return DecodingConfigCase.forNumber(decodingConfigCase_); + } + + public Builder clearDecodingConfig() { + decodingConfigCase_ = 0; + decodingConfig_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.AutoDetectDecodingConfig, + com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder, + com.google.cloud.speech.v2.AutoDetectDecodingConfigOrBuilder> + autoDecodingConfigBuilder_; + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + * + * @return Whether the autoDecodingConfig field is set. + */ + @java.lang.Override + public boolean hasAutoDecodingConfig() { + return decodingConfigCase_ == 7; + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + * + * @return The autoDecodingConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfig getAutoDecodingConfig() { + if (autoDecodingConfigBuilder_ == null) { + if (decodingConfigCase_ == 7) { + return (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance(); + } else { + if (decodingConfigCase_ == 7) { + return autoDecodingConfigBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + public Builder setAutoDecodingConfig( + com.google.cloud.speech.v2.AutoDetectDecodingConfig value) { + if (autoDecodingConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + decodingConfig_ = value; + onChanged(); + } else { + autoDecodingConfigBuilder_.setMessage(value); + } + decodingConfigCase_ = 7; + return this; + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + public Builder setAutoDecodingConfig( + com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder builderForValue) { + if (autoDecodingConfigBuilder_ == null) { + decodingConfig_ = builderForValue.build(); + onChanged(); + } else { + autoDecodingConfigBuilder_.setMessage(builderForValue.build()); + } + decodingConfigCase_ = 7; + return this; + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + public Builder mergeAutoDecodingConfig( + com.google.cloud.speech.v2.AutoDetectDecodingConfig value) { + if (autoDecodingConfigBuilder_ == null) { + if (decodingConfigCase_ == 7 + && decodingConfig_ + != com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance()) { + decodingConfig_ = + com.google.cloud.speech.v2.AutoDetectDecodingConfig.newBuilder( + (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + decodingConfig_ = value; + } + onChanged(); + } else { + if (decodingConfigCase_ == 7) { + autoDecodingConfigBuilder_.mergeFrom(value); + } else { + autoDecodingConfigBuilder_.setMessage(value); + } + } + decodingConfigCase_ = 7; + return this; + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + public Builder clearAutoDecodingConfig() { + if (autoDecodingConfigBuilder_ == null) { + if (decodingConfigCase_ == 7) { + decodingConfigCase_ = 0; + decodingConfig_ = null; + onChanged(); + } + } else { + if (decodingConfigCase_ == 7) { + decodingConfigCase_ = 0; + decodingConfig_ = null; + } + autoDecodingConfigBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + public com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder + getAutoDecodingConfigBuilder() { + return getAutoDecodingConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + @java.lang.Override + public com.google.cloud.speech.v2.AutoDetectDecodingConfigOrBuilder + getAutoDecodingConfigOrBuilder() { + if ((decodingConfigCase_ == 7) && (autoDecodingConfigBuilder_ != null)) { + return autoDecodingConfigBuilder_.getMessageOrBuilder(); + } else { + if (decodingConfigCase_ == 7) { + return (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * Automatically detect decoding parameters.
+     * Preferred for supported formats.
+     * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.AutoDetectDecodingConfig, + com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder, + com.google.cloud.speech.v2.AutoDetectDecodingConfigOrBuilder> + getAutoDecodingConfigFieldBuilder() { + if (autoDecodingConfigBuilder_ == null) { + if (!(decodingConfigCase_ == 7)) { + decodingConfig_ = + com.google.cloud.speech.v2.AutoDetectDecodingConfig.getDefaultInstance(); + } + autoDecodingConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.AutoDetectDecodingConfig, + com.google.cloud.speech.v2.AutoDetectDecodingConfig.Builder, + com.google.cloud.speech.v2.AutoDetectDecodingConfigOrBuilder>( + (com.google.cloud.speech.v2.AutoDetectDecodingConfig) decodingConfig_, + getParentForChildren(), + isClean()); + decodingConfig_ = null; + } + decodingConfigCase_ = 7; + onChanged(); + ; + return autoDecodingConfigBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.ExplicitDecodingConfig, + com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder, + com.google.cloud.speech.v2.ExplicitDecodingConfigOrBuilder> + explicitDecodingConfigBuilder_; + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + * + * @return Whether the explicitDecodingConfig field is set. + */ + @java.lang.Override + public boolean hasExplicitDecodingConfig() { + return decodingConfigCase_ == 8; + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + * + * @return The explicitDecodingConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfig getExplicitDecodingConfig() { + if (explicitDecodingConfigBuilder_ == null) { + if (decodingConfigCase_ == 8) { + return (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance(); + } else { + if (decodingConfigCase_ == 8) { + return explicitDecodingConfigBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + public Builder setExplicitDecodingConfig( + com.google.cloud.speech.v2.ExplicitDecodingConfig value) { + if (explicitDecodingConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + decodingConfig_ = value; + onChanged(); + } else { + explicitDecodingConfigBuilder_.setMessage(value); + } + decodingConfigCase_ = 8; + return this; + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + public Builder setExplicitDecodingConfig( + com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder builderForValue) { + if (explicitDecodingConfigBuilder_ == null) { + decodingConfig_ = builderForValue.build(); + onChanged(); + } else { + explicitDecodingConfigBuilder_.setMessage(builderForValue.build()); + } + decodingConfigCase_ = 8; + return this; + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + public Builder mergeExplicitDecodingConfig( + com.google.cloud.speech.v2.ExplicitDecodingConfig value) { + if (explicitDecodingConfigBuilder_ == null) { + if (decodingConfigCase_ == 8 + && decodingConfig_ + != com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance()) { + decodingConfig_ = + com.google.cloud.speech.v2.ExplicitDecodingConfig.newBuilder( + (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + decodingConfig_ = value; + } + onChanged(); + } else { + if (decodingConfigCase_ == 8) { + explicitDecodingConfigBuilder_.mergeFrom(value); + } else { + explicitDecodingConfigBuilder_.setMessage(value); + } + } + decodingConfigCase_ = 8; + return this; + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + public Builder clearExplicitDecodingConfig() { + if (explicitDecodingConfigBuilder_ == null) { + if (decodingConfigCase_ == 8) { + decodingConfigCase_ = 0; + decodingConfig_ = null; + onChanged(); + } + } else { + if (decodingConfigCase_ == 8) { + decodingConfigCase_ = 0; + decodingConfig_ = null; + } + explicitDecodingConfigBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + public com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder + getExplicitDecodingConfigBuilder() { + return getExplicitDecodingConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + @java.lang.Override + public com.google.cloud.speech.v2.ExplicitDecodingConfigOrBuilder + getExplicitDecodingConfigOrBuilder() { + if ((decodingConfigCase_ == 8) && (explicitDecodingConfigBuilder_ != null)) { + return explicitDecodingConfigBuilder_.getMessageOrBuilder(); + } else { + if (decodingConfigCase_ == 8) { + return (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_; + } + return com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * Explicitly specified decoding parameters.
+     * Required if using headerless PCM audio (linear16, mulaw, alaw).
+     * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.ExplicitDecodingConfig, + com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder, + com.google.cloud.speech.v2.ExplicitDecodingConfigOrBuilder> + getExplicitDecodingConfigFieldBuilder() { + if (explicitDecodingConfigBuilder_ == null) { + if (!(decodingConfigCase_ == 8)) { + decodingConfig_ = com.google.cloud.speech.v2.ExplicitDecodingConfig.getDefaultInstance(); + } + explicitDecodingConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.ExplicitDecodingConfig, + com.google.cloud.speech.v2.ExplicitDecodingConfig.Builder, + com.google.cloud.speech.v2.ExplicitDecodingConfigOrBuilder>( + (com.google.cloud.speech.v2.ExplicitDecodingConfig) decodingConfig_, + getParentForChildren(), + isClean()); + decodingConfig_ = null; + } + decodingConfigCase_ = 8; + onChanged(); + ; + return explicitDecodingConfigBuilder_; + } + + private com.google.cloud.speech.v2.RecognitionFeatures features_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionFeatures, + com.google.cloud.speech.v2.RecognitionFeatures.Builder, + com.google.cloud.speech.v2.RecognitionFeaturesOrBuilder> + featuresBuilder_; + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + * + * @return Whether the features field is set. + */ + public boolean hasFeatures() { + return featuresBuilder_ != null || features_ != null; + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + * + * @return The features. + */ + public com.google.cloud.speech.v2.RecognitionFeatures getFeatures() { + if (featuresBuilder_ == null) { + return features_ == null + ? com.google.cloud.speech.v2.RecognitionFeatures.getDefaultInstance() + : features_; + } else { + return featuresBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + public Builder setFeatures(com.google.cloud.speech.v2.RecognitionFeatures value) { + if (featuresBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + features_ = value; + onChanged(); + } else { + featuresBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + public Builder setFeatures( + com.google.cloud.speech.v2.RecognitionFeatures.Builder builderForValue) { + if (featuresBuilder_ == null) { + features_ = builderForValue.build(); + onChanged(); + } else { + featuresBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + public Builder mergeFeatures(com.google.cloud.speech.v2.RecognitionFeatures value) { + if (featuresBuilder_ == null) { + if (features_ != null) { + features_ = + com.google.cloud.speech.v2.RecognitionFeatures.newBuilder(features_) + .mergeFrom(value) + .buildPartial(); + } else { + features_ = value; + } + onChanged(); + } else { + featuresBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + public Builder clearFeatures() { + if (featuresBuilder_ == null) { + features_ = null; + onChanged(); + } else { + features_ = null; + featuresBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + public com.google.cloud.speech.v2.RecognitionFeatures.Builder getFeaturesBuilder() { + + onChanged(); + return getFeaturesFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + public com.google.cloud.speech.v2.RecognitionFeaturesOrBuilder getFeaturesOrBuilder() { + if (featuresBuilder_ != null) { + return featuresBuilder_.getMessageOrBuilder(); + } else { + return features_ == null + ? com.google.cloud.speech.v2.RecognitionFeatures.getDefaultInstance() + : features_; + } + } + /** + * + * + *
+     * Speech recognition features to enable.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionFeatures, + com.google.cloud.speech.v2.RecognitionFeatures.Builder, + com.google.cloud.speech.v2.RecognitionFeaturesOrBuilder> + getFeaturesFieldBuilder() { + if (featuresBuilder_ == null) { + featuresBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionFeatures, + com.google.cloud.speech.v2.RecognitionFeatures.Builder, + com.google.cloud.speech.v2.RecognitionFeaturesOrBuilder>( + getFeatures(), getParentForChildren(), isClean()); + features_ = null; + } + return featuresBuilder_; + } + + private com.google.cloud.speech.v2.SpeechAdaptation adaptation_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.SpeechAdaptation, + com.google.cloud.speech.v2.SpeechAdaptation.Builder, + com.google.cloud.speech.v2.SpeechAdaptationOrBuilder> + adaptationBuilder_; + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + * + * @return Whether the adaptation field is set. + */ + public boolean hasAdaptation() { + return adaptationBuilder_ != null || adaptation_ != null; + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + * + * @return The adaptation. + */ + public com.google.cloud.speech.v2.SpeechAdaptation getAdaptation() { + if (adaptationBuilder_ == null) { + return adaptation_ == null + ? com.google.cloud.speech.v2.SpeechAdaptation.getDefaultInstance() + : adaptation_; + } else { + return adaptationBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + public Builder setAdaptation(com.google.cloud.speech.v2.SpeechAdaptation value) { + if (adaptationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + adaptation_ = value; + onChanged(); + } else { + adaptationBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + public Builder setAdaptation( + com.google.cloud.speech.v2.SpeechAdaptation.Builder builderForValue) { + if (adaptationBuilder_ == null) { + adaptation_ = builderForValue.build(); + onChanged(); + } else { + adaptationBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + public Builder mergeAdaptation(com.google.cloud.speech.v2.SpeechAdaptation value) { + if (adaptationBuilder_ == null) { + if (adaptation_ != null) { + adaptation_ = + com.google.cloud.speech.v2.SpeechAdaptation.newBuilder(adaptation_) + .mergeFrom(value) + .buildPartial(); + } else { + adaptation_ = value; + } + onChanged(); + } else { + adaptationBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + public Builder clearAdaptation() { + if (adaptationBuilder_ == null) { + adaptation_ = null; + onChanged(); + } else { + adaptation_ = null; + adaptationBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + public com.google.cloud.speech.v2.SpeechAdaptation.Builder getAdaptationBuilder() { + + onChanged(); + return getAdaptationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + public com.google.cloud.speech.v2.SpeechAdaptationOrBuilder getAdaptationOrBuilder() { + if (adaptationBuilder_ != null) { + return adaptationBuilder_.getMessageOrBuilder(); + } else { + return adaptation_ == null + ? com.google.cloud.speech.v2.SpeechAdaptation.getDefaultInstance() + : adaptation_; + } + } + /** + * + * + *
+     * Speech adaptation context that weights recognizer predictions for specific
+     * words and phrases.
+     * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.SpeechAdaptation, + com.google.cloud.speech.v2.SpeechAdaptation.Builder, + com.google.cloud.speech.v2.SpeechAdaptationOrBuilder> + getAdaptationFieldBuilder() { + if (adaptationBuilder_ == null) { + adaptationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.SpeechAdaptation, + com.google.cloud.speech.v2.SpeechAdaptation.Builder, + com.google.cloud.speech.v2.SpeechAdaptationOrBuilder>( + getAdaptation(), getParentForChildren(), isClean()); + adaptation_ = null; + } + return adaptationBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.RecognitionConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.RecognitionConfig) + private static final com.google.cloud.speech.v2.RecognitionConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.RecognitionConfig(); + } + + public static com.google.cloud.speech.v2.RecognitionConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RecognitionConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RecognitionConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfigOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfigOrBuilder.java new file mode 100644 index 000000000000..62221365975b --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionConfigOrBuilder.java @@ -0,0 +1,176 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface RecognitionConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.RecognitionConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Automatically detect decoding parameters.
+   * Preferred for supported formats.
+   * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + * + * @return Whether the autoDecodingConfig field is set. + */ + boolean hasAutoDecodingConfig(); + /** + * + * + *
+   * Automatically detect decoding parameters.
+   * Preferred for supported formats.
+   * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + * + * @return The autoDecodingConfig. + */ + com.google.cloud.speech.v2.AutoDetectDecodingConfig getAutoDecodingConfig(); + /** + * + * + *
+   * Automatically detect decoding parameters.
+   * Preferred for supported formats.
+   * 
+ * + * .google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7; + */ + com.google.cloud.speech.v2.AutoDetectDecodingConfigOrBuilder getAutoDecodingConfigOrBuilder(); + + /** + * + * + *
+   * Explicitly specified decoding parameters.
+   * Required if using headerless PCM audio (linear16, mulaw, alaw).
+   * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + * + * @return Whether the explicitDecodingConfig field is set. + */ + boolean hasExplicitDecodingConfig(); + /** + * + * + *
+   * Explicitly specified decoding parameters.
+   * Required if using headerless PCM audio (linear16, mulaw, alaw).
+   * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + * + * @return The explicitDecodingConfig. + */ + com.google.cloud.speech.v2.ExplicitDecodingConfig getExplicitDecodingConfig(); + /** + * + * + *
+   * Explicitly specified decoding parameters.
+   * Required if using headerless PCM audio (linear16, mulaw, alaw).
+   * 
+ * + * .google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8; + */ + com.google.cloud.speech.v2.ExplicitDecodingConfigOrBuilder getExplicitDecodingConfigOrBuilder(); + + /** + * + * + *
+   * Speech recognition features to enable.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + * + * @return Whether the features field is set. + */ + boolean hasFeatures(); + /** + * + * + *
+   * Speech recognition features to enable.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + * + * @return The features. + */ + com.google.cloud.speech.v2.RecognitionFeatures getFeatures(); + /** + * + * + *
+   * Speech recognition features to enable.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures features = 2; + */ + com.google.cloud.speech.v2.RecognitionFeaturesOrBuilder getFeaturesOrBuilder(); + + /** + * + * + *
+   * Speech adaptation context that weights recognizer predictions for specific
+   * words and phrases.
+   * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + * + * @return Whether the adaptation field is set. + */ + boolean hasAdaptation(); + /** + * + * + *
+   * Speech adaptation context that weights recognizer predictions for specific
+   * words and phrases.
+   * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + * + * @return The adaptation. + */ + com.google.cloud.speech.v2.SpeechAdaptation getAdaptation(); + /** + * + * + *
+   * Speech adaptation context that weights recognizer predictions for specific
+   * words and phrases.
+   * 
+ * + * .google.cloud.speech.v2.SpeechAdaptation adaptation = 6; + */ + com.google.cloud.speech.v2.SpeechAdaptationOrBuilder getAdaptationOrBuilder(); + + public com.google.cloud.speech.v2.RecognitionConfig.DecodingConfigCase getDecodingConfigCase(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeatures.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeatures.java new file mode 100644 index 000000000000..f004ae7ecd48 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeatures.java @@ -0,0 +1,1844 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Available recognition features.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognitionFeatures} + */ +public final class RecognitionFeatures extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.RecognitionFeatures) + RecognitionFeaturesOrBuilder { + private static final long serialVersionUID = 0L; + // Use RecognitionFeatures.newBuilder() to construct. + private RecognitionFeatures(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RecognitionFeatures() { + multiChannelMode_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RecognitionFeatures(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RecognitionFeatures( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + profanityFilter_ = input.readBool(); + break; + } + case 16: + { + enableWordTimeOffsets_ = input.readBool(); + break; + } + case 24: + { + enableWordConfidence_ = input.readBool(); + break; + } + case 32: + { + enableAutomaticPunctuation_ = input.readBool(); + break; + } + case 74: + { + com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder subBuilder = null; + if (diarizationConfig_ != null) { + subBuilder = diarizationConfig_.toBuilder(); + } + diarizationConfig_ = + input.readMessage( + com.google.cloud.speech.v2.SpeakerDiarizationConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(diarizationConfig_); + diarizationConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 112: + { + enableSpokenPunctuation_ = input.readBool(); + break; + } + case 120: + { + enableSpokenEmojis_ = input.readBool(); + break; + } + case 128: + { + maxAlternatives_ = input.readInt32(); + break; + } + case 136: + { + int rawValue = input.readEnum(); + + multiChannelMode_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionFeatures_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionFeatures_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognitionFeatures.class, + com.google.cloud.speech.v2.RecognitionFeatures.Builder.class); + } + + /** + * + * + *
+   * Options for how to recognize multi-channel audio.
+   * 
+ * + * Protobuf enum {@code google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode} + */ + public enum MultiChannelMode implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value for the multi-channel mode. If the audio contains
+     * multiple channels, only the first channel will be transcribed; other
+     * channels will be ignored.
+     * 
+ * + * MULTI_CHANNEL_MODE_UNSPECIFIED = 0; + */ + MULTI_CHANNEL_MODE_UNSPECIFIED(0), + /** + * + * + *
+     * If selected, each channel in the provided audio is transcribed
+     * independently. This cannot be selected if the selected
+     * [model][google.cloud.speech.v2.Recognizer.model] is `latest_short`.
+     * 
+ * + * SEPARATE_RECOGNITION_PER_CHANNEL = 1; + */ + SEPARATE_RECOGNITION_PER_CHANNEL(1), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value for the multi-channel mode. If the audio contains
+     * multiple channels, only the first channel will be transcribed; other
+     * channels will be ignored.
+     * 
+ * + * MULTI_CHANNEL_MODE_UNSPECIFIED = 0; + */ + public static final int MULTI_CHANNEL_MODE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * If selected, each channel in the provided audio is transcribed
+     * independently. This cannot be selected if the selected
+     * [model][google.cloud.speech.v2.Recognizer.model] is `latest_short`.
+     * 
+ * + * SEPARATE_RECOGNITION_PER_CHANNEL = 1; + */ + public static final int SEPARATE_RECOGNITION_PER_CHANNEL_VALUE = 1; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MultiChannelMode valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static MultiChannelMode forNumber(int value) { + switch (value) { + case 0: + return MULTI_CHANNEL_MODE_UNSPECIFIED; + case 1: + return SEPARATE_RECOGNITION_PER_CHANNEL; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public MultiChannelMode findValueByNumber(int number) { + return MultiChannelMode.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.speech.v2.RecognitionFeatures.getDescriptor().getEnumTypes().get(0); + } + + private static final MultiChannelMode[] VALUES = values(); + + public static MultiChannelMode valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private MultiChannelMode(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode) + } + + public static final int PROFANITY_FILTER_FIELD_NUMBER = 1; + private boolean profanityFilter_; + /** + * + * + *
+   * If set to `true`, the server will attempt to filter out profanities,
+   * replacing all but the initial character in each filtered word with
+   * asterisks, for instance, "f***". If set to `false` or omitted, profanities
+   * won't be filtered out.
+   * 
+ * + * bool profanity_filter = 1; + * + * @return The profanityFilter. + */ + @java.lang.Override + public boolean getProfanityFilter() { + return profanityFilter_; + } + + public static final int ENABLE_WORD_TIME_OFFSETS_FIELD_NUMBER = 2; + private boolean enableWordTimeOffsets_; + /** + * + * + *
+   * If `true`, the top result includes a list of words and the start and end
+   * time offsets (timestamps) for those words. If `false`, no word-level time
+   * offset information is returned. The default is `false`.
+   * 
+ * + * bool enable_word_time_offsets = 2; + * + * @return The enableWordTimeOffsets. + */ + @java.lang.Override + public boolean getEnableWordTimeOffsets() { + return enableWordTimeOffsets_; + } + + public static final int ENABLE_WORD_CONFIDENCE_FIELD_NUMBER = 3; + private boolean enableWordConfidence_; + /** + * + * + *
+   * If `true`, the top result includes a list of words and the confidence for
+   * those words. If `false`, no word-level confidence information is returned.
+   * The default is `false`.
+   * 
+ * + * bool enable_word_confidence = 3; + * + * @return The enableWordConfidence. + */ + @java.lang.Override + public boolean getEnableWordConfidence() { + return enableWordConfidence_; + } + + public static final int ENABLE_AUTOMATIC_PUNCTUATION_FIELD_NUMBER = 4; + private boolean enableAutomaticPunctuation_; + /** + * + * + *
+   * If `true`, adds punctuation to recognition result hypotheses. This feature
+   * is only available in select languages. The default `false` value does not
+   * add punctuation to result hypotheses.
+   * 
+ * + * bool enable_automatic_punctuation = 4; + * + * @return The enableAutomaticPunctuation. + */ + @java.lang.Override + public boolean getEnableAutomaticPunctuation() { + return enableAutomaticPunctuation_; + } + + public static final int ENABLE_SPOKEN_PUNCTUATION_FIELD_NUMBER = 14; + private boolean enableSpokenPunctuation_; + /** + * + * + *
+   * The spoken punctuation behavior for the call. If `true`, replaces spoken
+   * punctuation with the corresponding symbols in the request. For example,
+   * "how are you question mark" becomes "how are you?". See
+   * https://cloud.google.com/speech-to-text/docs/spoken-punctuation for
+   * support. If `false`, spoken punctuation is not replaced.
+   * 
+ * + * bool enable_spoken_punctuation = 14; + * + * @return The enableSpokenPunctuation. + */ + @java.lang.Override + public boolean getEnableSpokenPunctuation() { + return enableSpokenPunctuation_; + } + + public static final int ENABLE_SPOKEN_EMOJIS_FIELD_NUMBER = 15; + private boolean enableSpokenEmojis_; + /** + * + * + *
+   * The spoken emoji behavior for the call. If `true`, adds spoken emoji
+   * formatting for the request. This will replace spoken emojis with the
+   * corresponding Unicode symbols in the final transcript. If `false`, spoken
+   * emojis are not replaced.
+   * 
+ * + * bool enable_spoken_emojis = 15; + * + * @return The enableSpokenEmojis. + */ + @java.lang.Override + public boolean getEnableSpokenEmojis() { + return enableSpokenEmojis_; + } + + public static final int MULTI_CHANNEL_MODE_FIELD_NUMBER = 17; + private int multiChannelMode_; + /** + * + * + *
+   * Mode for recognizing multi-channel audio.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @return The enum numeric value on the wire for multiChannelMode. + */ + @java.lang.Override + public int getMultiChannelModeValue() { + return multiChannelMode_; + } + /** + * + * + *
+   * Mode for recognizing multi-channel audio.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @return The multiChannelMode. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode getMultiChannelMode() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode result = + com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.valueOf(multiChannelMode_); + return result == null + ? com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.UNRECOGNIZED + : result; + } + + public static final int DIARIZATION_CONFIG_FIELD_NUMBER = 9; + private com.google.cloud.speech.v2.SpeakerDiarizationConfig diarizationConfig_; + /** + * + * + *
+   * Configuration to enable speaker diarization and set additional
+   * parameters to make diarization better suited for your application.
+   * When this is enabled, we send all the words from the beginning of the
+   * audio for the top alternative in every consecutive STREAMING responses.
+   * This is done in order to improve our speaker tags as our models learn to
+   * identify the speakers in the conversation over time.
+   * For non-streaming requests, the diarization results will be provided only
+   * in the top alternative of the FINAL SpeechRecognitionResult.
+   * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + * + * @return Whether the diarizationConfig field is set. + */ + @java.lang.Override + public boolean hasDiarizationConfig() { + return diarizationConfig_ != null; + } + /** + * + * + *
+   * Configuration to enable speaker diarization and set additional
+   * parameters to make diarization better suited for your application.
+   * When this is enabled, we send all the words from the beginning of the
+   * audio for the top alternative in every consecutive STREAMING responses.
+   * This is done in order to improve our speaker tags as our models learn to
+   * identify the speakers in the conversation over time.
+   * For non-streaming requests, the diarization results will be provided only
+   * in the top alternative of the FINAL SpeechRecognitionResult.
+   * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + * + * @return The diarizationConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeakerDiarizationConfig getDiarizationConfig() { + return diarizationConfig_ == null + ? com.google.cloud.speech.v2.SpeakerDiarizationConfig.getDefaultInstance() + : diarizationConfig_; + } + /** + * + * + *
+   * Configuration to enable speaker diarization and set additional
+   * parameters to make diarization better suited for your application.
+   * When this is enabled, we send all the words from the beginning of the
+   * audio for the top alternative in every consecutive STREAMING responses.
+   * This is done in order to improve our speaker tags as our models learn to
+   * identify the speakers in the conversation over time.
+   * For non-streaming requests, the diarization results will be provided only
+   * in the top alternative of the FINAL SpeechRecognitionResult.
+   * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeakerDiarizationConfigOrBuilder + getDiarizationConfigOrBuilder() { + return getDiarizationConfig(); + } + + public static final int MAX_ALTERNATIVES_FIELD_NUMBER = 16; + private int maxAlternatives_; + /** + * + * + *
+   * Maximum number of recognition hypotheses to be returned.
+   * The server may return fewer than `max_alternatives`.
+   * Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
+   * one. If omitted, will return a maximum of one.
+   * 
+ * + * int32 max_alternatives = 16; + * + * @return The maxAlternatives. + */ + @java.lang.Override + public int getMaxAlternatives() { + return maxAlternatives_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (profanityFilter_ != false) { + output.writeBool(1, profanityFilter_); + } + if (enableWordTimeOffsets_ != false) { + output.writeBool(2, enableWordTimeOffsets_); + } + if (enableWordConfidence_ != false) { + output.writeBool(3, enableWordConfidence_); + } + if (enableAutomaticPunctuation_ != false) { + output.writeBool(4, enableAutomaticPunctuation_); + } + if (diarizationConfig_ != null) { + output.writeMessage(9, getDiarizationConfig()); + } + if (enableSpokenPunctuation_ != false) { + output.writeBool(14, enableSpokenPunctuation_); + } + if (enableSpokenEmojis_ != false) { + output.writeBool(15, enableSpokenEmojis_); + } + if (maxAlternatives_ != 0) { + output.writeInt32(16, maxAlternatives_); + } + if (multiChannelMode_ + != com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode + .MULTI_CHANNEL_MODE_UNSPECIFIED + .getNumber()) { + output.writeEnum(17, multiChannelMode_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (profanityFilter_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, profanityFilter_); + } + if (enableWordTimeOffsets_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, enableWordTimeOffsets_); + } + if (enableWordConfidence_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, enableWordConfidence_); + } + if (enableAutomaticPunctuation_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, enableAutomaticPunctuation_); + } + if (diarizationConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getDiarizationConfig()); + } + if (enableSpokenPunctuation_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(14, enableSpokenPunctuation_); + } + if (enableSpokenEmojis_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(15, enableSpokenEmojis_); + } + if (maxAlternatives_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(16, maxAlternatives_); + } + if (multiChannelMode_ + != com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode + .MULTI_CHANNEL_MODE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(17, multiChannelMode_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.RecognitionFeatures)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.RecognitionFeatures other = + (com.google.cloud.speech.v2.RecognitionFeatures) obj; + + if (getProfanityFilter() != other.getProfanityFilter()) return false; + if (getEnableWordTimeOffsets() != other.getEnableWordTimeOffsets()) return false; + if (getEnableWordConfidence() != other.getEnableWordConfidence()) return false; + if (getEnableAutomaticPunctuation() != other.getEnableAutomaticPunctuation()) return false; + if (getEnableSpokenPunctuation() != other.getEnableSpokenPunctuation()) return false; + if (getEnableSpokenEmojis() != other.getEnableSpokenEmojis()) return false; + if (multiChannelMode_ != other.multiChannelMode_) return false; + if (hasDiarizationConfig() != other.hasDiarizationConfig()) return false; + if (hasDiarizationConfig()) { + if (!getDiarizationConfig().equals(other.getDiarizationConfig())) return false; + } + if (getMaxAlternatives() != other.getMaxAlternatives()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PROFANITY_FILTER_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getProfanityFilter()); + hash = (37 * hash) + ENABLE_WORD_TIME_OFFSETS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableWordTimeOffsets()); + hash = (37 * hash) + ENABLE_WORD_CONFIDENCE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableWordConfidence()); + hash = (37 * hash) + ENABLE_AUTOMATIC_PUNCTUATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableAutomaticPunctuation()); + hash = (37 * hash) + ENABLE_SPOKEN_PUNCTUATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableSpokenPunctuation()); + hash = (37 * hash) + ENABLE_SPOKEN_EMOJIS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableSpokenEmojis()); + hash = (37 * hash) + MULTI_CHANNEL_MODE_FIELD_NUMBER; + hash = (53 * hash) + multiChannelMode_; + if (hasDiarizationConfig()) { + hash = (37 * hash) + DIARIZATION_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getDiarizationConfig().hashCode(); + } + hash = (37 * hash) + MAX_ALTERNATIVES_FIELD_NUMBER; + hash = (53 * hash) + getMaxAlternatives(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.RecognitionFeatures prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Available recognition features.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognitionFeatures} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.RecognitionFeatures) + com.google.cloud.speech.v2.RecognitionFeaturesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionFeatures_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionFeatures_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognitionFeatures.class, + com.google.cloud.speech.v2.RecognitionFeatures.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.RecognitionFeatures.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + profanityFilter_ = false; + + enableWordTimeOffsets_ = false; + + enableWordConfidence_ = false; + + enableAutomaticPunctuation_ = false; + + enableSpokenPunctuation_ = false; + + enableSpokenEmojis_ = false; + + multiChannelMode_ = 0; + + if (diarizationConfigBuilder_ == null) { + diarizationConfig_ = null; + } else { + diarizationConfig_ = null; + diarizationConfigBuilder_ = null; + } + maxAlternatives_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionFeatures_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeatures getDefaultInstanceForType() { + return com.google.cloud.speech.v2.RecognitionFeatures.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeatures build() { + com.google.cloud.speech.v2.RecognitionFeatures result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeatures buildPartial() { + com.google.cloud.speech.v2.RecognitionFeatures result = + new com.google.cloud.speech.v2.RecognitionFeatures(this); + result.profanityFilter_ = profanityFilter_; + result.enableWordTimeOffsets_ = enableWordTimeOffsets_; + result.enableWordConfidence_ = enableWordConfidence_; + result.enableAutomaticPunctuation_ = enableAutomaticPunctuation_; + result.enableSpokenPunctuation_ = enableSpokenPunctuation_; + result.enableSpokenEmojis_ = enableSpokenEmojis_; + result.multiChannelMode_ = multiChannelMode_; + if (diarizationConfigBuilder_ == null) { + result.diarizationConfig_ = diarizationConfig_; + } else { + result.diarizationConfig_ = diarizationConfigBuilder_.build(); + } + result.maxAlternatives_ = maxAlternatives_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.RecognitionFeatures) { + return mergeFrom((com.google.cloud.speech.v2.RecognitionFeatures) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.RecognitionFeatures other) { + if (other == com.google.cloud.speech.v2.RecognitionFeatures.getDefaultInstance()) return this; + if (other.getProfanityFilter() != false) { + setProfanityFilter(other.getProfanityFilter()); + } + if (other.getEnableWordTimeOffsets() != false) { + setEnableWordTimeOffsets(other.getEnableWordTimeOffsets()); + } + if (other.getEnableWordConfidence() != false) { + setEnableWordConfidence(other.getEnableWordConfidence()); + } + if (other.getEnableAutomaticPunctuation() != false) { + setEnableAutomaticPunctuation(other.getEnableAutomaticPunctuation()); + } + if (other.getEnableSpokenPunctuation() != false) { + setEnableSpokenPunctuation(other.getEnableSpokenPunctuation()); + } + if (other.getEnableSpokenEmojis() != false) { + setEnableSpokenEmojis(other.getEnableSpokenEmojis()); + } + if (other.multiChannelMode_ != 0) { + setMultiChannelModeValue(other.getMultiChannelModeValue()); + } + if (other.hasDiarizationConfig()) { + mergeDiarizationConfig(other.getDiarizationConfig()); + } + if (other.getMaxAlternatives() != 0) { + setMaxAlternatives(other.getMaxAlternatives()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.RecognitionFeatures parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.RecognitionFeatures) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean profanityFilter_; + /** + * + * + *
+     * If set to `true`, the server will attempt to filter out profanities,
+     * replacing all but the initial character in each filtered word with
+     * asterisks, for instance, "f***". If set to `false` or omitted, profanities
+     * won't be filtered out.
+     * 
+ * + * bool profanity_filter = 1; + * + * @return The profanityFilter. + */ + @java.lang.Override + public boolean getProfanityFilter() { + return profanityFilter_; + } + /** + * + * + *
+     * If set to `true`, the server will attempt to filter out profanities,
+     * replacing all but the initial character in each filtered word with
+     * asterisks, for instance, "f***". If set to `false` or omitted, profanities
+     * won't be filtered out.
+     * 
+ * + * bool profanity_filter = 1; + * + * @param value The profanityFilter to set. + * @return This builder for chaining. + */ + public Builder setProfanityFilter(boolean value) { + + profanityFilter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to `true`, the server will attempt to filter out profanities,
+     * replacing all but the initial character in each filtered word with
+     * asterisks, for instance, "f***". If set to `false` or omitted, profanities
+     * won't be filtered out.
+     * 
+ * + * bool profanity_filter = 1; + * + * @return This builder for chaining. + */ + public Builder clearProfanityFilter() { + + profanityFilter_ = false; + onChanged(); + return this; + } + + private boolean enableWordTimeOffsets_; + /** + * + * + *
+     * If `true`, the top result includes a list of words and the start and end
+     * time offsets (timestamps) for those words. If `false`, no word-level time
+     * offset information is returned. The default is `false`.
+     * 
+ * + * bool enable_word_time_offsets = 2; + * + * @return The enableWordTimeOffsets. + */ + @java.lang.Override + public boolean getEnableWordTimeOffsets() { + return enableWordTimeOffsets_; + } + /** + * + * + *
+     * If `true`, the top result includes a list of words and the start and end
+     * time offsets (timestamps) for those words. If `false`, no word-level time
+     * offset information is returned. The default is `false`.
+     * 
+ * + * bool enable_word_time_offsets = 2; + * + * @param value The enableWordTimeOffsets to set. + * @return This builder for chaining. + */ + public Builder setEnableWordTimeOffsets(boolean value) { + + enableWordTimeOffsets_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If `true`, the top result includes a list of words and the start and end
+     * time offsets (timestamps) for those words. If `false`, no word-level time
+     * offset information is returned. The default is `false`.
+     * 
+ * + * bool enable_word_time_offsets = 2; + * + * @return This builder for chaining. + */ + public Builder clearEnableWordTimeOffsets() { + + enableWordTimeOffsets_ = false; + onChanged(); + return this; + } + + private boolean enableWordConfidence_; + /** + * + * + *
+     * If `true`, the top result includes a list of words and the confidence for
+     * those words. If `false`, no word-level confidence information is returned.
+     * The default is `false`.
+     * 
+ * + * bool enable_word_confidence = 3; + * + * @return The enableWordConfidence. + */ + @java.lang.Override + public boolean getEnableWordConfidence() { + return enableWordConfidence_; + } + /** + * + * + *
+     * If `true`, the top result includes a list of words and the confidence for
+     * those words. If `false`, no word-level confidence information is returned.
+     * The default is `false`.
+     * 
+ * + * bool enable_word_confidence = 3; + * + * @param value The enableWordConfidence to set. + * @return This builder for chaining. + */ + public Builder setEnableWordConfidence(boolean value) { + + enableWordConfidence_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If `true`, the top result includes a list of words and the confidence for
+     * those words. If `false`, no word-level confidence information is returned.
+     * The default is `false`.
+     * 
+ * + * bool enable_word_confidence = 3; + * + * @return This builder for chaining. + */ + public Builder clearEnableWordConfidence() { + + enableWordConfidence_ = false; + onChanged(); + return this; + } + + private boolean enableAutomaticPunctuation_; + /** + * + * + *
+     * If `true`, adds punctuation to recognition result hypotheses. This feature
+     * is only available in select languages. The default `false` value does not
+     * add punctuation to result hypotheses.
+     * 
+ * + * bool enable_automatic_punctuation = 4; + * + * @return The enableAutomaticPunctuation. + */ + @java.lang.Override + public boolean getEnableAutomaticPunctuation() { + return enableAutomaticPunctuation_; + } + /** + * + * + *
+     * If `true`, adds punctuation to recognition result hypotheses. This feature
+     * is only available in select languages. The default `false` value does not
+     * add punctuation to result hypotheses.
+     * 
+ * + * bool enable_automatic_punctuation = 4; + * + * @param value The enableAutomaticPunctuation to set. + * @return This builder for chaining. + */ + public Builder setEnableAutomaticPunctuation(boolean value) { + + enableAutomaticPunctuation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If `true`, adds punctuation to recognition result hypotheses. This feature
+     * is only available in select languages. The default `false` value does not
+     * add punctuation to result hypotheses.
+     * 
+ * + * bool enable_automatic_punctuation = 4; + * + * @return This builder for chaining. + */ + public Builder clearEnableAutomaticPunctuation() { + + enableAutomaticPunctuation_ = false; + onChanged(); + return this; + } + + private boolean enableSpokenPunctuation_; + /** + * + * + *
+     * The spoken punctuation behavior for the call. If `true`, replaces spoken
+     * punctuation with the corresponding symbols in the request. For example,
+     * "how are you question mark" becomes "how are you?". See
+     * https://cloud.google.com/speech-to-text/docs/spoken-punctuation for
+     * support. If `false`, spoken punctuation is not replaced.
+     * 
+ * + * bool enable_spoken_punctuation = 14; + * + * @return The enableSpokenPunctuation. + */ + @java.lang.Override + public boolean getEnableSpokenPunctuation() { + return enableSpokenPunctuation_; + } + /** + * + * + *
+     * The spoken punctuation behavior for the call. If `true`, replaces spoken
+     * punctuation with the corresponding symbols in the request. For example,
+     * "how are you question mark" becomes "how are you?". See
+     * https://cloud.google.com/speech-to-text/docs/spoken-punctuation for
+     * support. If `false`, spoken punctuation is not replaced.
+     * 
+ * + * bool enable_spoken_punctuation = 14; + * + * @param value The enableSpokenPunctuation to set. + * @return This builder for chaining. + */ + public Builder setEnableSpokenPunctuation(boolean value) { + + enableSpokenPunctuation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The spoken punctuation behavior for the call. If `true`, replaces spoken
+     * punctuation with the corresponding symbols in the request. For example,
+     * "how are you question mark" becomes "how are you?". See
+     * https://cloud.google.com/speech-to-text/docs/spoken-punctuation for
+     * support. If `false`, spoken punctuation is not replaced.
+     * 
+ * + * bool enable_spoken_punctuation = 14; + * + * @return This builder for chaining. + */ + public Builder clearEnableSpokenPunctuation() { + + enableSpokenPunctuation_ = false; + onChanged(); + return this; + } + + private boolean enableSpokenEmojis_; + /** + * + * + *
+     * The spoken emoji behavior for the call. If `true`, adds spoken emoji
+     * formatting for the request. This will replace spoken emojis with the
+     * corresponding Unicode symbols in the final transcript. If `false`, spoken
+     * emojis are not replaced.
+     * 
+ * + * bool enable_spoken_emojis = 15; + * + * @return The enableSpokenEmojis. + */ + @java.lang.Override + public boolean getEnableSpokenEmojis() { + return enableSpokenEmojis_; + } + /** + * + * + *
+     * The spoken emoji behavior for the call. If `true`, adds spoken emoji
+     * formatting for the request. This will replace spoken emojis with the
+     * corresponding Unicode symbols in the final transcript. If `false`, spoken
+     * emojis are not replaced.
+     * 
+ * + * bool enable_spoken_emojis = 15; + * + * @param value The enableSpokenEmojis to set. + * @return This builder for chaining. + */ + public Builder setEnableSpokenEmojis(boolean value) { + + enableSpokenEmojis_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The spoken emoji behavior for the call. If `true`, adds spoken emoji
+     * formatting for the request. This will replace spoken emojis with the
+     * corresponding Unicode symbols in the final transcript. If `false`, spoken
+     * emojis are not replaced.
+     * 
+ * + * bool enable_spoken_emojis = 15; + * + * @return This builder for chaining. + */ + public Builder clearEnableSpokenEmojis() { + + enableSpokenEmojis_ = false; + onChanged(); + return this; + } + + private int multiChannelMode_ = 0; + /** + * + * + *
+     * Mode for recognizing multi-channel audio.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @return The enum numeric value on the wire for multiChannelMode. + */ + @java.lang.Override + public int getMultiChannelModeValue() { + return multiChannelMode_; + } + /** + * + * + *
+     * Mode for recognizing multi-channel audio.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @param value The enum numeric value on the wire for multiChannelMode to set. + * @return This builder for chaining. + */ + public Builder setMultiChannelModeValue(int value) { + + multiChannelMode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Mode for recognizing multi-channel audio.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @return The multiChannelMode. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode getMultiChannelMode() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode result = + com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.valueOf( + multiChannelMode_); + return result == null + ? com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Mode for recognizing multi-channel audio.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @param value The multiChannelMode to set. + * @return This builder for chaining. + */ + public Builder setMultiChannelMode( + com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode value) { + if (value == null) { + throw new NullPointerException(); + } + + multiChannelMode_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Mode for recognizing multi-channel audio.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @return This builder for chaining. + */ + public Builder clearMultiChannelMode() { + + multiChannelMode_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.speech.v2.SpeakerDiarizationConfig diarizationConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.SpeakerDiarizationConfig, + com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder, + com.google.cloud.speech.v2.SpeakerDiarizationConfigOrBuilder> + diarizationConfigBuilder_; + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + * + * @return Whether the diarizationConfig field is set. + */ + public boolean hasDiarizationConfig() { + return diarizationConfigBuilder_ != null || diarizationConfig_ != null; + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + * + * @return The diarizationConfig. + */ + public com.google.cloud.speech.v2.SpeakerDiarizationConfig getDiarizationConfig() { + if (diarizationConfigBuilder_ == null) { + return diarizationConfig_ == null + ? com.google.cloud.speech.v2.SpeakerDiarizationConfig.getDefaultInstance() + : diarizationConfig_; + } else { + return diarizationConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + public Builder setDiarizationConfig(com.google.cloud.speech.v2.SpeakerDiarizationConfig value) { + if (diarizationConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + diarizationConfig_ = value; + onChanged(); + } else { + diarizationConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + public Builder setDiarizationConfig( + com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder builderForValue) { + if (diarizationConfigBuilder_ == null) { + diarizationConfig_ = builderForValue.build(); + onChanged(); + } else { + diarizationConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + public Builder mergeDiarizationConfig( + com.google.cloud.speech.v2.SpeakerDiarizationConfig value) { + if (diarizationConfigBuilder_ == null) { + if (diarizationConfig_ != null) { + diarizationConfig_ = + com.google.cloud.speech.v2.SpeakerDiarizationConfig.newBuilder(diarizationConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + diarizationConfig_ = value; + } + onChanged(); + } else { + diarizationConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + public Builder clearDiarizationConfig() { + if (diarizationConfigBuilder_ == null) { + diarizationConfig_ = null; + onChanged(); + } else { + diarizationConfig_ = null; + diarizationConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + public com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder + getDiarizationConfigBuilder() { + + onChanged(); + return getDiarizationConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + public com.google.cloud.speech.v2.SpeakerDiarizationConfigOrBuilder + getDiarizationConfigOrBuilder() { + if (diarizationConfigBuilder_ != null) { + return diarizationConfigBuilder_.getMessageOrBuilder(); + } else { + return diarizationConfig_ == null + ? com.google.cloud.speech.v2.SpeakerDiarizationConfig.getDefaultInstance() + : diarizationConfig_; + } + } + /** + * + * + *
+     * Configuration to enable speaker diarization and set additional
+     * parameters to make diarization better suited for your application.
+     * When this is enabled, we send all the words from the beginning of the
+     * audio for the top alternative in every consecutive STREAMING responses.
+     * This is done in order to improve our speaker tags as our models learn to
+     * identify the speakers in the conversation over time.
+     * For non-streaming requests, the diarization results will be provided only
+     * in the top alternative of the FINAL SpeechRecognitionResult.
+     * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.SpeakerDiarizationConfig, + com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder, + com.google.cloud.speech.v2.SpeakerDiarizationConfigOrBuilder> + getDiarizationConfigFieldBuilder() { + if (diarizationConfigBuilder_ == null) { + diarizationConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.SpeakerDiarizationConfig, + com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder, + com.google.cloud.speech.v2.SpeakerDiarizationConfigOrBuilder>( + getDiarizationConfig(), getParentForChildren(), isClean()); + diarizationConfig_ = null; + } + return diarizationConfigBuilder_; + } + + private int maxAlternatives_; + /** + * + * + *
+     * Maximum number of recognition hypotheses to be returned.
+     * The server may return fewer than `max_alternatives`.
+     * Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
+     * one. If omitted, will return a maximum of one.
+     * 
+ * + * int32 max_alternatives = 16; + * + * @return The maxAlternatives. + */ + @java.lang.Override + public int getMaxAlternatives() { + return maxAlternatives_; + } + /** + * + * + *
+     * Maximum number of recognition hypotheses to be returned.
+     * The server may return fewer than `max_alternatives`.
+     * Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
+     * one. If omitted, will return a maximum of one.
+     * 
+ * + * int32 max_alternatives = 16; + * + * @param value The maxAlternatives to set. + * @return This builder for chaining. + */ + public Builder setMaxAlternatives(int value) { + + maxAlternatives_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Maximum number of recognition hypotheses to be returned.
+     * The server may return fewer than `max_alternatives`.
+     * Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
+     * one. If omitted, will return a maximum of one.
+     * 
+ * + * int32 max_alternatives = 16; + * + * @return This builder for chaining. + */ + public Builder clearMaxAlternatives() { + + maxAlternatives_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.RecognitionFeatures) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.RecognitionFeatures) + private static final com.google.cloud.speech.v2.RecognitionFeatures DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.RecognitionFeatures(); + } + + public static com.google.cloud.speech.v2.RecognitionFeatures getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RecognitionFeatures parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RecognitionFeatures(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionFeatures getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeaturesOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeaturesOrBuilder.java new file mode 100644 index 000000000000..30c39ecf7014 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionFeaturesOrBuilder.java @@ -0,0 +1,218 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface RecognitionFeaturesOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.RecognitionFeatures) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * If set to `true`, the server will attempt to filter out profanities,
+   * replacing all but the initial character in each filtered word with
+   * asterisks, for instance, "f***". If set to `false` or omitted, profanities
+   * won't be filtered out.
+   * 
+ * + * bool profanity_filter = 1; + * + * @return The profanityFilter. + */ + boolean getProfanityFilter(); + + /** + * + * + *
+   * If `true`, the top result includes a list of words and the start and end
+   * time offsets (timestamps) for those words. If `false`, no word-level time
+   * offset information is returned. The default is `false`.
+   * 
+ * + * bool enable_word_time_offsets = 2; + * + * @return The enableWordTimeOffsets. + */ + boolean getEnableWordTimeOffsets(); + + /** + * + * + *
+   * If `true`, the top result includes a list of words and the confidence for
+   * those words. If `false`, no word-level confidence information is returned.
+   * The default is `false`.
+   * 
+ * + * bool enable_word_confidence = 3; + * + * @return The enableWordConfidence. + */ + boolean getEnableWordConfidence(); + + /** + * + * + *
+   * If `true`, adds punctuation to recognition result hypotheses. This feature
+   * is only available in select languages. The default `false` value does not
+   * add punctuation to result hypotheses.
+   * 
+ * + * bool enable_automatic_punctuation = 4; + * + * @return The enableAutomaticPunctuation. + */ + boolean getEnableAutomaticPunctuation(); + + /** + * + * + *
+   * The spoken punctuation behavior for the call. If `true`, replaces spoken
+   * punctuation with the corresponding symbols in the request. For example,
+   * "how are you question mark" becomes "how are you?". See
+   * https://cloud.google.com/speech-to-text/docs/spoken-punctuation for
+   * support. If `false`, spoken punctuation is not replaced.
+   * 
+ * + * bool enable_spoken_punctuation = 14; + * + * @return The enableSpokenPunctuation. + */ + boolean getEnableSpokenPunctuation(); + + /** + * + * + *
+   * The spoken emoji behavior for the call. If `true`, adds spoken emoji
+   * formatting for the request. This will replace spoken emojis with the
+   * corresponding Unicode symbols in the final transcript. If `false`, spoken
+   * emojis are not replaced.
+   * 
+ * + * bool enable_spoken_emojis = 15; + * + * @return The enableSpokenEmojis. + */ + boolean getEnableSpokenEmojis(); + + /** + * + * + *
+   * Mode for recognizing multi-channel audio.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @return The enum numeric value on the wire for multiChannelMode. + */ + int getMultiChannelModeValue(); + /** + * + * + *
+   * Mode for recognizing multi-channel audio.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode multi_channel_mode = 17; + * + * + * @return The multiChannelMode. + */ + com.google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode getMultiChannelMode(); + + /** + * + * + *
+   * Configuration to enable speaker diarization and set additional
+   * parameters to make diarization better suited for your application.
+   * When this is enabled, we send all the words from the beginning of the
+   * audio for the top alternative in every consecutive STREAMING responses.
+   * This is done in order to improve our speaker tags as our models learn to
+   * identify the speakers in the conversation over time.
+   * For non-streaming requests, the diarization results will be provided only
+   * in the top alternative of the FINAL SpeechRecognitionResult.
+   * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + * + * @return Whether the diarizationConfig field is set. + */ + boolean hasDiarizationConfig(); + /** + * + * + *
+   * Configuration to enable speaker diarization and set additional
+   * parameters to make diarization better suited for your application.
+   * When this is enabled, we send all the words from the beginning of the
+   * audio for the top alternative in every consecutive STREAMING responses.
+   * This is done in order to improve our speaker tags as our models learn to
+   * identify the speakers in the conversation over time.
+   * For non-streaming requests, the diarization results will be provided only
+   * in the top alternative of the FINAL SpeechRecognitionResult.
+   * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + * + * @return The diarizationConfig. + */ + com.google.cloud.speech.v2.SpeakerDiarizationConfig getDiarizationConfig(); + /** + * + * + *
+   * Configuration to enable speaker diarization and set additional
+   * parameters to make diarization better suited for your application.
+   * When this is enabled, we send all the words from the beginning of the
+   * audio for the top alternative in every consecutive STREAMING responses.
+   * This is done in order to improve our speaker tags as our models learn to
+   * identify the speakers in the conversation over time.
+   * For non-streaming requests, the diarization results will be provided only
+   * in the top alternative of the FINAL SpeechRecognitionResult.
+   * 
+ * + * .google.cloud.speech.v2.SpeakerDiarizationConfig diarization_config = 9; + */ + com.google.cloud.speech.v2.SpeakerDiarizationConfigOrBuilder getDiarizationConfigOrBuilder(); + + /** + * + * + *
+   * Maximum number of recognition hypotheses to be returned.
+   * The server may return fewer than `max_alternatives`.
+   * Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
+   * one. If omitted, will return a maximum of one.
+   * 
+ * + * int32 max_alternatives = 16; + * + * @return The maxAlternatives. + */ + int getMaxAlternatives(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadata.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadata.java new file mode 100644 index 000000000000..29509ff361be --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadata.java @@ -0,0 +1,735 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Metadata about the recognition request and response.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognitionResponseMetadata} + */ +public final class RecognitionResponseMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.RecognitionResponseMetadata) + RecognitionResponseMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use RecognitionResponseMetadata.newBuilder() to construct. + private RecognitionResponseMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RecognitionResponseMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RecognitionResponseMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RecognitionResponseMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 50: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (totalBilledDuration_ != null) { + subBuilder = totalBilledDuration_.toBuilder(); + } + totalBilledDuration_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(totalBilledDuration_); + totalBilledDuration_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionResponseMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionResponseMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognitionResponseMetadata.class, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder.class); + } + + public static final int TOTAL_BILLED_DURATION_FIELD_NUMBER = 6; + private com.google.protobuf.Duration totalBilledDuration_; + /** + * + * + *
+   * When available, billed audio seconds for the corresponding request.
+   * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + * + * @return Whether the totalBilledDuration field is set. + */ + @java.lang.Override + public boolean hasTotalBilledDuration() { + return totalBilledDuration_ != null; + } + /** + * + * + *
+   * When available, billed audio seconds for the corresponding request.
+   * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + * + * @return The totalBilledDuration. + */ + @java.lang.Override + public com.google.protobuf.Duration getTotalBilledDuration() { + return totalBilledDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : totalBilledDuration_; + } + /** + * + * + *
+   * When available, billed audio seconds for the corresponding request.
+   * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getTotalBilledDurationOrBuilder() { + return getTotalBilledDuration(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (totalBilledDuration_ != null) { + output.writeMessage(6, getTotalBilledDuration()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (totalBilledDuration_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getTotalBilledDuration()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.RecognitionResponseMetadata)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.RecognitionResponseMetadata other = + (com.google.cloud.speech.v2.RecognitionResponseMetadata) obj; + + if (hasTotalBilledDuration() != other.hasTotalBilledDuration()) return false; + if (hasTotalBilledDuration()) { + if (!getTotalBilledDuration().equals(other.getTotalBilledDuration())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasTotalBilledDuration()) { + hash = (37 * hash) + TOTAL_BILLED_DURATION_FIELD_NUMBER; + hash = (53 * hash) + getTotalBilledDuration().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.RecognitionResponseMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata about the recognition request and response.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognitionResponseMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.RecognitionResponseMetadata) + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionResponseMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionResponseMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognitionResponseMetadata.class, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.RecognitionResponseMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (totalBilledDurationBuilder_ == null) { + totalBilledDuration_ = null; + } else { + totalBilledDuration_ = null; + totalBilledDurationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognitionResponseMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadata getDefaultInstanceForType() { + return com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadata build() { + com.google.cloud.speech.v2.RecognitionResponseMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadata buildPartial() { + com.google.cloud.speech.v2.RecognitionResponseMetadata result = + new com.google.cloud.speech.v2.RecognitionResponseMetadata(this); + if (totalBilledDurationBuilder_ == null) { + result.totalBilledDuration_ = totalBilledDuration_; + } else { + result.totalBilledDuration_ = totalBilledDurationBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.RecognitionResponseMetadata) { + return mergeFrom((com.google.cloud.speech.v2.RecognitionResponseMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.RecognitionResponseMetadata other) { + if (other == com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance()) + return this; + if (other.hasTotalBilledDuration()) { + mergeTotalBilledDuration(other.getTotalBilledDuration()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.RecognitionResponseMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.RecognitionResponseMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Duration totalBilledDuration_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + totalBilledDurationBuilder_; + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + * + * @return Whether the totalBilledDuration field is set. + */ + public boolean hasTotalBilledDuration() { + return totalBilledDurationBuilder_ != null || totalBilledDuration_ != null; + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + * + * @return The totalBilledDuration. + */ + public com.google.protobuf.Duration getTotalBilledDuration() { + if (totalBilledDurationBuilder_ == null) { + return totalBilledDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : totalBilledDuration_; + } else { + return totalBilledDurationBuilder_.getMessage(); + } + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + public Builder setTotalBilledDuration(com.google.protobuf.Duration value) { + if (totalBilledDurationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + totalBilledDuration_ = value; + onChanged(); + } else { + totalBilledDurationBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + public Builder setTotalBilledDuration(com.google.protobuf.Duration.Builder builderForValue) { + if (totalBilledDurationBuilder_ == null) { + totalBilledDuration_ = builderForValue.build(); + onChanged(); + } else { + totalBilledDurationBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + public Builder mergeTotalBilledDuration(com.google.protobuf.Duration value) { + if (totalBilledDurationBuilder_ == null) { + if (totalBilledDuration_ != null) { + totalBilledDuration_ = + com.google.protobuf.Duration.newBuilder(totalBilledDuration_) + .mergeFrom(value) + .buildPartial(); + } else { + totalBilledDuration_ = value; + } + onChanged(); + } else { + totalBilledDurationBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + public Builder clearTotalBilledDuration() { + if (totalBilledDurationBuilder_ == null) { + totalBilledDuration_ = null; + onChanged(); + } else { + totalBilledDuration_ = null; + totalBilledDurationBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + public com.google.protobuf.Duration.Builder getTotalBilledDurationBuilder() { + + onChanged(); + return getTotalBilledDurationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + public com.google.protobuf.DurationOrBuilder getTotalBilledDurationOrBuilder() { + if (totalBilledDurationBuilder_ != null) { + return totalBilledDurationBuilder_.getMessageOrBuilder(); + } else { + return totalBilledDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : totalBilledDuration_; + } + } + /** + * + * + *
+     * When available, billed audio seconds for the corresponding request.
+     * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getTotalBilledDurationFieldBuilder() { + if (totalBilledDurationBuilder_ == null) { + totalBilledDurationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getTotalBilledDuration(), getParentForChildren(), isClean()); + totalBilledDuration_ = null; + } + return totalBilledDurationBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.RecognitionResponseMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.RecognitionResponseMetadata) + private static final com.google.cloud.speech.v2.RecognitionResponseMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.RecognitionResponseMetadata(); + } + + public static com.google.cloud.speech.v2.RecognitionResponseMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RecognitionResponseMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RecognitionResponseMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadataOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadataOrBuilder.java new file mode 100644 index 000000000000..255a0a27c77f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognitionResponseMetadataOrBuilder.java @@ -0,0 +1,60 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface RecognitionResponseMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.RecognitionResponseMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * When available, billed audio seconds for the corresponding request.
+   * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + * + * @return Whether the totalBilledDuration field is set. + */ + boolean hasTotalBilledDuration(); + /** + * + * + *
+   * When available, billed audio seconds for the corresponding request.
+   * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + * + * @return The totalBilledDuration. + */ + com.google.protobuf.Duration getTotalBilledDuration(); + /** + * + * + *
+   * When available, billed audio seconds for the corresponding request.
+   * 
+ * + * .google.protobuf.Duration total_billed_duration = 6; + */ + com.google.protobuf.DurationOrBuilder getTotalBilledDurationOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequest.java new file mode 100644 index 000000000000..3d4603de38bc --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequest.java @@ -0,0 +1,1955 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [Recognize][google.cloud.speech.v2.Speech.Recognize] method. Either
+ * `content` or `uri` must be supplied. Supplying both or neither returns
+ * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See [content
+ * limits](https://cloud.google.com/speech-to-text/quotas#content).
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognizeRequest} + */ +public final class RecognizeRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.RecognizeRequest) + RecognizeRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use RecognizeRequest.newBuilder() to construct. + private RecognizeRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RecognizeRequest() { + recognizer_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RecognizeRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RecognizeRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.RecognitionConfig.Builder subBuilder = null; + if (config_ != null) { + subBuilder = config_.toBuilder(); + } + config_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(config_); + config_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + recognizer_ = s; + break; + } + case 42: + { + audioSource_ = input.readBytes(); + audioSourceCase_ = 5; + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + audioSourceCase_ = 6; + audioSource_ = s; + break; + } + case 66: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (configMask_ != null) { + subBuilder = configMask_.toBuilder(); + } + configMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(configMask_); + configMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognizeRequest.class, + com.google.cloud.speech.v2.RecognizeRequest.Builder.class); + } + + private int audioSourceCase_ = 0; + private java.lang.Object audioSource_; + + public enum AudioSourceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + CONTENT(5), + URI(6), + AUDIOSOURCE_NOT_SET(0); + private final int value; + + private AudioSourceCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AudioSourceCase valueOf(int value) { + return forNumber(value); + } + + public static AudioSourceCase forNumber(int value) { + switch (value) { + case 5: + return CONTENT; + case 6: + return URI; + case 0: + return AUDIOSOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public AudioSourceCase getAudioSourceCase() { + return AudioSourceCase.forNumber(audioSourceCase_); + } + + public static final int RECOGNIZER_FIELD_NUMBER = 3; + private volatile java.lang.Object recognizer_; + /** + * + * + *
+   * Required. The name of the Recognizer to use during recognition. The
+   * expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + @java.lang.Override + public java.lang.String getRecognizer() { + java.lang.Object ref = recognizer_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizer_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Recognizer to use during recognition. The
+   * expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRecognizerBytes() { + java.lang.Object ref = recognizer_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.RecognitionConfig config_; + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+   * can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + * + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return config_ != null; + } + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+   * can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + * + * @return The config. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+   * can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + return getConfig(); + } + + public static final int CONFIG_MASK_FIELD_NUMBER = 8; + private com.google.protobuf.FieldMask configMask_; + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+   * values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + * + * @return Whether the configMask field is set. + */ + @java.lang.Override + public boolean hasConfigMask() { + return configMask_ != null; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+   * values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + * + * @return The configMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getConfigMask() { + return configMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : configMask_; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+   * values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + return getConfigMask(); + } + + public static final int CONTENT_FIELD_NUMBER = 5; + /** + * + * + *
+   * The audio data bytes encoded as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+   * with all bytes fields, proto buffers use a pure binary representation,
+   * whereas JSON representations use base64.
+   * 
+ * + * bytes content = 5; + * + * @return Whether the content field is set. + */ + @java.lang.Override + public boolean hasContent() { + return audioSourceCase_ == 5; + } + /** + * + * + *
+   * The audio data bytes encoded as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+   * with all bytes fields, proto buffers use a pure binary representation,
+   * whereas JSON representations use base64.
+   * 
+ * + * bytes content = 5; + * + * @return The content. + */ + @java.lang.Override + public com.google.protobuf.ByteString getContent() { + if (audioSourceCase_ == 5) { + return (com.google.protobuf.ByteString) audioSource_; + } + return com.google.protobuf.ByteString.EMPTY; + } + + public static final int URI_FIELD_NUMBER = 6; + /** + * + * + *
+   * URI that points to a file that contains audio data bytes as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+   * must not be compressed (for example, gzip). Currently, only Google Cloud
+   * Storage URIs are supported, which must be specified in the following
+   * format: `gs://bucket_name/object_name` (other URI formats return
+   * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+   * information, see [Request
+   * URIs](https://cloud.google.com/storage/docs/reference-uris).
+   * 
+ * + * string uri = 6; + * + * @return Whether the uri field is set. + */ + public boolean hasUri() { + return audioSourceCase_ == 6; + } + /** + * + * + *
+   * URI that points to a file that contains audio data bytes as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+   * must not be compressed (for example, gzip). Currently, only Google Cloud
+   * Storage URIs are supported, which must be specified in the following
+   * format: `gs://bucket_name/object_name` (other URI formats return
+   * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+   * information, see [Request
+   * URIs](https://cloud.google.com/storage/docs/reference-uris).
+   * 
+ * + * string uri = 6; + * + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 6) { + ref = audioSource_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (audioSourceCase_ == 6) { + audioSource_ = s; + } + return s; + } + } + /** + * + * + *
+   * URI that points to a file that contains audio data bytes as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+   * must not be compressed (for example, gzip). Currently, only Google Cloud
+   * Storage URIs are supported, which must be specified in the following
+   * format: `gs://bucket_name/object_name` (other URI formats return
+   * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+   * information, see [Request
+   * URIs](https://cloud.google.com/storage/docs/reference-uris).
+   * 
+ * + * string uri = 6; + * + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 6) { + ref = audioSource_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (audioSourceCase_ == 6) { + audioSource_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (config_ != null) { + output.writeMessage(1, getConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizer_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, recognizer_); + } + if (audioSourceCase_ == 5) { + output.writeBytes(5, (com.google.protobuf.ByteString) audioSource_); + } + if (audioSourceCase_ == 6) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, audioSource_); + } + if (configMask_ != null) { + output.writeMessage(8, getConfigMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (config_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizer_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, recognizer_); + } + if (audioSourceCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeBytesSize( + 5, (com.google.protobuf.ByteString) audioSource_); + } + if (audioSourceCase_ == 6) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, audioSource_); + } + if (configMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getConfigMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.RecognizeRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.RecognizeRequest other = + (com.google.cloud.speech.v2.RecognizeRequest) obj; + + if (!getRecognizer().equals(other.getRecognizer())) return false; + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig().equals(other.getConfig())) return false; + } + if (hasConfigMask() != other.hasConfigMask()) return false; + if (hasConfigMask()) { + if (!getConfigMask().equals(other.getConfigMask())) return false; + } + if (!getAudioSourceCase().equals(other.getAudioSourceCase())) return false; + switch (audioSourceCase_) { + case 5: + if (!getContent().equals(other.getContent())) return false; + break; + case 6: + if (!getUri().equals(other.getUri())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + RECOGNIZER_FIELD_NUMBER; + hash = (53 * hash) + getRecognizer().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + if (hasConfigMask()) { + hash = (37 * hash) + CONFIG_MASK_FIELD_NUMBER; + hash = (53 * hash) + getConfigMask().hashCode(); + } + switch (audioSourceCase_) { + case 5: + hash = (37 * hash) + CONTENT_FIELD_NUMBER; + hash = (53 * hash) + getContent().hashCode(); + break; + case 6: + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognizeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.RecognizeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [Recognize][google.cloud.speech.v2.Speech.Recognize] method. Either
+   * `content` or `uri` must be supplied. Supplying both or neither returns
+   * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See [content
+   * limits](https://cloud.google.com/speech-to-text/quotas#content).
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognizeRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.RecognizeRequest) + com.google.cloud.speech.v2.RecognizeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognizeRequest.class, + com.google.cloud.speech.v2.RecognizeRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.RecognizeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + recognizer_ = ""; + + if (configBuilder_ == null) { + config_ = null; + } else { + config_ = null; + configBuilder_ = null; + } + if (configMaskBuilder_ == null) { + configMask_ = null; + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + audioSourceCase_ = 0; + audioSource_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.RecognizeRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeRequest build() { + com.google.cloud.speech.v2.RecognizeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeRequest buildPartial() { + com.google.cloud.speech.v2.RecognizeRequest result = + new com.google.cloud.speech.v2.RecognizeRequest(this); + result.recognizer_ = recognizer_; + if (configBuilder_ == null) { + result.config_ = config_; + } else { + result.config_ = configBuilder_.build(); + } + if (configMaskBuilder_ == null) { + result.configMask_ = configMask_; + } else { + result.configMask_ = configMaskBuilder_.build(); + } + if (audioSourceCase_ == 5) { + result.audioSource_ = audioSource_; + } + if (audioSourceCase_ == 6) { + result.audioSource_ = audioSource_; + } + result.audioSourceCase_ = audioSourceCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.RecognizeRequest) { + return mergeFrom((com.google.cloud.speech.v2.RecognizeRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.RecognizeRequest other) { + if (other == com.google.cloud.speech.v2.RecognizeRequest.getDefaultInstance()) return this; + if (!other.getRecognizer().isEmpty()) { + recognizer_ = other.recognizer_; + onChanged(); + } + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + if (other.hasConfigMask()) { + mergeConfigMask(other.getConfigMask()); + } + switch (other.getAudioSourceCase()) { + case CONTENT: + { + setContent(other.getContent()); + break; + } + case URI: + { + audioSourceCase_ = 6; + audioSource_ = other.audioSource_; + onChanged(); + break; + } + case AUDIOSOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.RecognizeRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.RecognizeRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int audioSourceCase_ = 0; + private java.lang.Object audioSource_; + + public AudioSourceCase getAudioSourceCase() { + return AudioSourceCase.forNumber(audioSourceCase_); + } + + public Builder clearAudioSource() { + audioSourceCase_ = 0; + audioSource_ = null; + onChanged(); + return this; + } + + private java.lang.Object recognizer_ = ""; + /** + * + * + *
+     * Required. The name of the Recognizer to use during recognition. The
+     * expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + public java.lang.String getRecognizer() { + java.lang.Object ref = recognizer_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizer_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to use during recognition. The
+     * expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + public com.google.protobuf.ByteString getRecognizerBytes() { + java.lang.Object ref = recognizer_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to use during recognition. The
+     * expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The recognizer to set. + * @return This builder for chaining. + */ + public Builder setRecognizer(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + recognizer_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to use during recognition. The
+     * expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearRecognizer() { + + recognizer_ = getDefaultInstance().getRecognizer(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to use during recognition. The
+     * expected format is
+     * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for recognizer to set. + * @return This builder for chaining. + */ + public Builder setRecognizerBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + recognizer_ = value; + onChanged(); + return this; + } + + private com.google.cloud.speech.v2.RecognitionConfig config_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + configBuilder_; + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + * + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return configBuilder_ != null || config_ != null; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + * + * @return The config. + */ + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + onChanged(); + } else { + configBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + onChanged(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + public Builder mergeConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (config_ != null) { + config_ = + com.google.cloud.speech.v2.RecognitionConfig.newBuilder(config_) + .mergeFrom(value) + .buildPartial(); + } else { + config_ = value; + } + onChanged(); + } else { + configBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + public Builder clearConfig() { + if (configBuilder_ == null) { + config_ = null; + onChanged(); + } else { + config_ = null; + configBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + public com.google.cloud.speech.v2.RecognitionConfig.Builder getConfigBuilder() { + + onChanged(); + return getConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + } + /** + * + * + *
+     * Features and audio metadata to use for the Automatic Speech Recognition.
+     * This field in combination with the
+     * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+     * can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + getConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder>( + getConfig(), getParentForChildren(), isClean()); + config_ = null; + } + return configBuilder_; + } + + private com.google.protobuf.FieldMask configMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + configMaskBuilder_; + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + * + * @return Whether the configMask field is set. + */ + public boolean hasConfigMask() { + return configMaskBuilder_ != null || configMask_ != null; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + * + * @return The configMask. + */ + public com.google.protobuf.FieldMask getConfigMask() { + if (configMaskBuilder_ == null) { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } else { + return configMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + configMask_ = value; + onChanged(); + } else { + configMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (configMaskBuilder_ == null) { + configMask_ = builderForValue.build(); + onChanged(); + } else { + configMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + public Builder mergeConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (configMask_ != null) { + configMask_ = + com.google.protobuf.FieldMask.newBuilder(configMask_).mergeFrom(value).buildPartial(); + } else { + configMask_ = value; + } + onChanged(); + } else { + configMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + public Builder clearConfigMask() { + if (configMaskBuilder_ == null) { + configMask_ = null; + onChanged(); + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + public com.google.protobuf.FieldMask.Builder getConfigMaskBuilder() { + + onChanged(); + return getConfigMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + if (configMaskBuilder_ != null) { + return configMaskBuilder_.getMessageOrBuilder(); + } else { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+     * values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+     * values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+     * overrides and replaces the config in the recognizer for this recognition
+     * request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getConfigMaskFieldBuilder() { + if (configMaskBuilder_ == null) { + configMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getConfigMask(), getParentForChildren(), isClean()); + configMask_ = null; + } + return configMaskBuilder_; + } + + /** + * + * + *
+     * The audio data bytes encoded as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+     * with all bytes fields, proto buffers use a pure binary representation,
+     * whereas JSON representations use base64.
+     * 
+ * + * bytes content = 5; + * + * @return Whether the content field is set. + */ + public boolean hasContent() { + return audioSourceCase_ == 5; + } + /** + * + * + *
+     * The audio data bytes encoded as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+     * with all bytes fields, proto buffers use a pure binary representation,
+     * whereas JSON representations use base64.
+     * 
+ * + * bytes content = 5; + * + * @return The content. + */ + public com.google.protobuf.ByteString getContent() { + if (audioSourceCase_ == 5) { + return (com.google.protobuf.ByteString) audioSource_; + } + return com.google.protobuf.ByteString.EMPTY; + } + /** + * + * + *
+     * The audio data bytes encoded as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+     * with all bytes fields, proto buffers use a pure binary representation,
+     * whereas JSON representations use base64.
+     * 
+ * + * bytes content = 5; + * + * @param value The content to set. + * @return This builder for chaining. + */ + public Builder setContent(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + audioSourceCase_ = 5; + audioSource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The audio data bytes encoded as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+     * with all bytes fields, proto buffers use a pure binary representation,
+     * whereas JSON representations use base64.
+     * 
+ * + * bytes content = 5; + * + * @return This builder for chaining. + */ + public Builder clearContent() { + if (audioSourceCase_ == 5) { + audioSourceCase_ = 0; + audioSource_ = null; + onChanged(); + } + return this; + } + + /** + * + * + *
+     * URI that points to a file that contains audio data bytes as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+     * must not be compressed (for example, gzip). Currently, only Google Cloud
+     * Storage URIs are supported, which must be specified in the following
+     * format: `gs://bucket_name/object_name` (other URI formats return
+     * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+     * information, see [Request
+     * URIs](https://cloud.google.com/storage/docs/reference-uris).
+     * 
+ * + * string uri = 6; + * + * @return Whether the uri field is set. + */ + @java.lang.Override + public boolean hasUri() { + return audioSourceCase_ == 6; + } + /** + * + * + *
+     * URI that points to a file that contains audio data bytes as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+     * must not be compressed (for example, gzip). Currently, only Google Cloud
+     * Storage URIs are supported, which must be specified in the following
+     * format: `gs://bucket_name/object_name` (other URI formats return
+     * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+     * information, see [Request
+     * URIs](https://cloud.google.com/storage/docs/reference-uris).
+     * 
+ * + * string uri = 6; + * + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 6) { + ref = audioSource_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (audioSourceCase_ == 6) { + audioSource_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * URI that points to a file that contains audio data bytes as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+     * must not be compressed (for example, gzip). Currently, only Google Cloud
+     * Storage URIs are supported, which must be specified in the following
+     * format: `gs://bucket_name/object_name` (other URI formats return
+     * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+     * information, see [Request
+     * URIs](https://cloud.google.com/storage/docs/reference-uris).
+     * 
+ * + * string uri = 6; + * + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUriBytes() { + java.lang.Object ref = ""; + if (audioSourceCase_ == 6) { + ref = audioSource_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (audioSourceCase_ == 6) { + audioSource_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * URI that points to a file that contains audio data bytes as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+     * must not be compressed (for example, gzip). Currently, only Google Cloud
+     * Storage URIs are supported, which must be specified in the following
+     * format: `gs://bucket_name/object_name` (other URI formats return
+     * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+     * information, see [Request
+     * URIs](https://cloud.google.com/storage/docs/reference-uris).
+     * 
+ * + * string uri = 6; + * + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + audioSourceCase_ = 6; + audioSource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * URI that points to a file that contains audio data bytes as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+     * must not be compressed (for example, gzip). Currently, only Google Cloud
+     * Storage URIs are supported, which must be specified in the following
+     * format: `gs://bucket_name/object_name` (other URI formats return
+     * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+     * information, see [Request
+     * URIs](https://cloud.google.com/storage/docs/reference-uris).
+     * 
+ * + * string uri = 6; + * + * @return This builder for chaining. + */ + public Builder clearUri() { + if (audioSourceCase_ == 6) { + audioSourceCase_ = 0; + audioSource_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * URI that points to a file that contains audio data bytes as specified in
+     * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+     * must not be compressed (for example, gzip). Currently, only Google Cloud
+     * Storage URIs are supported, which must be specified in the following
+     * format: `gs://bucket_name/object_name` (other URI formats return
+     * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+     * information, see [Request
+     * URIs](https://cloud.google.com/storage/docs/reference-uris).
+     * 
+ * + * string uri = 6; + * + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + audioSourceCase_ = 6; + audioSource_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.RecognizeRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.RecognizeRequest) + private static final com.google.cloud.speech.v2.RecognizeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.RecognizeRequest(); + } + + public static com.google.cloud.speech.v2.RecognizeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RecognizeRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RecognizeRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequestOrBuilder.java new file mode 100644 index 000000000000..9ee6e525fe6f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeRequestOrBuilder.java @@ -0,0 +1,270 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface RecognizeRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.RecognizeRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Recognizer to use during recognition. The
+   * expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + java.lang.String getRecognizer(); + /** + * + * + *
+   * Required. The name of the Recognizer to use during recognition. The
+   * expected format is
+   * `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + com.google.protobuf.ByteString getRecognizerBytes(); + + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+   * can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + * + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+   * can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + * + * @return The config. + */ + com.google.cloud.speech.v2.RecognitionConfig getConfig(); + /** + * + * + *
+   * Features and audio metadata to use for the Automatic Speech Recognition.
+   * This field in combination with the
+   * [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
+   * can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig config = 1; + */ + com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder(); + + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+   * values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + * + * @return Whether the configMask field is set. + */ + boolean hasConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+   * values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + * + * @return The configMask. + */ + com.google.protobuf.FieldMask getConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
+   * values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] override the
+   * values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.RecognizeRequest.config] completely
+   * overrides and replaces the config in the recognizer for this recognition
+   * request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 8; + */ + com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder(); + + /** + * + * + *
+   * The audio data bytes encoded as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+   * with all bytes fields, proto buffers use a pure binary representation,
+   * whereas JSON representations use base64.
+   * 
+ * + * bytes content = 5; + * + * @return Whether the content field is set. + */ + boolean hasContent(); + /** + * + * + *
+   * The audio data bytes encoded as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
+   * with all bytes fields, proto buffers use a pure binary representation,
+   * whereas JSON representations use base64.
+   * 
+ * + * bytes content = 5; + * + * @return The content. + */ + com.google.protobuf.ByteString getContent(); + + /** + * + * + *
+   * URI that points to a file that contains audio data bytes as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+   * must not be compressed (for example, gzip). Currently, only Google Cloud
+   * Storage URIs are supported, which must be specified in the following
+   * format: `gs://bucket_name/object_name` (other URI formats return
+   * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+   * information, see [Request
+   * URIs](https://cloud.google.com/storage/docs/reference-uris).
+   * 
+ * + * string uri = 6; + * + * @return Whether the uri field is set. + */ + boolean hasUri(); + /** + * + * + *
+   * URI that points to a file that contains audio data bytes as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+   * must not be compressed (for example, gzip). Currently, only Google Cloud
+   * Storage URIs are supported, which must be specified in the following
+   * format: `gs://bucket_name/object_name` (other URI formats return
+   * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+   * information, see [Request
+   * URIs](https://cloud.google.com/storage/docs/reference-uris).
+   * 
+ * + * string uri = 6; + * + * @return The uri. + */ + java.lang.String getUri(); + /** + * + * + *
+   * URI that points to a file that contains audio data bytes as specified in
+   * [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
+   * must not be compressed (for example, gzip). Currently, only Google Cloud
+   * Storage URIs are supported, which must be specified in the following
+   * format: `gs://bucket_name/object_name` (other URI formats return
+   * [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
+   * information, see [Request
+   * URIs](https://cloud.google.com/storage/docs/reference-uris).
+   * 
+ * + * string uri = 6; + * + * @return The bytes for uri. + */ + com.google.protobuf.ByteString getUriBytes(); + + public com.google.cloud.speech.v2.RecognizeRequest.AudioSourceCase getAudioSourceCase(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponse.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponse.java new file mode 100644 index 000000000000..4a866b69b02f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponse.java @@ -0,0 +1,1260 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Response message for the
+ * [Recognize][google.cloud.speech.v2.Speech.Recognize] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognizeResponse} + */ +public final class RecognizeResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.RecognizeResponse) + RecognizeResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use RecognizeResponse.newBuilder() to construct. + private RecognizeResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RecognizeResponse() { + results_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RecognizeResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RecognizeResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder subBuilder = null; + if (metadata_ != null) { + subBuilder = metadata_.toBuilder(); + } + metadata_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionResponseMetadata.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(metadata_); + metadata_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.speech.v2.SpeechRecognitionResult.parser(), + extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognizeResponse.class, + com.google.cloud.speech.v2.RecognizeResponse.Builder.class); + } + + public static final int RESULTS_FIELD_NUMBER = 3; + private java.util.List results_; + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + @java.lang.Override + public java.util.List getResultsList() { + return results_; + } + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + @java.lang.Override + public java.util.List + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + @java.lang.Override + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionResult getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionResultOrBuilder getResultsOrBuilder( + int index) { + return results_.get(index); + } + + public static final int METADATA_FIELD_NUMBER = 2; + private com.google.cloud.speech.v2.RecognitionResponseMetadata metadata_; + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + * + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return metadata_ != null; + } + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + * + * @return The metadata. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadata getMetadata() { + return metadata_ == null + ? com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance() + : metadata_; + } + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder getMetadataOrBuilder() { + return getMetadata(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (metadata_ != null) { + output.writeMessage(2, getMetadata()); + } + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(3, results_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (metadata_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getMetadata()); + } + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, results_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.RecognizeResponse)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.RecognizeResponse other = + (com.google.cloud.speech.v2.RecognizeResponse) obj; + + if (!getResultsList().equals(other.getResultsList())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata().equals(other.getMetadata())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.RecognizeResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.RecognizeResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the
+   * [Recognize][google.cloud.speech.v2.Speech.Recognize] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.RecognizeResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.RecognizeResponse) + com.google.cloud.speech.v2.RecognizeResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.RecognizeResponse.class, + com.google.cloud.speech.v2.RecognizeResponse.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.RecognizeResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultsBuilder_.clear(); + } + if (metadataBuilder_ == null) { + metadata_ = null; + } else { + metadata_ = null; + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_RecognizeResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeResponse getDefaultInstanceForType() { + return com.google.cloud.speech.v2.RecognizeResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeResponse build() { + com.google.cloud.speech.v2.RecognizeResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeResponse buildPartial() { + com.google.cloud.speech.v2.RecognizeResponse result = + new com.google.cloud.speech.v2.RecognizeResponse(this); + int from_bitField0_ = bitField0_; + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + if (metadataBuilder_ == null) { + result.metadata_ = metadata_; + } else { + result.metadata_ = metadataBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.RecognizeResponse) { + return mergeFrom((com.google.cloud.speech.v2.RecognizeResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.RecognizeResponse other) { + if (other == com.google.cloud.speech.v2.RecognizeResponse.getDefaultInstance()) return this; + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.RecognizeResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.RecognizeResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList(results_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionResult, + com.google.cloud.speech.v2.SpeechRecognitionResult.Builder, + com.google.cloud.speech.v2.SpeechRecognitionResultOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public java.util.List getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public com.google.cloud.speech.v2.SpeechRecognitionResult getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder setResults(int index, com.google.cloud.speech.v2.SpeechRecognitionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder setResults( + int index, com.google.cloud.speech.v2.SpeechRecognitionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder addResults(com.google.cloud.speech.v2.SpeechRecognitionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder addResults(int index, com.google.cloud.speech.v2.SpeechRecognitionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder addResults( + com.google.cloud.speech.v2.SpeechRecognitionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder addResults( + int index, com.google.cloud.speech.v2.SpeechRecognitionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder addAllResults( + java.lang.Iterable values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public com.google.cloud.speech.v2.SpeechRecognitionResult.Builder getResultsBuilder(int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public com.google.cloud.speech.v2.SpeechRecognitionResultOrBuilder getResultsOrBuilder( + int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public java.util.List + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public com.google.cloud.speech.v2.SpeechRecognitionResult.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.SpeechRecognitionResult.getDefaultInstance()); + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public com.google.cloud.speech.v2.SpeechRecognitionResult.Builder addResultsBuilder(int index) { + return getResultsFieldBuilder() + .addBuilder( + index, com.google.cloud.speech.v2.SpeechRecognitionResult.getDefaultInstance()); + } + /** + * + * + *
+     * Sequential list of transcription results corresponding to sequential
+     * portions of audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionResult, + com.google.cloud.speech.v2.SpeechRecognitionResult.Builder, + com.google.cloud.speech.v2.SpeechRecognitionResultOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionResult, + com.google.cloud.speech.v2.SpeechRecognitionResult.Builder, + com.google.cloud.speech.v2.SpeechRecognitionResultOrBuilder>( + results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private com.google.cloud.speech.v2.RecognitionResponseMetadata metadata_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionResponseMetadata, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder, + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder> + metadataBuilder_; + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + * + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return metadataBuilder_ != null || metadata_ != null; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + * + * @return The metadata. + */ + public com.google.cloud.speech.v2.RecognitionResponseMetadata getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null + ? com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance() + : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + public Builder setMetadata(com.google.cloud.speech.v2.RecognitionResponseMetadata value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + onChanged(); + } else { + metadataBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + public Builder setMetadata( + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + onChanged(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + public Builder mergeMetadata(com.google.cloud.speech.v2.RecognitionResponseMetadata value) { + if (metadataBuilder_ == null) { + if (metadata_ != null) { + metadata_ = + com.google.cloud.speech.v2.RecognitionResponseMetadata.newBuilder(metadata_) + .mergeFrom(value) + .buildPartial(); + } else { + metadata_ = value; + } + onChanged(); + } else { + metadataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + public Builder clearMetadata() { + if (metadataBuilder_ == null) { + metadata_ = null; + onChanged(); + } else { + metadata_ = null; + metadataBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + public com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder getMetadataBuilder() { + + onChanged(); + return getMetadataFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + public com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null + ? com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance() + : metadata_; + } + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionResponseMetadata, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder, + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder> + getMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionResponseMetadata, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder, + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder>( + getMetadata(), getParentForChildren(), isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.RecognizeResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.RecognizeResponse) + private static final com.google.cloud.speech.v2.RecognizeResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.RecognizeResponse(); + } + + public static com.google.cloud.speech.v2.RecognizeResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RecognizeResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RecognizeResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.RecognizeResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponseOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponseOrBuilder.java new file mode 100644 index 000000000000..8d6bea8f3a5d --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizeResponseOrBuilder.java @@ -0,0 +1,117 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface RecognizeResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.RecognizeResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + com.google.cloud.speech.v2.SpeechRecognitionResult getResults(int index); + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + int getResultsCount(); + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * Sequential list of transcription results corresponding to sequential
+   * portions of audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionResult results = 3; + */ + com.google.cloud.speech.v2.SpeechRecognitionResultOrBuilder getResultsOrBuilder(int index); + + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + * + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + * + * @return The metadata. + */ + com.google.cloud.speech.v2.RecognitionResponseMetadata getMetadata(); + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 2; + */ + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder getMetadataOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/Recognizer.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/Recognizer.java new file mode 100644 index 000000000000..e2925fc5128a --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/Recognizer.java @@ -0,0 +1,4570 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * A Recognizer message. Stores recognition configuration and metadata.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.Recognizer} + */ +public final class Recognizer extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.Recognizer) + RecognizerOrBuilder { + private static final long serialVersionUID = 0L; + // Use Recognizer.newBuilder() to construct. + private Recognizer(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Recognizer() { + name_ = ""; + uid_ = ""; + displayName_ = ""; + model_ = ""; + languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + state_ = 0; + etag_ = ""; + kmsKeyName_ = ""; + kmsKeyVersionName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Recognizer(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Recognizer( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + uid_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + model_ = s; + break; + } + case 50: + { + com.google.cloud.speech.v2.RecognitionConfig.Builder subBuilder = null; + if (defaultRecognitionConfig_ != null) { + subBuilder = defaultRecognitionConfig_.toBuilder(); + } + defaultRecognitionConfig_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(defaultRecognitionConfig_); + defaultRecognitionConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + annotations_ = + com.google.protobuf.MapField.newMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + annotations_.getMutableMap().put(annotations__.getKey(), annotations__.getValue()); + break; + } + case 64: + { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + case 74: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 82: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 90: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (deleteTime_ != null) { + subBuilder = deleteTime_.toBuilder(); + } + deleteTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(deleteTime_); + deleteTime_ = subBuilder.buildPartial(); + } + + break; + } + case 98: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 104: + { + reconciling_ = input.readBool(); + break; + } + case 114: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (expireTime_ != null) { + subBuilder = expireTime_.toBuilder(); + } + expireTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(expireTime_); + expireTime_ = subBuilder.buildPartial(); + } + + break; + } + case 122: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyName_ = s; + break; + } + case 130: + { + java.lang.String s = input.readStringRequireUtf8(); + + kmsKeyVersionName_ = s; + break; + } + case 138: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + languageCodes_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + languageCodes_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + languageCodes_ = languageCodes_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Recognizer_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Recognizer_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.Recognizer.class, + com.google.cloud.speech.v2.Recognizer.Builder.class); + } + + /** + * + * + *
+   * Set of states that define the lifecycle of a Recognizer.
+   * 
+ * + * Protobuf enum {@code google.cloud.speech.v2.Recognizer.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * The default value. This value is used if the state is omitted.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * The Recognizer is active and ready for use.
+     * 
+ * + * ACTIVE = 2; + */ + ACTIVE(2), + /** + * + * + *
+     * This Recognizer has been deleted.
+     * 
+ * + * DELETED = 4; + */ + DELETED(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * The default value. This value is used if the state is omitted.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The Recognizer is active and ready for use.
+     * 
+ * + * ACTIVE = 2; + */ + public static final int ACTIVE_VALUE = 2; + /** + * + * + *
+     * This Recognizer has been deleted.
+     * 
+ * + * DELETED = 4; + */ + public static final int DELETED_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 2: + return ACTIVE; + case 4: + return DELETED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.speech.v2.Recognizer.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.speech.v2.Recognizer.State) + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. The resource name of the Recognizer.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The resource name of the Recognizer.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. System-assigned unique identifier for the Recognizer.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. System-assigned unique identifier for the Recognizer.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 3; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * User-settable, human-readable name for the Recognizer. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * User-settable, human-readable name for the Recognizer. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MODEL_FIELD_NUMBER = 4; + private volatile java.lang.Object model_; + /** + * + * + *
+   * Required. Which model to use for recognition requests. Select the model
+   * best suited to your domain to get best results.
+   * Supported models:
+   * - `latest_long`
+   *   Best for long form content like media or conversation.
+   * - `latest_short`
+   *   Best for short form content like commands or single shot directed speech.
+   *   When using this model, the service will stop transcribing audio after the
+   *   first utterance is detected and completed.
+   * When using this model,
+   * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+   * is not supported; multi-channel audio is accepted, but only the first
+   * channel will be processed and transcribed.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The model. + */ + @java.lang.Override + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Which model to use for recognition requests. Select the model
+   * best suited to your domain to get best results.
+   * Supported models:
+   * - `latest_long`
+   *   Best for long form content like media or conversation.
+   * - `latest_short`
+   *   Best for short form content like commands or single shot directed speech.
+   *   When using this model, the service will stop transcribing audio after the
+   *   first utterance is detected and completed.
+   * When using this model,
+   * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+   * is not supported; multi-channel audio is accepted, but only the first
+   * channel will be processed and transcribed.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for model. + */ + @java.lang.Override + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LANGUAGE_CODES_FIELD_NUMBER = 17; + private com.google.protobuf.LazyStringList languageCodes_; + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @return A list containing the languageCodes. + */ + public com.google.protobuf.ProtocolStringList getLanguageCodesList() { + return languageCodes_; + } + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The count of languageCodes. + */ + public int getLanguageCodesCount() { + return languageCodes_.size(); + } + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the element to return. + * @return The languageCodes at the given index. + */ + public java.lang.String getLanguageCodes(int index) { + return languageCodes_.get(index); + } + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the value to return. + * @return The bytes of the languageCodes at the given index. + */ + public com.google.protobuf.ByteString getLanguageCodesBytes(int index) { + return languageCodes_.getByteString(index); + } + + public static final int DEFAULT_RECOGNITION_CONFIG_FIELD_NUMBER = 6; + private com.google.cloud.speech.v2.RecognitionConfig defaultRecognitionConfig_; + /** + * + * + *
+   * Default configuration to use for requests with this Recognizer.
+   * This can be overwritten by inline configuration in the
+   * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+   * field.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + * + * @return Whether the defaultRecognitionConfig field is set. + */ + @java.lang.Override + public boolean hasDefaultRecognitionConfig() { + return defaultRecognitionConfig_ != null; + } + /** + * + * + *
+   * Default configuration to use for requests with this Recognizer.
+   * This can be overwritten by inline configuration in the
+   * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+   * field.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + * + * @return The defaultRecognitionConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig getDefaultRecognitionConfig() { + return defaultRecognitionConfig_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : defaultRecognitionConfig_; + } + /** + * + * + *
+   * Default configuration to use for requests with this Recognizer.
+   * This can be overwritten by inline configuration in the
+   * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+   * field.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder + getDefaultRecognitionConfigOrBuilder() { + return getDefaultRecognitionConfig(); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 7; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Recognizer_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int STATE_FIELD_NUMBER = 8; + private int state_; + /** + * + * + *
+   * Output only. The Recognizer lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Output only. The Recognizer lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.Recognizer.State result = + com.google.cloud.speech.v2.Recognizer.State.valueOf(state_); + return result == null ? com.google.cloud.speech.v2.Recognizer.State.UNRECOGNIZED : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 10; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The most recent time this Recognizer was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The most recent time this Recognizer was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The most recent time this Recognizer was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 11; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. The time at which this Recognizer was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. The time at which this Recognizer was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. The time at which this Recognizer was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int EXPIRE_TIME_FIELD_NUMBER = 14; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+   * Output only. The time at which this Recognizer will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+   * Output only. The time at which this Recognizer will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+   * Output only. The time at which this Recognizer will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + public static final int ETAG_FIELD_NUMBER = 12; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int RECONCILING_FIELD_NUMBER = 13; + private boolean reconciling_; + /** + * + * + *
+   * Output only. Whether or not this Recognizer is in the process of being
+   * updated.
+   * 
+ * + * bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + + public static final int KMS_KEY_NAME_FIELD_NUMBER = 15; + private volatile java.lang.Object kmsKeyName_; + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + @java.lang.Override + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KMS_KEY_VERSION_NAME_FIELD_NUMBER = 16; + private volatile java.lang.Object kmsKeyVersionName_; + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + @java.lang.Override + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, displayName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(model_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, model_); + } + if (defaultRecognitionConfig_ != null) { + output.writeMessage(6, getDefaultRecognitionConfig()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 7); + if (state_ != com.google.cloud.speech.v2.Recognizer.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(8, state_); + } + if (createTime_ != null) { + output.writeMessage(9, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(10, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(11, getDeleteTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 12, etag_); + } + if (reconciling_ != false) { + output.writeBool(13, reconciling_); + } + if (expireTime_ != null) { + output.writeMessage(14, getExpireTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 15, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 16, kmsKeyVersionName_); + } + for (int i = 0; i < languageCodes_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 17, languageCodes_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, displayName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(model_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, model_); + } + if (defaultRecognitionConfig_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, getDefaultRecognitionConfig()); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, annotations__); + } + if (state_ != com.google.cloud.speech.v2.Recognizer.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(8, state_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getDeleteTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, etag_); + } + if (reconciling_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(13, reconciling_); + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, getExpireTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(15, kmsKeyName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kmsKeyVersionName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(16, kmsKeyVersionName_); + } + { + int dataSize = 0; + for (int i = 0; i < languageCodes_.size(); i++) { + dataSize += computeStringSizeNoTag(languageCodes_.getRaw(i)); + } + size += dataSize; + size += 2 * getLanguageCodesList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.Recognizer)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.Recognizer other = (com.google.cloud.speech.v2.Recognizer) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getModel().equals(other.getModel())) return false; + if (!getLanguageCodesList().equals(other.getLanguageCodesList())) return false; + if (hasDefaultRecognitionConfig() != other.hasDefaultRecognitionConfig()) return false; + if (hasDefaultRecognitionConfig()) { + if (!getDefaultRecognitionConfig().equals(other.getDefaultRecognitionConfig())) return false; + } + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (state_ != other.state_) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (!getEtag().equals(other.getEtag())) return false; + if (getReconciling() != other.getReconciling()) return false; + if (!getKmsKeyName().equals(other.getKmsKeyName())) return false; + if (!getKmsKeyVersionName().equals(other.getKmsKeyVersionName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + MODEL_FIELD_NUMBER; + hash = (53 * hash) + getModel().hashCode(); + if (getLanguageCodesCount() > 0) { + hash = (37 * hash) + LANGUAGE_CODES_FIELD_NUMBER; + hash = (53 * hash) + getLanguageCodesList().hashCode(); + } + if (hasDefaultRecognitionConfig()) { + hash = (37 * hash) + DEFAULT_RECOGNITION_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getDefaultRecognitionConfig().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (37 * hash) + RECONCILING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReconciling()); + hash = (37 * hash) + KMS_KEY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyName().hashCode(); + hash = (37 * hash) + KMS_KEY_VERSION_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyVersionName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Recognizer parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.Recognizer parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.Recognizer parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.Recognizer prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A Recognizer message. Stores recognition configuration and metadata.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.Recognizer} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.Recognizer) + com.google.cloud.speech.v2.RecognizerOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Recognizer_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 7: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Recognizer_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.Recognizer.class, + com.google.cloud.speech.v2.Recognizer.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.Recognizer.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + displayName_ = ""; + + model_ = ""; + + languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + if (defaultRecognitionConfigBuilder_ == null) { + defaultRecognitionConfig_ = null; + } else { + defaultRecognitionConfig_ = null; + defaultRecognitionConfigBuilder_ = null; + } + internalGetMutableAnnotations().clear(); + state_ = 0; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + etag_ = ""; + + reconciling_ = false; + + kmsKeyName_ = ""; + + kmsKeyVersionName_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_Recognizer_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer getDefaultInstanceForType() { + return com.google.cloud.speech.v2.Recognizer.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer build() { + com.google.cloud.speech.v2.Recognizer result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer buildPartial() { + com.google.cloud.speech.v2.Recognizer result = + new com.google.cloud.speech.v2.Recognizer(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + result.displayName_ = displayName_; + result.model_ = model_; + if (((bitField0_ & 0x00000001) != 0)) { + languageCodes_ = languageCodes_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.languageCodes_ = languageCodes_; + if (defaultRecognitionConfigBuilder_ == null) { + result.defaultRecognitionConfig_ = defaultRecognitionConfig_; + } else { + result.defaultRecognitionConfig_ = defaultRecognitionConfigBuilder_.build(); + } + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + result.state_ = state_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + result.etag_ = etag_; + result.reconciling_ = reconciling_; + result.kmsKeyName_ = kmsKeyName_; + result.kmsKeyVersionName_ = kmsKeyVersionName_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.Recognizer) { + return mergeFrom((com.google.cloud.speech.v2.Recognizer) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.Recognizer other) { + if (other == com.google.cloud.speech.v2.Recognizer.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (!other.getModel().isEmpty()) { + model_ = other.model_; + onChanged(); + } + if (!other.languageCodes_.isEmpty()) { + if (languageCodes_.isEmpty()) { + languageCodes_ = other.languageCodes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLanguageCodesIsMutable(); + languageCodes_.addAll(other.languageCodes_); + } + onChanged(); + } + if (other.hasDefaultRecognitionConfig()) { + mergeDefaultRecognitionConfig(other.getDefaultRecognitionConfig()); + } + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + if (other.getReconciling() != false) { + setReconciling(other.getReconciling()); + } + if (!other.getKmsKeyName().isEmpty()) { + kmsKeyName_ = other.kmsKeyName_; + onChanged(); + } + if (!other.getKmsKeyVersionName().isEmpty()) { + kmsKeyVersionName_ = other.kmsKeyVersionName_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.Recognizer parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.Recognizer) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The resource name of the Recognizer.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the Recognizer.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the Recognizer.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the Recognizer.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the Recognizer.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. System-assigned unique identifier for the Recognizer.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the Recognizer.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the Recognizer.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the Recognizer.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. System-assigned unique identifier for the Recognizer.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * User-settable, human-readable name for the Recognizer. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User-settable, human-readable name for the Recognizer. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User-settable, human-readable name for the Recognizer. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 3; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User-settable, human-readable name for the Recognizer. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 3; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * User-settable, human-readable name for the Recognizer. Must be 63
+     * characters or less.
+     * 
+ * + * string display_name = 3; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private java.lang.Object model_ = ""; + /** + * + * + *
+     * Required. Which model to use for recognition requests. Select the model
+     * best suited to your domain to get best results.
+     * Supported models:
+     * - `latest_long`
+     *   Best for long form content like media or conversation.
+     * - `latest_short`
+     *   Best for short form content like commands or single shot directed speech.
+     *   When using this model, the service will stop transcribing audio after the
+     *   first utterance is detected and completed.
+     * When using this model,
+     * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+     * is not supported; multi-channel audio is accepted, but only the first
+     * channel will be processed and transcribed.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The model. + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Which model to use for recognition requests. Select the model
+     * best suited to your domain to get best results.
+     * Supported models:
+     * - `latest_long`
+     *   Best for long form content like media or conversation.
+     * - `latest_short`
+     *   Best for short form content like commands or single shot directed speech.
+     *   When using this model, the service will stop transcribing audio after the
+     *   first utterance is detected and completed.
+     * When using this model,
+     * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+     * is not supported; multi-channel audio is accepted, but only the first
+     * channel will be processed and transcribed.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for model. + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Which model to use for recognition requests. Select the model
+     * best suited to your domain to get best results.
+     * Supported models:
+     * - `latest_long`
+     *   Best for long form content like media or conversation.
+     * - `latest_short`
+     *   Best for short form content like commands or single shot directed speech.
+     *   When using this model, the service will stop transcribing audio after the
+     *   first utterance is detected and completed.
+     * When using this model,
+     * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+     * is not supported; multi-channel audio is accepted, but only the first
+     * channel will be processed and transcribed.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The model to set. + * @return This builder for chaining. + */ + public Builder setModel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + model_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Which model to use for recognition requests. Select the model
+     * best suited to your domain to get best results.
+     * Supported models:
+     * - `latest_long`
+     *   Best for long form content like media or conversation.
+     * - `latest_short`
+     *   Best for short form content like commands or single shot directed speech.
+     *   When using this model, the service will stop transcribing audio after the
+     *   first utterance is detected and completed.
+     * When using this model,
+     * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+     * is not supported; multi-channel audio is accepted, but only the first
+     * channel will be processed and transcribed.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearModel() { + + model_ = getDefaultInstance().getModel(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Which model to use for recognition requests. Select the model
+     * best suited to your domain to get best results.
+     * Supported models:
+     * - `latest_long`
+     *   Best for long form content like media or conversation.
+     * - `latest_short`
+     *   Best for short form content like commands or single shot directed speech.
+     *   When using this model, the service will stop transcribing audio after the
+     *   first utterance is detected and completed.
+     * When using this model,
+     * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+     * is not supported; multi-channel audio is accepted, but only the first
+     * channel will be processed and transcribed.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for model to set. + * @return This builder for chaining. + */ + public Builder setModelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + model_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList languageCodes_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureLanguageCodesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + languageCodes_ = new com.google.protobuf.LazyStringArrayList(languageCodes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @return A list containing the languageCodes. + */ + public com.google.protobuf.ProtocolStringList getLanguageCodesList() { + return languageCodes_.getUnmodifiableView(); + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The count of languageCodes. + */ + public int getLanguageCodesCount() { + return languageCodes_.size(); + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the element to return. + * @return The languageCodes at the given index. + */ + public java.lang.String getLanguageCodes(int index) { + return languageCodes_.get(index); + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the value to return. + * @return The bytes of the languageCodes at the given index. + */ + public com.google.protobuf.ByteString getLanguageCodesBytes(int index) { + return languageCodes_.getByteString(index); + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index to set the value at. + * @param value The languageCodes to set. + * @return This builder for chaining. + */ + public Builder setLanguageCodes(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguageCodesIsMutable(); + languageCodes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The languageCodes to add. + * @return This builder for chaining. + */ + public Builder addLanguageCodes(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguageCodesIsMutable(); + languageCodes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param values The languageCodes to add. + * @return This builder for chaining. + */ + public Builder addAllLanguageCodes(java.lang.Iterable values) { + ensureLanguageCodesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, languageCodes_); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearLanguageCodes() { + languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The language of the supplied audio as a
+     * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+     * Supported languages:
+     * - `en-US`
+     * - `en-GB`
+     * - `fr-FR`
+     * If additional languages are provided, recognition result will contain
+     * recognition in the most likely language detected. The recognition result
+     * will include the language tag of the language detected in the audio.
+     * When you create or update a Recognizer, these values are
+     * stored in normalized BCP-47 form. For example, "en-us" is stored as
+     * "en-US".
+     * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes of the languageCodes to add. + * @return This builder for chaining. + */ + public Builder addLanguageCodesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureLanguageCodesIsMutable(); + languageCodes_.add(value); + onChanged(); + return this; + } + + private com.google.cloud.speech.v2.RecognitionConfig defaultRecognitionConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + defaultRecognitionConfigBuilder_; + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + * + * @return Whether the defaultRecognitionConfig field is set. + */ + public boolean hasDefaultRecognitionConfig() { + return defaultRecognitionConfigBuilder_ != null || defaultRecognitionConfig_ != null; + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + * + * @return The defaultRecognitionConfig. + */ + public com.google.cloud.speech.v2.RecognitionConfig getDefaultRecognitionConfig() { + if (defaultRecognitionConfigBuilder_ == null) { + return defaultRecognitionConfig_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : defaultRecognitionConfig_; + } else { + return defaultRecognitionConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + public Builder setDefaultRecognitionConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (defaultRecognitionConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + defaultRecognitionConfig_ = value; + onChanged(); + } else { + defaultRecognitionConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + public Builder setDefaultRecognitionConfig( + com.google.cloud.speech.v2.RecognitionConfig.Builder builderForValue) { + if (defaultRecognitionConfigBuilder_ == null) { + defaultRecognitionConfig_ = builderForValue.build(); + onChanged(); + } else { + defaultRecognitionConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + public Builder mergeDefaultRecognitionConfig( + com.google.cloud.speech.v2.RecognitionConfig value) { + if (defaultRecognitionConfigBuilder_ == null) { + if (defaultRecognitionConfig_ != null) { + defaultRecognitionConfig_ = + com.google.cloud.speech.v2.RecognitionConfig.newBuilder(defaultRecognitionConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + defaultRecognitionConfig_ = value; + } + onChanged(); + } else { + defaultRecognitionConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + public Builder clearDefaultRecognitionConfig() { + if (defaultRecognitionConfigBuilder_ == null) { + defaultRecognitionConfig_ = null; + onChanged(); + } else { + defaultRecognitionConfig_ = null; + defaultRecognitionConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + public com.google.cloud.speech.v2.RecognitionConfig.Builder + getDefaultRecognitionConfigBuilder() { + + onChanged(); + return getDefaultRecognitionConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder + getDefaultRecognitionConfigOrBuilder() { + if (defaultRecognitionConfigBuilder_ != null) { + return defaultRecognitionConfigBuilder_.getMessageOrBuilder(); + } else { + return defaultRecognitionConfig_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : defaultRecognitionConfig_; + } + } + /** + * + * + *
+     * Default configuration to use for requests with this Recognizer.
+     * This can be overwritten by inline configuration in the
+     * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+     * field.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + getDefaultRecognitionConfigFieldBuilder() { + if (defaultRecognitionConfigBuilder_ == null) { + defaultRecognitionConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder>( + getDefaultRecognitionConfig(), getParentForChildren(), isClean()); + defaultRecognitionConfig_ = null; + } + return defaultRecognitionConfigBuilder_; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 7; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 7; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 7; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Allows users to store small amounts of arbitrary data.
+     * Both the key and the value must be 63 characters or less each.
+     * At most 100 annotations.
+     * 
+ * + * map<string, string> annotations = 7; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * Output only. The Recognizer lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Output only. The Recognizer lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The Recognizer lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.Recognizer.State result = + com.google.cloud.speech.v2.Recognizer.State.valueOf(state_); + return result == null ? com.google.cloud.speech.v2.Recognizer.State.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Output only. The Recognizer lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.cloud.speech.v2.Recognizer.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The Recognizer lifecycle state.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. Creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The most recent time this Recognizer was modified.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. The time at which this Recognizer was requested for deletion.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_).mergeFrom(value).buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+     * Output only. The time at which this Recognizer will be purged.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields. This may be sent on update, undelete, and delete requests to
+     * ensure the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + private boolean reconciling_; + /** + * + * + *
+     * Output only. Whether or not this Recognizer is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + /** + * + * + *
+     * Output only. Whether or not this Recognizer is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The reconciling to set. + * @return This builder for chaining. + */ + public Builder setReconciling(boolean value) { + + reconciling_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Whether or not this Recognizer is in the process of being
+     * updated.
+     * 
+ * + * bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearReconciling() { + + reconciling_ = false; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyName_ = ""; + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyName() { + + kmsKeyName_ = getDefaultInstance().getKmsKeyName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+     * the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+     * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyName_ = value; + onChanged(); + return this; + } + + private java.lang.Object kmsKeyVersionName_ = ""; + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + public java.lang.String getKmsKeyVersionName() { + java.lang.Object ref = kmsKeyVersionName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyVersionName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + public com.google.protobuf.ByteString getKmsKeyVersionNameBytes() { + java.lang.Object ref = kmsKeyVersionName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyVersionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyVersionName() { + + kmsKeyVersionName_ = getDefaultInstance().getKmsKeyVersionName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [KMS key version
+     * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+     * with which the Recognizer is encrypted. The expected format is
+     * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+     * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyVersionName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyVersionNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kmsKeyVersionName_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.Recognizer) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.Recognizer) + private static final com.google.cloud.speech.v2.Recognizer DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.Recognizer(); + } + + public static com.google.cloud.speech.v2.Recognizer getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Recognizer parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Recognizer(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerName.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerName.java new file mode 100644 index 000000000000..31ce68bc5de0 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerName.java @@ -0,0 +1,223 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class RecognizerName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_RECOGNIZER = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/recognizers/{recognizer}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String recognizer; + + @Deprecated + protected RecognizerName() { + project = null; + location = null; + recognizer = null; + } + + private RecognizerName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + recognizer = Preconditions.checkNotNull(builder.getRecognizer()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getRecognizer() { + return recognizer; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static RecognizerName of(String project, String location, String recognizer) { + return newBuilder().setProject(project).setLocation(location).setRecognizer(recognizer).build(); + } + + public static String format(String project, String location, String recognizer) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setRecognizer(recognizer) + .build() + .toString(); + } + + public static RecognizerName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_RECOGNIZER.validatedMatch( + formattedString, "RecognizerName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("recognizer")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (RecognizerName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_RECOGNIZER.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (recognizer != null) { + fieldMapBuilder.put("recognizer", recognizer); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_RECOGNIZER.instantiate( + "project", project, "location", location, "recognizer", recognizer); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + RecognizerName that = ((RecognizerName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.recognizer, that.recognizer); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(recognizer); + return h; + } + + /** Builder for projects/{project}/locations/{location}/recognizers/{recognizer}. */ + public static class Builder { + private String project; + private String location; + private String recognizer; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getRecognizer() { + return recognizer; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setRecognizer(String recognizer) { + this.recognizer = recognizer; + return this; + } + + private Builder(RecognizerName recognizerName) { + this.project = recognizerName.project; + this.location = recognizerName.location; + this.recognizer = recognizerName.recognizer; + } + + public RecognizerName build() { + return new RecognizerName(this); + } + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerOrBuilder.java new file mode 100644 index 000000000000..bebf68b68c8e --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/RecognizerOrBuilder.java @@ -0,0 +1,655 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface RecognizerOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.Recognizer) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The resource name of the Recognizer.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The resource name of the Recognizer.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. System-assigned unique identifier for the Recognizer.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. System-assigned unique identifier for the Recognizer.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * User-settable, human-readable name for the Recognizer. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * User-settable, human-readable name for the Recognizer. Must be 63
+   * characters or less.
+   * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Required. Which model to use for recognition requests. Select the model
+   * best suited to your domain to get best results.
+   * Supported models:
+   * - `latest_long`
+   *   Best for long form content like media or conversation.
+   * - `latest_short`
+   *   Best for short form content like commands or single shot directed speech.
+   *   When using this model, the service will stop transcribing audio after the
+   *   first utterance is detected and completed.
+   * When using this model,
+   * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+   * is not supported; multi-channel audio is accepted, but only the first
+   * channel will be processed and transcribed.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The model. + */ + java.lang.String getModel(); + /** + * + * + *
+   * Required. Which model to use for recognition requests. Select the model
+   * best suited to your domain to get best results.
+   * Supported models:
+   * - `latest_long`
+   *   Best for long form content like media or conversation.
+   * - `latest_short`
+   *   Best for short form content like commands or single shot directed speech.
+   *   When using this model, the service will stop transcribing audio after the
+   *   first utterance is detected and completed.
+   * When using this model,
+   * [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL]
+   * is not supported; multi-channel audio is accepted, but only the first
+   * channel will be processed and transcribed.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for model. + */ + com.google.protobuf.ByteString getModelBytes(); + + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @return A list containing the languageCodes. + */ + java.util.List getLanguageCodesList(); + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The count of languageCodes. + */ + int getLanguageCodesCount(); + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the element to return. + * @return The languageCodes at the given index. + */ + java.lang.String getLanguageCodes(int index); + /** + * + * + *
+   * Required. The language of the supplied audio as a
+   * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
+   * Supported languages:
+   * - `en-US`
+   * - `en-GB`
+   * - `fr-FR`
+   * If additional languages are provided, recognition result will contain
+   * recognition in the most likely language detected. The recognition result
+   * will include the language tag of the language detected in the audio.
+   * When you create or update a Recognizer, these values are
+   * stored in normalized BCP-47 form. For example, "en-us" is stored as
+   * "en-US".
+   * 
+ * + * repeated string language_codes = 17 [(.google.api.field_behavior) = REQUIRED]; + * + * @param index The index of the value to return. + * @return The bytes of the languageCodes at the given index. + */ + com.google.protobuf.ByteString getLanguageCodesBytes(int index); + + /** + * + * + *
+   * Default configuration to use for requests with this Recognizer.
+   * This can be overwritten by inline configuration in the
+   * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+   * field.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + * + * @return Whether the defaultRecognitionConfig field is set. + */ + boolean hasDefaultRecognitionConfig(); + /** + * + * + *
+   * Default configuration to use for requests with this Recognizer.
+   * This can be overwritten by inline configuration in the
+   * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+   * field.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + * + * @return The defaultRecognitionConfig. + */ + com.google.cloud.speech.v2.RecognitionConfig getDefaultRecognitionConfig(); + /** + * + * + *
+   * Default configuration to use for requests with this Recognizer.
+   * This can be overwritten by inline configuration in the
+   * [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
+   * field.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionConfig default_recognition_config = 6; + */ + com.google.cloud.speech.v2.RecognitionConfigOrBuilder getDefaultRecognitionConfigOrBuilder(); + + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * Allows users to store small amounts of arbitrary data.
+   * Both the key and the value must be 63 characters or less each.
+   * At most 100 annotations.
+   * 
+ * + * map<string, string> annotations = 7; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. The Recognizer lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Output only. The Recognizer lifecycle state.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.cloud.speech.v2.Recognizer.State getState(); + + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. Creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The most recent time this Recognizer was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this Recognizer was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The most recent time this Recognizer was modified.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time at which this Recognizer was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. The time at which this Recognizer was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. The time at which this Recognizer was requested for deletion.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time at which this Recognizer will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+   * Output only. The time at which this Recognizer will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+   * Output only. The time at which this Recognizer will be purged.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields. This may be sent on update, undelete, and delete requests to
+   * ensure the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); + + /** + * + * + *
+   * Output only. Whether or not this Recognizer is in the process of being
+   * updated.
+   * 
+ * + * bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + boolean getReconciling(); + + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + java.lang.String getKmsKeyName(); + /** + * + * + *
+   * Output only. The [KMS key
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
+   * the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
+   * 
+ * + * + * string kms_key_name = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + com.google.protobuf.ByteString getKmsKeyNameBytes(); + + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyVersionName. + */ + java.lang.String getKmsKeyVersionName(); + /** + * + * + *
+   * Output only. The [KMS key version
+   * name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
+   * with which the Recognizer is encrypted. The expected format is
+   * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
+   * 
+ * + * + * string kms_key_version_name = 16 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyVersionName. + */ + com.google.protobuf.ByteString getKmsKeyVersionNameBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfig.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfig.java new file mode 100644 index 000000000000..8885f90670d1 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfig.java @@ -0,0 +1,666 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Configuration to enable speaker diarization.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeakerDiarizationConfig} + */ +public final class SpeakerDiarizationConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.SpeakerDiarizationConfig) + SpeakerDiarizationConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use SpeakerDiarizationConfig.newBuilder() to construct. + private SpeakerDiarizationConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SpeakerDiarizationConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SpeakerDiarizationConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SpeakerDiarizationConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 16: + { + minSpeakerCount_ = input.readInt32(); + break; + } + case 24: + { + maxSpeakerCount_ = input.readInt32(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeakerDiarizationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeakerDiarizationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeakerDiarizationConfig.class, + com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder.class); + } + + public static final int MIN_SPEAKER_COUNT_FIELD_NUMBER = 2; + private int minSpeakerCount_; + /** + * + * + *
+   * Required. Minimum number of speakers in the conversation. This range gives
+   * you more flexibility by allowing the system to automatically determine the
+   * correct number of speakers. If not set, the default value is 2.
+   * To fix the number of speakers detected in the audio, set
+   * `min_speaker_count` = `max_speaker_count`.
+   * 
+ * + * int32 min_speaker_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The minSpeakerCount. + */ + @java.lang.Override + public int getMinSpeakerCount() { + return minSpeakerCount_; + } + + public static final int MAX_SPEAKER_COUNT_FIELD_NUMBER = 3; + private int maxSpeakerCount_; + /** + * + * + *
+   * Required. Maximum number of speakers in the conversation. Valid values are:
+   * 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility
+   * by allowing the system to automatically determine the correct number of
+   * speakers.
+   * 
+ * + * int32 max_speaker_count = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The maxSpeakerCount. + */ + @java.lang.Override + public int getMaxSpeakerCount() { + return maxSpeakerCount_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (minSpeakerCount_ != 0) { + output.writeInt32(2, minSpeakerCount_); + } + if (maxSpeakerCount_ != 0) { + output.writeInt32(3, maxSpeakerCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (minSpeakerCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, minSpeakerCount_); + } + if (maxSpeakerCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, maxSpeakerCount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.SpeakerDiarizationConfig)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.SpeakerDiarizationConfig other = + (com.google.cloud.speech.v2.SpeakerDiarizationConfig) obj; + + if (getMinSpeakerCount() != other.getMinSpeakerCount()) return false; + if (getMaxSpeakerCount() != other.getMaxSpeakerCount()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MIN_SPEAKER_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getMinSpeakerCount(); + hash = (37 * hash) + MAX_SPEAKER_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getMaxSpeakerCount(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.SpeakerDiarizationConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configuration to enable speaker diarization.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeakerDiarizationConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.SpeakerDiarizationConfig) + com.google.cloud.speech.v2.SpeakerDiarizationConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeakerDiarizationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeakerDiarizationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeakerDiarizationConfig.class, + com.google.cloud.speech.v2.SpeakerDiarizationConfig.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.SpeakerDiarizationConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + minSpeakerCount_ = 0; + + maxSpeakerCount_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeakerDiarizationConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeakerDiarizationConfig getDefaultInstanceForType() { + return com.google.cloud.speech.v2.SpeakerDiarizationConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeakerDiarizationConfig build() { + com.google.cloud.speech.v2.SpeakerDiarizationConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeakerDiarizationConfig buildPartial() { + com.google.cloud.speech.v2.SpeakerDiarizationConfig result = + new com.google.cloud.speech.v2.SpeakerDiarizationConfig(this); + result.minSpeakerCount_ = minSpeakerCount_; + result.maxSpeakerCount_ = maxSpeakerCount_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.SpeakerDiarizationConfig) { + return mergeFrom((com.google.cloud.speech.v2.SpeakerDiarizationConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.SpeakerDiarizationConfig other) { + if (other == com.google.cloud.speech.v2.SpeakerDiarizationConfig.getDefaultInstance()) + return this; + if (other.getMinSpeakerCount() != 0) { + setMinSpeakerCount(other.getMinSpeakerCount()); + } + if (other.getMaxSpeakerCount() != 0) { + setMaxSpeakerCount(other.getMaxSpeakerCount()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.SpeakerDiarizationConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.SpeakerDiarizationConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int minSpeakerCount_; + /** + * + * + *
+     * Required. Minimum number of speakers in the conversation. This range gives
+     * you more flexibility by allowing the system to automatically determine the
+     * correct number of speakers. If not set, the default value is 2.
+     * To fix the number of speakers detected in the audio, set
+     * `min_speaker_count` = `max_speaker_count`.
+     * 
+ * + * int32 min_speaker_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The minSpeakerCount. + */ + @java.lang.Override + public int getMinSpeakerCount() { + return minSpeakerCount_; + } + /** + * + * + *
+     * Required. Minimum number of speakers in the conversation. This range gives
+     * you more flexibility by allowing the system to automatically determine the
+     * correct number of speakers. If not set, the default value is 2.
+     * To fix the number of speakers detected in the audio, set
+     * `min_speaker_count` = `max_speaker_count`.
+     * 
+ * + * int32 min_speaker_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The minSpeakerCount to set. + * @return This builder for chaining. + */ + public Builder setMinSpeakerCount(int value) { + + minSpeakerCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Minimum number of speakers in the conversation. This range gives
+     * you more flexibility by allowing the system to automatically determine the
+     * correct number of speakers. If not set, the default value is 2.
+     * To fix the number of speakers detected in the audio, set
+     * `min_speaker_count` = `max_speaker_count`.
+     * 
+ * + * int32 min_speaker_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearMinSpeakerCount() { + + minSpeakerCount_ = 0; + onChanged(); + return this; + } + + private int maxSpeakerCount_; + /** + * + * + *
+     * Required. Maximum number of speakers in the conversation. Valid values are:
+     * 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility
+     * by allowing the system to automatically determine the correct number of
+     * speakers.
+     * 
+ * + * int32 max_speaker_count = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The maxSpeakerCount. + */ + @java.lang.Override + public int getMaxSpeakerCount() { + return maxSpeakerCount_; + } + /** + * + * + *
+     * Required. Maximum number of speakers in the conversation. Valid values are:
+     * 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility
+     * by allowing the system to automatically determine the correct number of
+     * speakers.
+     * 
+ * + * int32 max_speaker_count = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The maxSpeakerCount to set. + * @return This builder for chaining. + */ + public Builder setMaxSpeakerCount(int value) { + + maxSpeakerCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Maximum number of speakers in the conversation. Valid values are:
+     * 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility
+     * by allowing the system to automatically determine the correct number of
+     * speakers.
+     * 
+ * + * int32 max_speaker_count = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearMaxSpeakerCount() { + + maxSpeakerCount_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.SpeakerDiarizationConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.SpeakerDiarizationConfig) + private static final com.google.cloud.speech.v2.SpeakerDiarizationConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.SpeakerDiarizationConfig(); + } + + public static com.google.cloud.speech.v2.SpeakerDiarizationConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SpeakerDiarizationConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SpeakerDiarizationConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeakerDiarizationConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfigOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfigOrBuilder.java new file mode 100644 index 000000000000..8b55c737a86b --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeakerDiarizationConfigOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface SpeakerDiarizationConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.SpeakerDiarizationConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Minimum number of speakers in the conversation. This range gives
+   * you more flexibility by allowing the system to automatically determine the
+   * correct number of speakers. If not set, the default value is 2.
+   * To fix the number of speakers detected in the audio, set
+   * `min_speaker_count` = `max_speaker_count`.
+   * 
+ * + * int32 min_speaker_count = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The minSpeakerCount. + */ + int getMinSpeakerCount(); + + /** + * + * + *
+   * Required. Maximum number of speakers in the conversation. Valid values are:
+   * 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility
+   * by allowing the system to automatically determine the correct number of
+   * speakers.
+   * 
+ * + * int32 max_speaker_count = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The maxSpeakerCount. + */ + int getMaxSpeakerCount(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptation.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptation.java new file mode 100644 index 000000000000..b68d9addb682 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptation.java @@ -0,0 +1,2680 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Provides "hints" to the speech recognizer to favor specific words and phrases
+ * in the results. Phrase sets can be specified as an inline resource, or a
+ * reference to an existing phrase set resource.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechAdaptation} + */ +public final class SpeechAdaptation extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.SpeechAdaptation) + SpeechAdaptationOrBuilder { + private static final long serialVersionUID = 0L; + // Use SpeechAdaptation.newBuilder() to construct. + private SpeechAdaptation(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SpeechAdaptation() { + phraseSets_ = java.util.Collections.emptyList(); + customClasses_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SpeechAdaptation(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SpeechAdaptation( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + phraseSets_ = + new java.util.ArrayList< + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet>(); + mutable_bitField0_ |= 0x00000001; + } + phraseSets_.add( + input.readMessage( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.parser(), + extensionRegistry)); + break; + } + case 18: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + customClasses_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + customClasses_.add( + input.readMessage( + com.google.cloud.speech.v2.CustomClass.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + phraseSets_ = java.util.Collections.unmodifiableList(phraseSets_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + customClasses_ = java.util.Collections.unmodifiableList(customClasses_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechAdaptation.class, + com.google.cloud.speech.v2.SpeechAdaptation.Builder.class); + } + + public interface AdaptationPhraseSetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The name of an existing phrase set resource. The user must have read
+     * access to the resource and it must not be deleted.
+     * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return Whether the phraseSet field is set. + */ + boolean hasPhraseSet(); + /** + * + * + *
+     * The name of an existing phrase set resource. The user must have read
+     * access to the resource and it must not be deleted.
+     * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return The phraseSet. + */ + java.lang.String getPhraseSet(); + /** + * + * + *
+     * The name of an existing phrase set resource. The user must have read
+     * access to the resource and it must not be deleted.
+     * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for phraseSet. + */ + com.google.protobuf.ByteString getPhraseSetBytes(); + + /** + * + * + *
+     * An inline defined phrase set.
+     * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + * + * @return Whether the inlinePhraseSet field is set. + */ + boolean hasInlinePhraseSet(); + /** + * + * + *
+     * An inline defined phrase set.
+     * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + * + * @return The inlinePhraseSet. + */ + com.google.cloud.speech.v2.PhraseSet getInlinePhraseSet(); + /** + * + * + *
+     * An inline defined phrase set.
+     * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + com.google.cloud.speech.v2.PhraseSetOrBuilder getInlinePhraseSetOrBuilder(); + + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.ValueCase getValueCase(); + } + /** + * + * + *
+   * A biasing phrase set, which can be either a string referencing the name of
+   * an existing phrase set resource, or an inline definition of a phrase set.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet} + */ + public static final class AdaptationPhraseSet extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) + AdaptationPhraseSetOrBuilder { + private static final long serialVersionUID = 0L; + // Use AdaptationPhraseSet.newBuilder() to construct. + private AdaptationPhraseSet(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AdaptationPhraseSet() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AdaptationPhraseSet(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AdaptationPhraseSet( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + valueCase_ = 1; + value_ = s; + break; + } + case 18: + { + com.google.cloud.speech.v2.PhraseSet.Builder subBuilder = null; + if (valueCase_ == 2) { + subBuilder = ((com.google.cloud.speech.v2.PhraseSet) value_).toBuilder(); + } + value_ = + input.readMessage( + com.google.cloud.speech.v2.PhraseSet.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.speech.v2.PhraseSet) value_); + value_ = subBuilder.buildPartial(); + } + valueCase_ = 2; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_AdaptationPhraseSet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_AdaptationPhraseSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.class, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder.class); + } + + private int valueCase_ = 0; + private java.lang.Object value_; + + public enum ValueCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PHRASE_SET(1), + INLINE_PHRASE_SET(2), + VALUE_NOT_SET(0); + private final int value; + + private ValueCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ValueCase valueOf(int value) { + return forNumber(value); + } + + public static ValueCase forNumber(int value) { + switch (value) { + case 1: + return PHRASE_SET; + case 2: + return INLINE_PHRASE_SET; + case 0: + return VALUE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ValueCase getValueCase() { + return ValueCase.forNumber(valueCase_); + } + + public static final int PHRASE_SET_FIELD_NUMBER = 1; + /** + * + * + *
+     * The name of an existing phrase set resource. The user must have read
+     * access to the resource and it must not be deleted.
+     * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return Whether the phraseSet field is set. + */ + public boolean hasPhraseSet() { + return valueCase_ == 1; + } + /** + * + * + *
+     * The name of an existing phrase set resource. The user must have read
+     * access to the resource and it must not be deleted.
+     * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return The phraseSet. + */ + public java.lang.String getPhraseSet() { + java.lang.Object ref = ""; + if (valueCase_ == 1) { + ref = value_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (valueCase_ == 1) { + value_ = s; + } + return s; + } + } + /** + * + * + *
+     * The name of an existing phrase set resource. The user must have read
+     * access to the resource and it must not be deleted.
+     * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for phraseSet. + */ + public com.google.protobuf.ByteString getPhraseSetBytes() { + java.lang.Object ref = ""; + if (valueCase_ == 1) { + ref = value_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (valueCase_ == 1) { + value_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INLINE_PHRASE_SET_FIELD_NUMBER = 2; + /** + * + * + *
+     * An inline defined phrase set.
+     * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + * + * @return Whether the inlinePhraseSet field is set. + */ + @java.lang.Override + public boolean hasInlinePhraseSet() { + return valueCase_ == 2; + } + /** + * + * + *
+     * An inline defined phrase set.
+     * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + * + * @return The inlinePhraseSet. + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet getInlinePhraseSet() { + if (valueCase_ == 2) { + return (com.google.cloud.speech.v2.PhraseSet) value_; + } + return com.google.cloud.speech.v2.PhraseSet.getDefaultInstance(); + } + /** + * + * + *
+     * An inline defined phrase set.
+     * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSetOrBuilder getInlinePhraseSetOrBuilder() { + if (valueCase_ == 2) { + return (com.google.cloud.speech.v2.PhraseSet) value_; + } + return com.google.cloud.speech.v2.PhraseSet.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (valueCase_ == 1) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_); + } + if (valueCase_ == 2) { + output.writeMessage(2, (com.google.cloud.speech.v2.PhraseSet) value_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (valueCase_ == 1) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_); + } + if (valueCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.speech.v2.PhraseSet) value_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet other = + (com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) obj; + + if (!getValueCase().equals(other.getValueCase())) return false; + switch (valueCase_) { + case 1: + if (!getPhraseSet().equals(other.getPhraseSet())) return false; + break; + case 2: + if (!getInlinePhraseSet().equals(other.getInlinePhraseSet())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (valueCase_) { + case 1: + hash = (37 * hash) + PHRASE_SET_FIELD_NUMBER; + hash = (53 * hash) + getPhraseSet().hashCode(); + break; + case 2: + hash = (37 * hash) + INLINE_PHRASE_SET_FIELD_NUMBER; + hash = (53 * hash) + getInlinePhraseSet().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * A biasing phrase set, which can be either a string referencing the name of
+     * an existing phrase set resource, or an inline definition of a phrase set.
+     * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_AdaptationPhraseSet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_AdaptationPhraseSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.class, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder.class); + } + + // Construct using + // com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + valueCase_ = 0; + value_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_AdaptationPhraseSet_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet + getDefaultInstanceForType() { + return com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet build() { + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet buildPartial() { + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet result = + new com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet(this); + if (valueCase_ == 1) { + result.value_ = value_; + } + if (valueCase_ == 2) { + if (inlinePhraseSetBuilder_ == null) { + result.value_ = value_; + } else { + result.value_ = inlinePhraseSetBuilder_.build(); + } + } + result.valueCase_ = valueCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) { + return mergeFrom((com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet other) { + if (other + == com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.getDefaultInstance()) + return this; + switch (other.getValueCase()) { + case PHRASE_SET: + { + valueCase_ = 1; + value_ = other.value_; + onChanged(); + break; + } + case INLINE_PHRASE_SET: + { + mergeInlinePhraseSet(other.getInlinePhraseSet()); + break; + } + case VALUE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int valueCase_ = 0; + private java.lang.Object value_; + + public ValueCase getValueCase() { + return ValueCase.forNumber(valueCase_); + } + + public Builder clearValue() { + valueCase_ = 0; + value_ = null; + onChanged(); + return this; + } + + /** + * + * + *
+       * The name of an existing phrase set resource. The user must have read
+       * access to the resource and it must not be deleted.
+       * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return Whether the phraseSet field is set. + */ + @java.lang.Override + public boolean hasPhraseSet() { + return valueCase_ == 1; + } + /** + * + * + *
+       * The name of an existing phrase set resource. The user must have read
+       * access to the resource and it must not be deleted.
+       * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return The phraseSet. + */ + @java.lang.Override + public java.lang.String getPhraseSet() { + java.lang.Object ref = ""; + if (valueCase_ == 1) { + ref = value_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (valueCase_ == 1) { + value_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The name of an existing phrase set resource. The user must have read
+       * access to the resource and it must not be deleted.
+       * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for phraseSet. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPhraseSetBytes() { + java.lang.Object ref = ""; + if (valueCase_ == 1) { + ref = value_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (valueCase_ == 1) { + value_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The name of an existing phrase set resource. The user must have read
+       * access to the resource and it must not be deleted.
+       * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @param value The phraseSet to set. + * @return This builder for chaining. + */ + public Builder setPhraseSet(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + valueCase_ = 1; + value_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The name of an existing phrase set resource. The user must have read
+       * access to the resource and it must not be deleted.
+       * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @return This builder for chaining. + */ + public Builder clearPhraseSet() { + if (valueCase_ == 1) { + valueCase_ = 0; + value_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+       * The name of an existing phrase set resource. The user must have read
+       * access to the resource and it must not be deleted.
+       * 
+ * + * string phrase_set = 1 [(.google.api.resource_reference) = { ... } + * + * @param value The bytes for phraseSet to set. + * @return This builder for chaining. + */ + public Builder setPhraseSetBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + valueCase_ = 1; + value_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + inlinePhraseSetBuilder_; + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + * + * @return Whether the inlinePhraseSet field is set. + */ + @java.lang.Override + public boolean hasInlinePhraseSet() { + return valueCase_ == 2; + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + * + * @return The inlinePhraseSet. + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet getInlinePhraseSet() { + if (inlinePhraseSetBuilder_ == null) { + if (valueCase_ == 2) { + return (com.google.cloud.speech.v2.PhraseSet) value_; + } + return com.google.cloud.speech.v2.PhraseSet.getDefaultInstance(); + } else { + if (valueCase_ == 2) { + return inlinePhraseSetBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.PhraseSet.getDefaultInstance(); + } + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + public Builder setInlinePhraseSet(com.google.cloud.speech.v2.PhraseSet value) { + if (inlinePhraseSetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + value_ = value; + onChanged(); + } else { + inlinePhraseSetBuilder_.setMessage(value); + } + valueCase_ = 2; + return this; + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + public Builder setInlinePhraseSet( + com.google.cloud.speech.v2.PhraseSet.Builder builderForValue) { + if (inlinePhraseSetBuilder_ == null) { + value_ = builderForValue.build(); + onChanged(); + } else { + inlinePhraseSetBuilder_.setMessage(builderForValue.build()); + } + valueCase_ = 2; + return this; + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + public Builder mergeInlinePhraseSet(com.google.cloud.speech.v2.PhraseSet value) { + if (inlinePhraseSetBuilder_ == null) { + if (valueCase_ == 2 + && value_ != com.google.cloud.speech.v2.PhraseSet.getDefaultInstance()) { + value_ = + com.google.cloud.speech.v2.PhraseSet.newBuilder( + (com.google.cloud.speech.v2.PhraseSet) value_) + .mergeFrom(value) + .buildPartial(); + } else { + value_ = value; + } + onChanged(); + } else { + if (valueCase_ == 2) { + inlinePhraseSetBuilder_.mergeFrom(value); + } else { + inlinePhraseSetBuilder_.setMessage(value); + } + } + valueCase_ = 2; + return this; + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + public Builder clearInlinePhraseSet() { + if (inlinePhraseSetBuilder_ == null) { + if (valueCase_ == 2) { + valueCase_ = 0; + value_ = null; + onChanged(); + } + } else { + if (valueCase_ == 2) { + valueCase_ = 0; + value_ = null; + } + inlinePhraseSetBuilder_.clear(); + } + return this; + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + public com.google.cloud.speech.v2.PhraseSet.Builder getInlinePhraseSetBuilder() { + return getInlinePhraseSetFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSetOrBuilder getInlinePhraseSetOrBuilder() { + if ((valueCase_ == 2) && (inlinePhraseSetBuilder_ != null)) { + return inlinePhraseSetBuilder_.getMessageOrBuilder(); + } else { + if (valueCase_ == 2) { + return (com.google.cloud.speech.v2.PhraseSet) value_; + } + return com.google.cloud.speech.v2.PhraseSet.getDefaultInstance(); + } + } + /** + * + * + *
+       * An inline defined phrase set.
+       * 
+ * + * .google.cloud.speech.v2.PhraseSet inline_phrase_set = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + getInlinePhraseSetFieldBuilder() { + if (inlinePhraseSetBuilder_ == null) { + if (!(valueCase_ == 2)) { + value_ = com.google.cloud.speech.v2.PhraseSet.getDefaultInstance(); + } + inlinePhraseSetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder>( + (com.google.cloud.speech.v2.PhraseSet) value_, getParentForChildren(), isClean()); + value_ = null; + } + valueCase_ = 2; + onChanged(); + ; + return inlinePhraseSetBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet) + private static final com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet(); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AdaptationPhraseSet parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AdaptationPhraseSet(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int PHRASE_SETS_FIELD_NUMBER = 1; + private java.util.List + phraseSets_; + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + @java.lang.Override + public java.util.List + getPhraseSetsList() { + return phraseSets_; + } + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + @java.lang.Override + public java.util.List< + ? extends com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder> + getPhraseSetsOrBuilderList() { + return phraseSets_; + } + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + @java.lang.Override + public int getPhraseSetsCount() { + return phraseSets_.size(); + } + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet getPhraseSets(int index) { + return phraseSets_.get(index); + } + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder + getPhraseSetsOrBuilder(int index) { + return phraseSets_.get(index); + } + + public static final int CUSTOM_CLASSES_FIELD_NUMBER = 2; + private java.util.List customClasses_; + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + @java.lang.Override + public java.util.List getCustomClassesList() { + return customClasses_; + } + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + @java.lang.Override + public java.util.List + getCustomClassesOrBuilderList() { + return customClasses_; + } + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + @java.lang.Override + public int getCustomClassesCount() { + return customClasses_.size(); + } + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass getCustomClasses(int index) { + return customClasses_.get(index); + } + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassesOrBuilder(int index) { + return customClasses_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < phraseSets_.size(); i++) { + output.writeMessage(1, phraseSets_.get(i)); + } + for (int i = 0; i < customClasses_.size(); i++) { + output.writeMessage(2, customClasses_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < phraseSets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, phraseSets_.get(i)); + } + for (int i = 0; i < customClasses_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, customClasses_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.SpeechAdaptation)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.SpeechAdaptation other = + (com.google.cloud.speech.v2.SpeechAdaptation) obj; + + if (!getPhraseSetsList().equals(other.getPhraseSetsList())) return false; + if (!getCustomClassesList().equals(other.getCustomClassesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getPhraseSetsCount() > 0) { + hash = (37 * hash) + PHRASE_SETS_FIELD_NUMBER; + hash = (53 * hash) + getPhraseSetsList().hashCode(); + } + if (getCustomClassesCount() > 0) { + hash = (37 * hash) + CUSTOM_CLASSES_FIELD_NUMBER; + hash = (53 * hash) + getCustomClassesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.SpeechAdaptation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Provides "hints" to the speech recognizer to favor specific words and phrases
+   * in the results. Phrase sets can be specified as an inline resource, or a
+   * reference to an existing phrase set resource.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechAdaptation} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.SpeechAdaptation) + com.google.cloud.speech.v2.SpeechAdaptationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechAdaptation.class, + com.google.cloud.speech.v2.SpeechAdaptation.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.SpeechAdaptation.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getPhraseSetsFieldBuilder(); + getCustomClassesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (phraseSetsBuilder_ == null) { + phraseSets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + phraseSetsBuilder_.clear(); + } + if (customClassesBuilder_ == null) { + customClasses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + customClassesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechAdaptation_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation getDefaultInstanceForType() { + return com.google.cloud.speech.v2.SpeechAdaptation.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation build() { + com.google.cloud.speech.v2.SpeechAdaptation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation buildPartial() { + com.google.cloud.speech.v2.SpeechAdaptation result = + new com.google.cloud.speech.v2.SpeechAdaptation(this); + int from_bitField0_ = bitField0_; + if (phraseSetsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + phraseSets_ = java.util.Collections.unmodifiableList(phraseSets_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.phraseSets_ = phraseSets_; + } else { + result.phraseSets_ = phraseSetsBuilder_.build(); + } + if (customClassesBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + customClasses_ = java.util.Collections.unmodifiableList(customClasses_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.customClasses_ = customClasses_; + } else { + result.customClasses_ = customClassesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.SpeechAdaptation) { + return mergeFrom((com.google.cloud.speech.v2.SpeechAdaptation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.SpeechAdaptation other) { + if (other == com.google.cloud.speech.v2.SpeechAdaptation.getDefaultInstance()) return this; + if (phraseSetsBuilder_ == null) { + if (!other.phraseSets_.isEmpty()) { + if (phraseSets_.isEmpty()) { + phraseSets_ = other.phraseSets_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePhraseSetsIsMutable(); + phraseSets_.addAll(other.phraseSets_); + } + onChanged(); + } + } else { + if (!other.phraseSets_.isEmpty()) { + if (phraseSetsBuilder_.isEmpty()) { + phraseSetsBuilder_.dispose(); + phraseSetsBuilder_ = null; + phraseSets_ = other.phraseSets_; + bitField0_ = (bitField0_ & ~0x00000001); + phraseSetsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getPhraseSetsFieldBuilder() + : null; + } else { + phraseSetsBuilder_.addAllMessages(other.phraseSets_); + } + } + } + if (customClassesBuilder_ == null) { + if (!other.customClasses_.isEmpty()) { + if (customClasses_.isEmpty()) { + customClasses_ = other.customClasses_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureCustomClassesIsMutable(); + customClasses_.addAll(other.customClasses_); + } + onChanged(); + } + } else { + if (!other.customClasses_.isEmpty()) { + if (customClassesBuilder_.isEmpty()) { + customClassesBuilder_.dispose(); + customClassesBuilder_ = null; + customClasses_ = other.customClasses_; + bitField0_ = (bitField0_ & ~0x00000002); + customClassesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getCustomClassesFieldBuilder() + : null; + } else { + customClassesBuilder_.addAllMessages(other.customClasses_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.SpeechAdaptation parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.SpeechAdaptation) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List + phraseSets_ = java.util.Collections.emptyList(); + + private void ensurePhraseSetsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + phraseSets_ = + new java.util.ArrayList< + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet>(phraseSets_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder> + phraseSetsBuilder_; + + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public java.util.List + getPhraseSetsList() { + if (phraseSetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(phraseSets_); + } else { + return phraseSetsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public int getPhraseSetsCount() { + if (phraseSetsBuilder_ == null) { + return phraseSets_.size(); + } else { + return phraseSetsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet getPhraseSets( + int index) { + if (phraseSetsBuilder_ == null) { + return phraseSets_.get(index); + } else { + return phraseSetsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder setPhraseSets( + int index, com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet value) { + if (phraseSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhraseSetsIsMutable(); + phraseSets_.set(index, value); + onChanged(); + } else { + phraseSetsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder setPhraseSets( + int index, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder builderForValue) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.set(index, builderForValue.build()); + onChanged(); + } else { + phraseSetsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder addPhraseSets( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet value) { + if (phraseSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhraseSetsIsMutable(); + phraseSets_.add(value); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder addPhraseSets( + int index, com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet value) { + if (phraseSetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePhraseSetsIsMutable(); + phraseSets_.add(index, value); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder addPhraseSets( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder builderForValue) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.add(builderForValue.build()); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder addPhraseSets( + int index, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder builderForValue) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.add(index, builderForValue.build()); + onChanged(); + } else { + phraseSetsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder addAllPhraseSets( + java.lang.Iterable< + ? extends com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet> + values) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, phraseSets_); + onChanged(); + } else { + phraseSetsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder clearPhraseSets() { + if (phraseSetsBuilder_ == null) { + phraseSets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + phraseSetsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public Builder removePhraseSets(int index) { + if (phraseSetsBuilder_ == null) { + ensurePhraseSetsIsMutable(); + phraseSets_.remove(index); + onChanged(); + } else { + phraseSetsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder + getPhraseSetsBuilder(int index) { + return getPhraseSetsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder + getPhraseSetsOrBuilder(int index) { + if (phraseSetsBuilder_ == null) { + return phraseSets_.get(index); + } else { + return phraseSetsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public java.util.List< + ? extends com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder> + getPhraseSetsOrBuilderList() { + if (phraseSetsBuilder_ != null) { + return phraseSetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(phraseSets_); + } + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder + addPhraseSetsBuilder() { + return getPhraseSetsFieldBuilder() + .addBuilder( + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.getDefaultInstance()); + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder + addPhraseSetsBuilder(int index) { + return getPhraseSetsFieldBuilder() + .addBuilder( + index, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.getDefaultInstance()); + } + /** + * + * + *
+     * A list of inline or referenced phrase sets.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + public java.util.List + getPhraseSetsBuilderList() { + return getPhraseSetsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder> + getPhraseSetsFieldBuilder() { + if (phraseSetsBuilder_ == null) { + phraseSetsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet.Builder, + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder>( + phraseSets_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + phraseSets_ = null; + } + return phraseSetsBuilder_; + } + + private java.util.List customClasses_ = + java.util.Collections.emptyList(); + + private void ensureCustomClassesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + customClasses_ = + new java.util.ArrayList(customClasses_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + customClassesBuilder_; + + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public java.util.List getCustomClassesList() { + if (customClassesBuilder_ == null) { + return java.util.Collections.unmodifiableList(customClasses_); + } else { + return customClassesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public int getCustomClassesCount() { + if (customClassesBuilder_ == null) { + return customClasses_.size(); + } else { + return customClassesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public com.google.cloud.speech.v2.CustomClass getCustomClasses(int index) { + if (customClassesBuilder_ == null) { + return customClasses_.get(index); + } else { + return customClassesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder setCustomClasses(int index, com.google.cloud.speech.v2.CustomClass value) { + if (customClassesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCustomClassesIsMutable(); + customClasses_.set(index, value); + onChanged(); + } else { + customClassesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder setCustomClasses( + int index, com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.set(index, builderForValue.build()); + onChanged(); + } else { + customClassesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder addCustomClasses(com.google.cloud.speech.v2.CustomClass value) { + if (customClassesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCustomClassesIsMutable(); + customClasses_.add(value); + onChanged(); + } else { + customClassesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder addCustomClasses(int index, com.google.cloud.speech.v2.CustomClass value) { + if (customClassesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCustomClassesIsMutable(); + customClasses_.add(index, value); + onChanged(); + } else { + customClassesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder addCustomClasses( + com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.add(builderForValue.build()); + onChanged(); + } else { + customClassesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder addCustomClasses( + int index, com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.add(index, builderForValue.build()); + onChanged(); + } else { + customClassesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder addAllCustomClasses( + java.lang.Iterable values) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, customClasses_); + onChanged(); + } else { + customClassesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder clearCustomClasses() { + if (customClassesBuilder_ == null) { + customClasses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + customClassesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public Builder removeCustomClasses(int index) { + if (customClassesBuilder_ == null) { + ensureCustomClassesIsMutable(); + customClasses_.remove(index); + onChanged(); + } else { + customClassesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public com.google.cloud.speech.v2.CustomClass.Builder getCustomClassesBuilder(int index) { + return getCustomClassesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassesOrBuilder(int index) { + if (customClassesBuilder_ == null) { + return customClasses_.get(index); + } else { + return customClassesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public java.util.List + getCustomClassesOrBuilderList() { + if (customClassesBuilder_ != null) { + return customClassesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(customClasses_); + } + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public com.google.cloud.speech.v2.CustomClass.Builder addCustomClassesBuilder() { + return getCustomClassesFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.CustomClass.getDefaultInstance()); + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public com.google.cloud.speech.v2.CustomClass.Builder addCustomClassesBuilder(int index) { + return getCustomClassesFieldBuilder() + .addBuilder(index, com.google.cloud.speech.v2.CustomClass.getDefaultInstance()); + } + /** + * + * + *
+     * A list of inline custom classes. Existing custom class resources can be
+     * referenced directly in a phrase set.
+     * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + public java.util.List + getCustomClassesBuilderList() { + return getCustomClassesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + getCustomClassesFieldBuilder() { + if (customClassesBuilder_ == null) { + customClassesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder>( + customClasses_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + customClasses_ = null; + } + return customClassesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.SpeechAdaptation) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.SpeechAdaptation) + private static final com.google.cloud.speech.v2.SpeechAdaptation DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.SpeechAdaptation(); + } + + public static com.google.cloud.speech.v2.SpeechAdaptation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SpeechAdaptation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SpeechAdaptation(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechAdaptation getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptationOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptationOrBuilder.java new file mode 100644 index 000000000000..2c1d3322d7af --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechAdaptationOrBuilder.java @@ -0,0 +1,141 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface SpeechAdaptationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.SpeechAdaptation) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + java.util.List + getPhraseSetsList(); + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet getPhraseSets(int index); + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + int getPhraseSetsCount(); + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + java.util.List + getPhraseSetsOrBuilderList(); + /** + * + * + *
+   * A list of inline or referenced phrase sets.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet phrase_sets = 1; + * + */ + com.google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSetOrBuilder getPhraseSetsOrBuilder( + int index); + + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + java.util.List getCustomClassesList(); + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + com.google.cloud.speech.v2.CustomClass getCustomClasses(int index); + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + int getCustomClassesCount(); + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + java.util.List + getCustomClassesOrBuilderList(); + /** + * + * + *
+   * A list of inline custom classes. Existing custom class resources can be
+   * referenced directly in a phrase set.
+   * 
+ * + * repeated .google.cloud.speech.v2.CustomClass custom_classes = 2; + */ + com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassesOrBuilder(int index); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternative.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternative.java new file mode 100644 index 000000000000..bc2e407d6e01 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternative.java @@ -0,0 +1,1318 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Alternative hypotheses (a.k.a. n-best list).
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechRecognitionAlternative} + */ +public final class SpeechRecognitionAlternative extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.SpeechRecognitionAlternative) + SpeechRecognitionAlternativeOrBuilder { + private static final long serialVersionUID = 0L; + // Use SpeechRecognitionAlternative.newBuilder() to construct. + private SpeechRecognitionAlternative(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SpeechRecognitionAlternative() { + transcript_ = ""; + words_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SpeechRecognitionAlternative(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SpeechRecognitionAlternative( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + transcript_ = s; + break; + } + case 21: + { + confidence_ = input.readFloat(); + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + words_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + words_.add( + input.readMessage( + com.google.cloud.speech.v2.WordInfo.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + words_ = java.util.Collections.unmodifiableList(words_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionAlternative_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionAlternative_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechRecognitionAlternative.class, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder.class); + } + + public static final int TRANSCRIPT_FIELD_NUMBER = 1; + private volatile java.lang.Object transcript_; + /** + * + * + *
+   * Transcript text representing the words that the user spoke.
+   * 
+ * + * string transcript = 1; + * + * @return The transcript. + */ + @java.lang.Override + public java.lang.String getTranscript() { + java.lang.Object ref = transcript_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + transcript_ = s; + return s; + } + } + /** + * + * + *
+   * Transcript text representing the words that the user spoke.
+   * 
+ * + * string transcript = 1; + * + * @return The bytes for transcript. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTranscriptBytes() { + java.lang.Object ref = transcript_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + transcript_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIDENCE_FIELD_NUMBER = 2; + private float confidence_; + /** + * + * + *
+   * The confidence estimate between 0.0 and 1.0. A higher number
+   * indicates an estimated greater likelihood that the recognized words are
+   * correct. This field is set only for the top alternative of a non-streaming
+   * result or, of a streaming result where
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+   * set to `true`. This field is not guaranteed to be accurate and users should
+   * not rely on it to be always provided. The default of 0.0 is a sentinel
+   * value indicating `confidence` was not set.
+   * 
+ * + * float confidence = 2; + * + * @return The confidence. + */ + @java.lang.Override + public float getConfidence() { + return confidence_; + } + + public static final int WORDS_FIELD_NUMBER = 3; + private java.util.List words_; + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + @java.lang.Override + public java.util.List getWordsList() { + return words_; + } + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + @java.lang.Override + public java.util.List + getWordsOrBuilderList() { + return words_; + } + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + @java.lang.Override + public int getWordsCount() { + return words_.size(); + } + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.WordInfo getWords(int index) { + return words_.get(index); + } + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + @java.lang.Override + public com.google.cloud.speech.v2.WordInfoOrBuilder getWordsOrBuilder(int index) { + return words_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(transcript_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, transcript_); + } + if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { + output.writeFloat(2, confidence_); + } + for (int i = 0; i < words_.size(); i++) { + output.writeMessage(3, words_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(transcript_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, transcript_); + } + if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, confidence_); + } + for (int i = 0; i < words_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, words_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.SpeechRecognitionAlternative)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.SpeechRecognitionAlternative other = + (com.google.cloud.speech.v2.SpeechRecognitionAlternative) obj; + + if (!getTranscript().equals(other.getTranscript())) return false; + if (java.lang.Float.floatToIntBits(getConfidence()) + != java.lang.Float.floatToIntBits(other.getConfidence())) return false; + if (!getWordsList().equals(other.getWordsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TRANSCRIPT_FIELD_NUMBER; + hash = (53 * hash) + getTranscript().hashCode(); + hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); + if (getWordsCount() > 0) { + hash = (37 * hash) + WORDS_FIELD_NUMBER; + hash = (53 * hash) + getWordsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.SpeechRecognitionAlternative prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Alternative hypotheses (a.k.a. n-best list).
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechRecognitionAlternative} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.SpeechRecognitionAlternative) + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionAlternative_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionAlternative_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechRecognitionAlternative.class, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.SpeechRecognitionAlternative.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getWordsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + transcript_ = ""; + + confidence_ = 0F; + + if (wordsBuilder_ == null) { + words_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + wordsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionAlternative_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternative getDefaultInstanceForType() { + return com.google.cloud.speech.v2.SpeechRecognitionAlternative.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternative build() { + com.google.cloud.speech.v2.SpeechRecognitionAlternative result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternative buildPartial() { + com.google.cloud.speech.v2.SpeechRecognitionAlternative result = + new com.google.cloud.speech.v2.SpeechRecognitionAlternative(this); + int from_bitField0_ = bitField0_; + result.transcript_ = transcript_; + result.confidence_ = confidence_; + if (wordsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + words_ = java.util.Collections.unmodifiableList(words_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.words_ = words_; + } else { + result.words_ = wordsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.SpeechRecognitionAlternative) { + return mergeFrom((com.google.cloud.speech.v2.SpeechRecognitionAlternative) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.SpeechRecognitionAlternative other) { + if (other == com.google.cloud.speech.v2.SpeechRecognitionAlternative.getDefaultInstance()) + return this; + if (!other.getTranscript().isEmpty()) { + transcript_ = other.transcript_; + onChanged(); + } + if (other.getConfidence() != 0F) { + setConfidence(other.getConfidence()); + } + if (wordsBuilder_ == null) { + if (!other.words_.isEmpty()) { + if (words_.isEmpty()) { + words_ = other.words_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureWordsIsMutable(); + words_.addAll(other.words_); + } + onChanged(); + } + } else { + if (!other.words_.isEmpty()) { + if (wordsBuilder_.isEmpty()) { + wordsBuilder_.dispose(); + wordsBuilder_ = null; + words_ = other.words_; + bitField0_ = (bitField0_ & ~0x00000001); + wordsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getWordsFieldBuilder() + : null; + } else { + wordsBuilder_.addAllMessages(other.words_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.SpeechRecognitionAlternative parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.SpeechRecognitionAlternative) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object transcript_ = ""; + /** + * + * + *
+     * Transcript text representing the words that the user spoke.
+     * 
+ * + * string transcript = 1; + * + * @return The transcript. + */ + public java.lang.String getTranscript() { + java.lang.Object ref = transcript_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + transcript_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Transcript text representing the words that the user spoke.
+     * 
+ * + * string transcript = 1; + * + * @return The bytes for transcript. + */ + public com.google.protobuf.ByteString getTranscriptBytes() { + java.lang.Object ref = transcript_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + transcript_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Transcript text representing the words that the user spoke.
+     * 
+ * + * string transcript = 1; + * + * @param value The transcript to set. + * @return This builder for chaining. + */ + public Builder setTranscript(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + transcript_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Transcript text representing the words that the user spoke.
+     * 
+ * + * string transcript = 1; + * + * @return This builder for chaining. + */ + public Builder clearTranscript() { + + transcript_ = getDefaultInstance().getTranscript(); + onChanged(); + return this; + } + /** + * + * + *
+     * Transcript text representing the words that the user spoke.
+     * 
+ * + * string transcript = 1; + * + * @param value The bytes for transcript to set. + * @return This builder for chaining. + */ + public Builder setTranscriptBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + transcript_ = value; + onChanged(); + return this; + } + + private float confidence_; + /** + * + * + *
+     * The confidence estimate between 0.0 and 1.0. A higher number
+     * indicates an estimated greater likelihood that the recognized words are
+     * correct. This field is set only for the top alternative of a non-streaming
+     * result or, of a streaming result where
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+     * set to `true`. This field is not guaranteed to be accurate and users should
+     * not rely on it to be always provided. The default of 0.0 is a sentinel
+     * value indicating `confidence` was not set.
+     * 
+ * + * float confidence = 2; + * + * @return The confidence. + */ + @java.lang.Override + public float getConfidence() { + return confidence_; + } + /** + * + * + *
+     * The confidence estimate between 0.0 and 1.0. A higher number
+     * indicates an estimated greater likelihood that the recognized words are
+     * correct. This field is set only for the top alternative of a non-streaming
+     * result or, of a streaming result where
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+     * set to `true`. This field is not guaranteed to be accurate and users should
+     * not rely on it to be always provided. The default of 0.0 is a sentinel
+     * value indicating `confidence` was not set.
+     * 
+ * + * float confidence = 2; + * + * @param value The confidence to set. + * @return This builder for chaining. + */ + public Builder setConfidence(float value) { + + confidence_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The confidence estimate between 0.0 and 1.0. A higher number
+     * indicates an estimated greater likelihood that the recognized words are
+     * correct. This field is set only for the top alternative of a non-streaming
+     * result or, of a streaming result where
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+     * set to `true`. This field is not guaranteed to be accurate and users should
+     * not rely on it to be always provided. The default of 0.0 is a sentinel
+     * value indicating `confidence` was not set.
+     * 
+ * + * float confidence = 2; + * + * @return This builder for chaining. + */ + public Builder clearConfidence() { + + confidence_ = 0F; + onChanged(); + return this; + } + + private java.util.List words_ = + java.util.Collections.emptyList(); + + private void ensureWordsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + words_ = new java.util.ArrayList(words_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.WordInfo, + com.google.cloud.speech.v2.WordInfo.Builder, + com.google.cloud.speech.v2.WordInfoOrBuilder> + wordsBuilder_; + + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public java.util.List getWordsList() { + if (wordsBuilder_ == null) { + return java.util.Collections.unmodifiableList(words_); + } else { + return wordsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public int getWordsCount() { + if (wordsBuilder_ == null) { + return words_.size(); + } else { + return wordsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public com.google.cloud.speech.v2.WordInfo getWords(int index) { + if (wordsBuilder_ == null) { + return words_.get(index); + } else { + return wordsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder setWords(int index, com.google.cloud.speech.v2.WordInfo value) { + if (wordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureWordsIsMutable(); + words_.set(index, value); + onChanged(); + } else { + wordsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder setWords( + int index, com.google.cloud.speech.v2.WordInfo.Builder builderForValue) { + if (wordsBuilder_ == null) { + ensureWordsIsMutable(); + words_.set(index, builderForValue.build()); + onChanged(); + } else { + wordsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder addWords(com.google.cloud.speech.v2.WordInfo value) { + if (wordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureWordsIsMutable(); + words_.add(value); + onChanged(); + } else { + wordsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder addWords(int index, com.google.cloud.speech.v2.WordInfo value) { + if (wordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureWordsIsMutable(); + words_.add(index, value); + onChanged(); + } else { + wordsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder addWords(com.google.cloud.speech.v2.WordInfo.Builder builderForValue) { + if (wordsBuilder_ == null) { + ensureWordsIsMutable(); + words_.add(builderForValue.build()); + onChanged(); + } else { + wordsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder addWords( + int index, com.google.cloud.speech.v2.WordInfo.Builder builderForValue) { + if (wordsBuilder_ == null) { + ensureWordsIsMutable(); + words_.add(index, builderForValue.build()); + onChanged(); + } else { + wordsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder addAllWords( + java.lang.Iterable values) { + if (wordsBuilder_ == null) { + ensureWordsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, words_); + onChanged(); + } else { + wordsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder clearWords() { + if (wordsBuilder_ == null) { + words_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + wordsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public Builder removeWords(int index) { + if (wordsBuilder_ == null) { + ensureWordsIsMutable(); + words_.remove(index); + onChanged(); + } else { + wordsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public com.google.cloud.speech.v2.WordInfo.Builder getWordsBuilder(int index) { + return getWordsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public com.google.cloud.speech.v2.WordInfoOrBuilder getWordsOrBuilder(int index) { + if (wordsBuilder_ == null) { + return words_.get(index); + } else { + return wordsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public java.util.List + getWordsOrBuilderList() { + if (wordsBuilder_ != null) { + return wordsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(words_); + } + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public com.google.cloud.speech.v2.WordInfo.Builder addWordsBuilder() { + return getWordsFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.WordInfo.getDefaultInstance()); + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public com.google.cloud.speech.v2.WordInfo.Builder addWordsBuilder(int index) { + return getWordsFieldBuilder() + .addBuilder(index, com.google.cloud.speech.v2.WordInfo.getDefaultInstance()); + } + /** + * + * + *
+     * A list of word-specific information for each recognized word.
+     * When
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is true, you will see all the words from the beginning of the audio.
+     * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + public java.util.List getWordsBuilderList() { + return getWordsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.WordInfo, + com.google.cloud.speech.v2.WordInfo.Builder, + com.google.cloud.speech.v2.WordInfoOrBuilder> + getWordsFieldBuilder() { + if (wordsBuilder_ == null) { + wordsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.WordInfo, + com.google.cloud.speech.v2.WordInfo.Builder, + com.google.cloud.speech.v2.WordInfoOrBuilder>( + words_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + words_ = null; + } + return wordsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.SpeechRecognitionAlternative) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.SpeechRecognitionAlternative) + private static final com.google.cloud.speech.v2.SpeechRecognitionAlternative DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.SpeechRecognitionAlternative(); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionAlternative getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SpeechRecognitionAlternative parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SpeechRecognitionAlternative(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternative getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternativeOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternativeOrBuilder.java new file mode 100644 index 000000000000..74d278312ad9 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionAlternativeOrBuilder.java @@ -0,0 +1,136 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface SpeechRecognitionAlternativeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.SpeechRecognitionAlternative) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Transcript text representing the words that the user spoke.
+   * 
+ * + * string transcript = 1; + * + * @return The transcript. + */ + java.lang.String getTranscript(); + /** + * + * + *
+   * Transcript text representing the words that the user spoke.
+   * 
+ * + * string transcript = 1; + * + * @return The bytes for transcript. + */ + com.google.protobuf.ByteString getTranscriptBytes(); + + /** + * + * + *
+   * The confidence estimate between 0.0 and 1.0. A higher number
+   * indicates an estimated greater likelihood that the recognized words are
+   * correct. This field is set only for the top alternative of a non-streaming
+   * result or, of a streaming result where
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+   * set to `true`. This field is not guaranteed to be accurate and users should
+   * not rely on it to be always provided. The default of 0.0 is a sentinel
+   * value indicating `confidence` was not set.
+   * 
+ * + * float confidence = 2; + * + * @return The confidence. + */ + float getConfidence(); + + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + java.util.List getWordsList(); + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + com.google.cloud.speech.v2.WordInfo getWords(int index); + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + int getWordsCount(); + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + java.util.List getWordsOrBuilderList(); + /** + * + * + *
+   * A list of word-specific information for each recognized word.
+   * When
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is true, you will see all the words from the beginning of the audio.
+   * 
+ * + * repeated .google.cloud.speech.v2.WordInfo words = 3; + */ + com.google.cloud.speech.v2.WordInfoOrBuilder getWordsOrBuilder(int index); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResult.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResult.java new file mode 100644 index 000000000000..e52c67675097 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResult.java @@ -0,0 +1,1600 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * A speech recognition result corresponding to a portion of the audio.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechRecognitionResult} + */ +public final class SpeechRecognitionResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.SpeechRecognitionResult) + SpeechRecognitionResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use SpeechRecognitionResult.newBuilder() to construct. + private SpeechRecognitionResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SpeechRecognitionResult() { + alternatives_ = java.util.Collections.emptyList(); + languageCode_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SpeechRecognitionResult(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SpeechRecognitionResult( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + alternatives_ = + new java.util.ArrayList< + com.google.cloud.speech.v2.SpeechRecognitionAlternative>(); + mutable_bitField0_ |= 0x00000001; + } + alternatives_.add( + input.readMessage( + com.google.cloud.speech.v2.SpeechRecognitionAlternative.parser(), + extensionRegistry)); + break; + } + case 16: + { + channelTag_ = input.readInt32(); + break; + } + case 34: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (resultEndOffset_ != null) { + subBuilder = resultEndOffset_.toBuilder(); + } + resultEndOffset_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(resultEndOffset_); + resultEndOffset_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + languageCode_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + alternatives_ = java.util.Collections.unmodifiableList(alternatives_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechRecognitionResult.class, + com.google.cloud.speech.v2.SpeechRecognitionResult.Builder.class); + } + + public static final int ALTERNATIVES_FIELD_NUMBER = 1; + private java.util.List alternatives_; + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public java.util.List + getAlternativesList() { + return alternatives_; + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public java.util.List + getAlternativesOrBuilderList() { + return alternatives_; + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public int getAlternativesCount() { + return alternatives_.size(); + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternative getAlternatives(int index) { + return alternatives_.get(index); + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder getAlternativesOrBuilder( + int index) { + return alternatives_.get(index); + } + + public static final int CHANNEL_TAG_FIELD_NUMBER = 2; + private int channelTag_; + /** + * + * + *
+   * For multi-channel audio, this is the channel number corresponding to the
+   * recognized result for the audio from that channel.
+   * For `audio_channel_count` = `N`, its output values can range from `1` to
+   * `N`.
+   * 
+ * + * int32 channel_tag = 2; + * + * @return The channelTag. + */ + @java.lang.Override + public int getChannelTag() { + return channelTag_; + } + + public static final int RESULT_END_OFFSET_FIELD_NUMBER = 4; + private com.google.protobuf.Duration resultEndOffset_; + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return Whether the resultEndOffset field is set. + */ + @java.lang.Override + public boolean hasResultEndOffset() { + return resultEndOffset_ != null; + } + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return The resultEndOffset. + */ + @java.lang.Override + public com.google.protobuf.Duration getResultEndOffset() { + return resultEndOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : resultEndOffset_; + } + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getResultEndOffsetOrBuilder() { + return getResultEndOffset(); + } + + public static final int LANGUAGE_CODE_FIELD_NUMBER = 5; + private volatile java.lang.Object languageCode_; + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The languageCode. + */ + @java.lang.Override + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for languageCode. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < alternatives_.size(); i++) { + output.writeMessage(1, alternatives_.get(i)); + } + if (channelTag_ != 0) { + output.writeInt32(2, channelTag_); + } + if (resultEndOffset_ != null) { + output.writeMessage(4, getResultEndOffset()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(languageCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, languageCode_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < alternatives_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, alternatives_.get(i)); + } + if (channelTag_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, channelTag_); + } + if (resultEndOffset_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getResultEndOffset()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(languageCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, languageCode_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.SpeechRecognitionResult)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.SpeechRecognitionResult other = + (com.google.cloud.speech.v2.SpeechRecognitionResult) obj; + + if (!getAlternativesList().equals(other.getAlternativesList())) return false; + if (getChannelTag() != other.getChannelTag()) return false; + if (hasResultEndOffset() != other.hasResultEndOffset()) return false; + if (hasResultEndOffset()) { + if (!getResultEndOffset().equals(other.getResultEndOffset())) return false; + } + if (!getLanguageCode().equals(other.getLanguageCode())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAlternativesCount() > 0) { + hash = (37 * hash) + ALTERNATIVES_FIELD_NUMBER; + hash = (53 * hash) + getAlternativesList().hashCode(); + } + hash = (37 * hash) + CHANNEL_TAG_FIELD_NUMBER; + hash = (53 * hash) + getChannelTag(); + if (hasResultEndOffset()) { + hash = (37 * hash) + RESULT_END_OFFSET_FIELD_NUMBER; + hash = (53 * hash) + getResultEndOffset().hashCode(); + } + hash = (37 * hash) + LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getLanguageCode().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.SpeechRecognitionResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A speech recognition result corresponding to a portion of the audio.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.SpeechRecognitionResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.SpeechRecognitionResult) + com.google.cloud.speech.v2.SpeechRecognitionResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.SpeechRecognitionResult.class, + com.google.cloud.speech.v2.SpeechRecognitionResult.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.SpeechRecognitionResult.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getAlternativesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (alternativesBuilder_ == null) { + alternatives_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + alternativesBuilder_.clear(); + } + channelTag_ = 0; + + if (resultEndOffsetBuilder_ == null) { + resultEndOffset_ = null; + } else { + resultEndOffset_ = null; + resultEndOffsetBuilder_ = null; + } + languageCode_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_SpeechRecognitionResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionResult getDefaultInstanceForType() { + return com.google.cloud.speech.v2.SpeechRecognitionResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionResult build() { + com.google.cloud.speech.v2.SpeechRecognitionResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionResult buildPartial() { + com.google.cloud.speech.v2.SpeechRecognitionResult result = + new com.google.cloud.speech.v2.SpeechRecognitionResult(this); + int from_bitField0_ = bitField0_; + if (alternativesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + alternatives_ = java.util.Collections.unmodifiableList(alternatives_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.alternatives_ = alternatives_; + } else { + result.alternatives_ = alternativesBuilder_.build(); + } + result.channelTag_ = channelTag_; + if (resultEndOffsetBuilder_ == null) { + result.resultEndOffset_ = resultEndOffset_; + } else { + result.resultEndOffset_ = resultEndOffsetBuilder_.build(); + } + result.languageCode_ = languageCode_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.SpeechRecognitionResult) { + return mergeFrom((com.google.cloud.speech.v2.SpeechRecognitionResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.SpeechRecognitionResult other) { + if (other == com.google.cloud.speech.v2.SpeechRecognitionResult.getDefaultInstance()) + return this; + if (alternativesBuilder_ == null) { + if (!other.alternatives_.isEmpty()) { + if (alternatives_.isEmpty()) { + alternatives_ = other.alternatives_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAlternativesIsMutable(); + alternatives_.addAll(other.alternatives_); + } + onChanged(); + } + } else { + if (!other.alternatives_.isEmpty()) { + if (alternativesBuilder_.isEmpty()) { + alternativesBuilder_.dispose(); + alternativesBuilder_ = null; + alternatives_ = other.alternatives_; + bitField0_ = (bitField0_ & ~0x00000001); + alternativesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getAlternativesFieldBuilder() + : null; + } else { + alternativesBuilder_.addAllMessages(other.alternatives_); + } + } + } + if (other.getChannelTag() != 0) { + setChannelTag(other.getChannelTag()); + } + if (other.hasResultEndOffset()) { + mergeResultEndOffset(other.getResultEndOffset()); + } + if (!other.getLanguageCode().isEmpty()) { + languageCode_ = other.languageCode_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.SpeechRecognitionResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.SpeechRecognitionResult) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List alternatives_ = + java.util.Collections.emptyList(); + + private void ensureAlternativesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + alternatives_ = + new java.util.ArrayList( + alternatives_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionAlternative, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder, + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder> + alternativesBuilder_; + + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public java.util.List + getAlternativesList() { + if (alternativesBuilder_ == null) { + return java.util.Collections.unmodifiableList(alternatives_); + } else { + return alternativesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public int getAlternativesCount() { + if (alternativesBuilder_ == null) { + return alternatives_.size(); + } else { + return alternativesBuilder_.getCount(); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative getAlternatives(int index) { + if (alternativesBuilder_ == null) { + return alternatives_.get(index); + } else { + return alternativesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder setAlternatives( + int index, com.google.cloud.speech.v2.SpeechRecognitionAlternative value) { + if (alternativesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAlternativesIsMutable(); + alternatives_.set(index, value); + onChanged(); + } else { + alternativesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder setAlternatives( + int index, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder builderForValue) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.set(index, builderForValue.build()); + onChanged(); + } else { + alternativesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives(com.google.cloud.speech.v2.SpeechRecognitionAlternative value) { + if (alternativesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAlternativesIsMutable(); + alternatives_.add(value); + onChanged(); + } else { + alternativesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives( + int index, com.google.cloud.speech.v2.SpeechRecognitionAlternative value) { + if (alternativesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAlternativesIsMutable(); + alternatives_.add(index, value); + onChanged(); + } else { + alternativesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives( + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder builderForValue) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.add(builderForValue.build()); + onChanged(); + } else { + alternativesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives( + int index, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder builderForValue) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.add(index, builderForValue.build()); + onChanged(); + } else { + alternativesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAllAlternatives( + java.lang.Iterable + values) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, alternatives_); + onChanged(); + } else { + alternativesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder clearAlternatives() { + if (alternativesBuilder_ == null) { + alternatives_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + alternativesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder removeAlternatives(int index) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.remove(index); + onChanged(); + } else { + alternativesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder getAlternativesBuilder( + int index) { + return getAlternativesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder + getAlternativesOrBuilder(int index) { + if (alternativesBuilder_ == null) { + return alternatives_.get(index); + } else { + return alternativesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public java.util.List< + ? extends com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder> + getAlternativesOrBuilderList() { + if (alternativesBuilder_ != null) { + return alternativesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(alternatives_); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder + addAlternativesBuilder() { + return getAlternativesFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.SpeechRecognitionAlternative.getDefaultInstance()); + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder addAlternativesBuilder( + int index) { + return getAlternativesFieldBuilder() + .addBuilder( + index, com.google.cloud.speech.v2.SpeechRecognitionAlternative.getDefaultInstance()); + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public java.util.List + getAlternativesBuilderList() { + return getAlternativesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionAlternative, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder, + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder> + getAlternativesFieldBuilder() { + if (alternativesBuilder_ == null) { + alternativesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionAlternative, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder, + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder>( + alternatives_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + alternatives_ = null; + } + return alternativesBuilder_; + } + + private int channelTag_; + /** + * + * + *
+     * For multi-channel audio, this is the channel number corresponding to the
+     * recognized result for the audio from that channel.
+     * For `audio_channel_count` = `N`, its output values can range from `1` to
+     * `N`.
+     * 
+ * + * int32 channel_tag = 2; + * + * @return The channelTag. + */ + @java.lang.Override + public int getChannelTag() { + return channelTag_; + } + /** + * + * + *
+     * For multi-channel audio, this is the channel number corresponding to the
+     * recognized result for the audio from that channel.
+     * For `audio_channel_count` = `N`, its output values can range from `1` to
+     * `N`.
+     * 
+ * + * int32 channel_tag = 2; + * + * @param value The channelTag to set. + * @return This builder for chaining. + */ + public Builder setChannelTag(int value) { + + channelTag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * For multi-channel audio, this is the channel number corresponding to the
+     * recognized result for the audio from that channel.
+     * For `audio_channel_count` = `N`, its output values can range from `1` to
+     * `N`.
+     * 
+ * + * int32 channel_tag = 2; + * + * @return This builder for chaining. + */ + public Builder clearChannelTag() { + + channelTag_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Duration resultEndOffset_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + resultEndOffsetBuilder_; + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return Whether the resultEndOffset field is set. + */ + public boolean hasResultEndOffset() { + return resultEndOffsetBuilder_ != null || resultEndOffset_ != null; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return The resultEndOffset. + */ + public com.google.protobuf.Duration getResultEndOffset() { + if (resultEndOffsetBuilder_ == null) { + return resultEndOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : resultEndOffset_; + } else { + return resultEndOffsetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder setResultEndOffset(com.google.protobuf.Duration value) { + if (resultEndOffsetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + resultEndOffset_ = value; + onChanged(); + } else { + resultEndOffsetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder setResultEndOffset(com.google.protobuf.Duration.Builder builderForValue) { + if (resultEndOffsetBuilder_ == null) { + resultEndOffset_ = builderForValue.build(); + onChanged(); + } else { + resultEndOffsetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder mergeResultEndOffset(com.google.protobuf.Duration value) { + if (resultEndOffsetBuilder_ == null) { + if (resultEndOffset_ != null) { + resultEndOffset_ = + com.google.protobuf.Duration.newBuilder(resultEndOffset_) + .mergeFrom(value) + .buildPartial(); + } else { + resultEndOffset_ = value; + } + onChanged(); + } else { + resultEndOffsetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder clearResultEndOffset() { + if (resultEndOffsetBuilder_ == null) { + resultEndOffset_ = null; + onChanged(); + } else { + resultEndOffset_ = null; + resultEndOffsetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public com.google.protobuf.Duration.Builder getResultEndOffsetBuilder() { + + onChanged(); + return getResultEndOffsetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public com.google.protobuf.DurationOrBuilder getResultEndOffsetOrBuilder() { + if (resultEndOffsetBuilder_ != null) { + return resultEndOffsetBuilder_.getMessageOrBuilder(); + } else { + return resultEndOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : resultEndOffset_; + } + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getResultEndOffsetFieldBuilder() { + if (resultEndOffsetBuilder_ == null) { + resultEndOffsetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getResultEndOffset(), getParentForChildren(), isClean()); + resultEndOffset_ = null; + } + return resultEndOffsetBuilder_; + } + + private java.lang.Object languageCode_ = ""; + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The languageCode. + */ + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for languageCode. + */ + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The languageCode to set. + * @return This builder for chaining. + */ + public Builder setLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + languageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearLanguageCode() { + + languageCode_ = getDefaultInstance().getLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for languageCode to set. + * @return This builder for chaining. + */ + public Builder setLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + languageCode_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.SpeechRecognitionResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.SpeechRecognitionResult) + private static final com.google.cloud.speech.v2.SpeechRecognitionResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.SpeechRecognitionResult(); + } + + public static com.google.cloud.speech.v2.SpeechRecognitionResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SpeechRecognitionResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SpeechRecognitionResult(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResultOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResultOrBuilder.java new file mode 100644 index 000000000000..e582591940dc --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/SpeechRecognitionResultOrBuilder.java @@ -0,0 +1,171 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface SpeechRecognitionResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.SpeechRecognitionResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + java.util.List getAlternativesList(); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + com.google.cloud.speech.v2.SpeechRecognitionAlternative getAlternatives(int index); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + int getAlternativesCount(); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + java.util.List + getAlternativesOrBuilderList(); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder getAlternativesOrBuilder( + int index); + + /** + * + * + *
+   * For multi-channel audio, this is the channel number corresponding to the
+   * recognized result for the audio from that channel.
+   * For `audio_channel_count` = `N`, its output values can range from `1` to
+   * `N`.
+   * 
+ * + * int32 channel_tag = 2; + * + * @return The channelTag. + */ + int getChannelTag(); + + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return Whether the resultEndOffset field is set. + */ + boolean hasResultEndOffset(); + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return The resultEndOffset. + */ + com.google.protobuf.Duration getResultEndOffset(); + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + com.google.protobuf.DurationOrBuilder getResultEndOffsetOrBuilder(); + + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The languageCode. + */ + java.lang.String getLanguageCode(); + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for languageCode. + */ + com.google.protobuf.ByteString getLanguageCodeBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfig.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfig.java new file mode 100644 index 000000000000..70ded6a82705 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfig.java @@ -0,0 +1,1532 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Provides configuration information for the StreamingRecognize request.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognitionConfig} + */ +public final class StreamingRecognitionConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.StreamingRecognitionConfig) + StreamingRecognitionConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingRecognitionConfig.newBuilder() to construct. + private StreamingRecognitionConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingRecognitionConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingRecognitionConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private StreamingRecognitionConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.RecognitionConfig.Builder subBuilder = null; + if (config_ != null) { + subBuilder = config_.toBuilder(); + } + config_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(config_); + config_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder subBuilder = null; + if (streamingFeatures_ != null) { + subBuilder = streamingFeatures_.toBuilder(); + } + streamingFeatures_ = + input.readMessage( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(streamingFeatures_); + streamingFeatures_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (configMask_ != null) { + subBuilder = configMask_.toBuilder(); + } + configMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(configMask_); + configMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionConfig.class, + com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder.class); + } + + public static final int CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.RecognitionConfig config_; + /** + * + * + *
+   * Required. Features and audio metadata to use for the Automatic Speech
+   * Recognition. This field in combination with the
+   * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return config_ != null; + } + /** + * + * + *
+   * Required. Features and audio metadata to use for the Automatic Speech
+   * Recognition. This field in combination with the
+   * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + /** + * + * + *
+   * Required. Features and audio metadata to use for the Automatic Speech
+   * Recognition. This field in combination with the
+   * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + return getConfig(); + } + + public static final int CONFIG_MASK_FIELD_NUMBER = 3; + private com.google.protobuf.FieldMask configMask_; + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + * + * @return Whether the configMask field is set. + */ + @java.lang.Override + public boolean hasConfigMask() { + return configMask_ != null; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + * + * @return The configMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getConfigMask() { + return configMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : configMask_; + } + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + return getConfigMask(); + } + + public static final int STREAMING_FEATURES_FIELD_NUMBER = 2; + private com.google.cloud.speech.v2.StreamingRecognitionFeatures streamingFeatures_; + /** + * + * + *
+   * Speech recognition features to enable specific to streaming audio
+   * recognition requests.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + * + * @return Whether the streamingFeatures field is set. + */ + @java.lang.Override + public boolean hasStreamingFeatures() { + return streamingFeatures_ != null; + } + /** + * + * + *
+   * Speech recognition features to enable specific to streaming audio
+   * recognition requests.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + * + * @return The streamingFeatures. + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures getStreamingFeatures() { + return streamingFeatures_ == null + ? com.google.cloud.speech.v2.StreamingRecognitionFeatures.getDefaultInstance() + : streamingFeatures_; + } + /** + * + * + *
+   * Speech recognition features to enable specific to streaming audio
+   * recognition requests.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeaturesOrBuilder + getStreamingFeaturesOrBuilder() { + return getStreamingFeatures(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (config_ != null) { + output.writeMessage(1, getConfig()); + } + if (streamingFeatures_ != null) { + output.writeMessage(2, getStreamingFeatures()); + } + if (configMask_ != null) { + output.writeMessage(3, getConfigMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (config_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getConfig()); + } + if (streamingFeatures_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStreamingFeatures()); + } + if (configMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getConfigMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.StreamingRecognitionConfig)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.StreamingRecognitionConfig other = + (com.google.cloud.speech.v2.StreamingRecognitionConfig) obj; + + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig().equals(other.getConfig())) return false; + } + if (hasConfigMask() != other.hasConfigMask()) return false; + if (hasConfigMask()) { + if (!getConfigMask().equals(other.getConfigMask())) return false; + } + if (hasStreamingFeatures() != other.hasStreamingFeatures()) return false; + if (hasStreamingFeatures()) { + if (!getStreamingFeatures().equals(other.getStreamingFeatures())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + if (hasConfigMask()) { + hash = (37 * hash) + CONFIG_MASK_FIELD_NUMBER; + hash = (53 * hash) + getConfigMask().hashCode(); + } + if (hasStreamingFeatures()) { + hash = (37 * hash) + STREAMING_FEATURES_FIELD_NUMBER; + hash = (53 * hash) + getStreamingFeatures().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.StreamingRecognitionConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Provides configuration information for the StreamingRecognize request.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognitionConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.StreamingRecognitionConfig) + com.google.cloud.speech.v2.StreamingRecognitionConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionConfig.class, + com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.StreamingRecognitionConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (configBuilder_ == null) { + config_ = null; + } else { + config_ = null; + configBuilder_ = null; + } + if (configMaskBuilder_ == null) { + configMask_ = null; + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + if (streamingFeaturesBuilder_ == null) { + streamingFeatures_ = null; + } else { + streamingFeatures_ = null; + streamingFeaturesBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfig getDefaultInstanceForType() { + return com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfig build() { + com.google.cloud.speech.v2.StreamingRecognitionConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfig buildPartial() { + com.google.cloud.speech.v2.StreamingRecognitionConfig result = + new com.google.cloud.speech.v2.StreamingRecognitionConfig(this); + if (configBuilder_ == null) { + result.config_ = config_; + } else { + result.config_ = configBuilder_.build(); + } + if (configMaskBuilder_ == null) { + result.configMask_ = configMask_; + } else { + result.configMask_ = configMaskBuilder_.build(); + } + if (streamingFeaturesBuilder_ == null) { + result.streamingFeatures_ = streamingFeatures_; + } else { + result.streamingFeatures_ = streamingFeaturesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.StreamingRecognitionConfig) { + return mergeFrom((com.google.cloud.speech.v2.StreamingRecognitionConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.StreamingRecognitionConfig other) { + if (other == com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance()) + return this; + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + if (other.hasConfigMask()) { + mergeConfigMask(other.getConfigMask()); + } + if (other.hasStreamingFeatures()) { + mergeStreamingFeatures(other.getStreamingFeatures()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.StreamingRecognitionConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.StreamingRecognitionConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.RecognitionConfig config_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + configBuilder_; + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return configBuilder_ != null || config_ != null; + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + public com.google.cloud.speech.v2.RecognitionConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + onChanged(); + } else { + configBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConfig(com.google.cloud.speech.v2.RecognitionConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + onChanged(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeConfig(com.google.cloud.speech.v2.RecognitionConfig value) { + if (configBuilder_ == null) { + if (config_ != null) { + config_ = + com.google.cloud.speech.v2.RecognitionConfig.newBuilder(config_) + .mergeFrom(value) + .buildPartial(); + } else { + config_ = value; + } + onChanged(); + } else { + configBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearConfig() { + if (configBuilder_ == null) { + config_ = null; + onChanged(); + } else { + config_ = null; + configBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.RecognitionConfig.Builder getConfigBuilder() { + + onChanged(); + return getConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null + ? com.google.cloud.speech.v2.RecognitionConfig.getDefaultInstance() + : config_; + } + } + /** + * + * + *
+     * Required. Features and audio metadata to use for the Automatic Speech
+     * Recognition. This field in combination with the
+     * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+     * field can be used to override parts of the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the Recognizer resource.
+     * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder> + getConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionConfig, + com.google.cloud.speech.v2.RecognitionConfig.Builder, + com.google.cloud.speech.v2.RecognitionConfigOrBuilder>( + getConfig(), getParentForChildren(), isClean()); + config_ = null; + } + return configBuilder_; + } + + private com.google.protobuf.FieldMask configMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + configMaskBuilder_; + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + * + * @return Whether the configMask field is set. + */ + public boolean hasConfigMask() { + return configMaskBuilder_ != null || configMask_ != null; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + * + * @return The configMask. + */ + public com.google.protobuf.FieldMask getConfigMask() { + if (configMaskBuilder_ == null) { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } else { + return configMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + configMask_ = value; + onChanged(); + } else { + configMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + public Builder setConfigMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (configMaskBuilder_ == null) { + configMask_ = builderForValue.build(); + onChanged(); + } else { + configMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + public Builder mergeConfigMask(com.google.protobuf.FieldMask value) { + if (configMaskBuilder_ == null) { + if (configMask_ != null) { + configMask_ = + com.google.protobuf.FieldMask.newBuilder(configMask_).mergeFrom(value).buildPartial(); + } else { + configMask_ = value; + } + onChanged(); + } else { + configMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + public Builder clearConfigMask() { + if (configMaskBuilder_ == null) { + configMask_ = null; + onChanged(); + } else { + configMask_ = null; + configMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + public com.google.protobuf.FieldMask.Builder getConfigMaskBuilder() { + + onChanged(); + return getConfigMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + public com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder() { + if (configMaskBuilder_ != null) { + return configMaskBuilder_.getMessageOrBuilder(); + } else { + return configMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : configMask_; + } + } + /** + * + * + *
+     * The list of fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+     * override the values in the
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+     * of the recognizer during this recognition request. If no mask is provided,
+     * all non-default valued fields in
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+     * the values in the recognizer for this recognition request. If a mask is
+     * provided, only the fields listed in the mask override the config in the
+     * recognizer for this recognition request. If a wildcard (`*`) is provided,
+     * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+     * completely overrides and replaces the config in the recognizer for this
+     * recognition request.
+     * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getConfigMaskFieldBuilder() { + if (configMaskBuilder_ == null) { + configMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getConfigMask(), getParentForChildren(), isClean()); + configMask_ = null; + } + return configMaskBuilder_; + } + + private com.google.cloud.speech.v2.StreamingRecognitionFeatures streamingFeatures_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionFeatures, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder, + com.google.cloud.speech.v2.StreamingRecognitionFeaturesOrBuilder> + streamingFeaturesBuilder_; + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + * + * @return Whether the streamingFeatures field is set. + */ + public boolean hasStreamingFeatures() { + return streamingFeaturesBuilder_ != null || streamingFeatures_ != null; + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + * + * @return The streamingFeatures. + */ + public com.google.cloud.speech.v2.StreamingRecognitionFeatures getStreamingFeatures() { + if (streamingFeaturesBuilder_ == null) { + return streamingFeatures_ == null + ? com.google.cloud.speech.v2.StreamingRecognitionFeatures.getDefaultInstance() + : streamingFeatures_; + } else { + return streamingFeaturesBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + public Builder setStreamingFeatures( + com.google.cloud.speech.v2.StreamingRecognitionFeatures value) { + if (streamingFeaturesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + streamingFeatures_ = value; + onChanged(); + } else { + streamingFeaturesBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + public Builder setStreamingFeatures( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder builderForValue) { + if (streamingFeaturesBuilder_ == null) { + streamingFeatures_ = builderForValue.build(); + onChanged(); + } else { + streamingFeaturesBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + public Builder mergeStreamingFeatures( + com.google.cloud.speech.v2.StreamingRecognitionFeatures value) { + if (streamingFeaturesBuilder_ == null) { + if (streamingFeatures_ != null) { + streamingFeatures_ = + com.google.cloud.speech.v2.StreamingRecognitionFeatures.newBuilder(streamingFeatures_) + .mergeFrom(value) + .buildPartial(); + } else { + streamingFeatures_ = value; + } + onChanged(); + } else { + streamingFeaturesBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + public Builder clearStreamingFeatures() { + if (streamingFeaturesBuilder_ == null) { + streamingFeatures_ = null; + onChanged(); + } else { + streamingFeatures_ = null; + streamingFeaturesBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder + getStreamingFeaturesBuilder() { + + onChanged(); + return getStreamingFeaturesFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + public com.google.cloud.speech.v2.StreamingRecognitionFeaturesOrBuilder + getStreamingFeaturesOrBuilder() { + if (streamingFeaturesBuilder_ != null) { + return streamingFeaturesBuilder_.getMessageOrBuilder(); + } else { + return streamingFeatures_ == null + ? com.google.cloud.speech.v2.StreamingRecognitionFeatures.getDefaultInstance() + : streamingFeatures_; + } + } + /** + * + * + *
+     * Speech recognition features to enable specific to streaming audio
+     * recognition requests.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionFeatures, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder, + com.google.cloud.speech.v2.StreamingRecognitionFeaturesOrBuilder> + getStreamingFeaturesFieldBuilder() { + if (streamingFeaturesBuilder_ == null) { + streamingFeaturesBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionFeatures, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder, + com.google.cloud.speech.v2.StreamingRecognitionFeaturesOrBuilder>( + getStreamingFeatures(), getParentForChildren(), isClean()); + streamingFeatures_ = null; + } + return streamingFeaturesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.StreamingRecognitionConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.StreamingRecognitionConfig) + private static final com.google.cloud.speech.v2.StreamingRecognitionConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.StreamingRecognitionConfig(); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingRecognitionConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new StreamingRecognitionConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfigOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfigOrBuilder.java new file mode 100644 index 000000000000..8bdb2d81b5fe --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionConfigOrBuilder.java @@ -0,0 +1,190 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface StreamingRecognitionConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.StreamingRecognitionConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Features and audio metadata to use for the Automatic Speech
+   * Recognition. This field in combination with the
+   * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * + * + *
+   * Required. Features and audio metadata to use for the Automatic Speech
+   * Recognition. This field in combination with the
+   * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + com.google.cloud.speech.v2.RecognitionConfig getConfig(); + /** + * + * + *
+   * Required. Features and audio metadata to use for the Automatic Speech
+   * Recognition. This field in combination with the
+   * [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
+   * field can be used to override parts of the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the Recognizer resource.
+   * 
+ * + * + * .google.cloud.speech.v2.RecognitionConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.RecognitionConfigOrBuilder getConfigOrBuilder(); + + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + * + * @return Whether the configMask field is set. + */ + boolean hasConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + * + * @return The configMask. + */ + com.google.protobuf.FieldMask getConfigMask(); + /** + * + * + *
+   * The list of fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
+   * override the values in the
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
+   * of the recognizer during this recognition request. If no mask is provided,
+   * all non-default valued fields in
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
+   * the values in the recognizer for this recognition request. If a mask is
+   * provided, only the fields listed in the mask override the config in the
+   * recognizer for this recognition request. If a wildcard (`*`) is provided,
+   * [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
+   * completely overrides and replaces the config in the recognizer for this
+   * recognition request.
+   * 
+ * + * .google.protobuf.FieldMask config_mask = 3; + */ + com.google.protobuf.FieldMaskOrBuilder getConfigMaskOrBuilder(); + + /** + * + * + *
+   * Speech recognition features to enable specific to streaming audio
+   * recognition requests.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + * + * @return Whether the streamingFeatures field is set. + */ + boolean hasStreamingFeatures(); + /** + * + * + *
+   * Speech recognition features to enable specific to streaming audio
+   * recognition requests.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + * + * @return The streamingFeatures. + */ + com.google.cloud.speech.v2.StreamingRecognitionFeatures getStreamingFeatures(); + /** + * + * + *
+   * Speech recognition features to enable specific to streaming audio
+   * recognition requests.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionFeatures streaming_features = 2; + */ + com.google.cloud.speech.v2.StreamingRecognitionFeaturesOrBuilder getStreamingFeaturesOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeatures.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeatures.java new file mode 100644 index 000000000000..cbcbb920ec9f --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeatures.java @@ -0,0 +1,2158 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Available recognition features specific to streaming recognition requests.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognitionFeatures} + */ +public final class StreamingRecognitionFeatures extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.StreamingRecognitionFeatures) + StreamingRecognitionFeaturesOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingRecognitionFeatures.newBuilder() to construct. + private StreamingRecognitionFeatures(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingRecognitionFeatures() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingRecognitionFeatures(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private StreamingRecognitionFeatures( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + enableVoiceActivityEvents_ = input.readBool(); + break; + } + case 16: + { + interimResults_ = input.readBool(); + break; + } + case 26: + { + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.Builder + subBuilder = null; + if (voiceActivityTimeout_ != null) { + subBuilder = voiceActivityTimeout_.toBuilder(); + } + voiceActivityTimeout_ = + input.readMessage( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(voiceActivityTimeout_); + voiceActivityTimeout_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.class, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder.class); + } + + public interface VoiceActivityTimeoutOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Duration to timeout the stream if no speech begins. If this is set and
+     * no speech is detected in this duration at the start of the stream, the
+     * server will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + * + * @return Whether the speechStartTimeout field is set. + */ + boolean hasSpeechStartTimeout(); + /** + * + * + *
+     * Duration to timeout the stream if no speech begins. If this is set and
+     * no speech is detected in this duration at the start of the stream, the
+     * server will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + * + * @return The speechStartTimeout. + */ + com.google.protobuf.Duration getSpeechStartTimeout(); + /** + * + * + *
+     * Duration to timeout the stream if no speech begins. If this is set and
+     * no speech is detected in this duration at the start of the stream, the
+     * server will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + com.google.protobuf.DurationOrBuilder getSpeechStartTimeoutOrBuilder(); + + /** + * + * + *
+     * Duration to timeout the stream after speech ends. If this is set and no
+     * speech is detected in this duration after speech was detected, the server
+     * will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + * + * @return Whether the speechEndTimeout field is set. + */ + boolean hasSpeechEndTimeout(); + /** + * + * + *
+     * Duration to timeout the stream after speech ends. If this is set and no
+     * speech is detected in this duration after speech was detected, the server
+     * will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + * + * @return The speechEndTimeout. + */ + com.google.protobuf.Duration getSpeechEndTimeout(); + /** + * + * + *
+     * Duration to timeout the stream after speech ends. If this is set and no
+     * speech is detected in this duration after speech was detected, the server
+     * will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + com.google.protobuf.DurationOrBuilder getSpeechEndTimeoutOrBuilder(); + } + /** + * + * + *
+   * Events that a timeout can be set on for voice activity.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout} + */ + public static final class VoiceActivityTimeout extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) + VoiceActivityTimeoutOrBuilder { + private static final long serialVersionUID = 0L; + // Use VoiceActivityTimeout.newBuilder() to construct. + private VoiceActivityTimeout(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private VoiceActivityTimeout() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new VoiceActivityTimeout(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private VoiceActivityTimeout( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (speechStartTimeout_ != null) { + subBuilder = speechStartTimeout_.toBuilder(); + } + speechStartTimeout_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(speechStartTimeout_); + speechStartTimeout_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (speechEndTimeout_ != null) { + subBuilder = speechEndTimeout_.toBuilder(); + } + speechEndTimeout_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(speechEndTimeout_); + speechEndTimeout_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_VoiceActivityTimeout_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_VoiceActivityTimeout_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.class, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.Builder + .class); + } + + public static final int SPEECH_START_TIMEOUT_FIELD_NUMBER = 1; + private com.google.protobuf.Duration speechStartTimeout_; + /** + * + * + *
+     * Duration to timeout the stream if no speech begins. If this is set and
+     * no speech is detected in this duration at the start of the stream, the
+     * server will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + * + * @return Whether the speechStartTimeout field is set. + */ + @java.lang.Override + public boolean hasSpeechStartTimeout() { + return speechStartTimeout_ != null; + } + /** + * + * + *
+     * Duration to timeout the stream if no speech begins. If this is set and
+     * no speech is detected in this duration at the start of the stream, the
+     * server will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + * + * @return The speechStartTimeout. + */ + @java.lang.Override + public com.google.protobuf.Duration getSpeechStartTimeout() { + return speechStartTimeout_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechStartTimeout_; + } + /** + * + * + *
+     * Duration to timeout the stream if no speech begins. If this is set and
+     * no speech is detected in this duration at the start of the stream, the
+     * server will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getSpeechStartTimeoutOrBuilder() { + return getSpeechStartTimeout(); + } + + public static final int SPEECH_END_TIMEOUT_FIELD_NUMBER = 2; + private com.google.protobuf.Duration speechEndTimeout_; + /** + * + * + *
+     * Duration to timeout the stream after speech ends. If this is set and no
+     * speech is detected in this duration after speech was detected, the server
+     * will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + * + * @return Whether the speechEndTimeout field is set. + */ + @java.lang.Override + public boolean hasSpeechEndTimeout() { + return speechEndTimeout_ != null; + } + /** + * + * + *
+     * Duration to timeout the stream after speech ends. If this is set and no
+     * speech is detected in this duration after speech was detected, the server
+     * will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + * + * @return The speechEndTimeout. + */ + @java.lang.Override + public com.google.protobuf.Duration getSpeechEndTimeout() { + return speechEndTimeout_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechEndTimeout_; + } + /** + * + * + *
+     * Duration to timeout the stream after speech ends. If this is set and no
+     * speech is detected in this duration after speech was detected, the server
+     * will close the stream.
+     * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getSpeechEndTimeoutOrBuilder() { + return getSpeechEndTimeout(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (speechStartTimeout_ != null) { + output.writeMessage(1, getSpeechStartTimeout()); + } + if (speechEndTimeout_ != null) { + output.writeMessage(2, getSpeechEndTimeout()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (speechStartTimeout_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSpeechStartTimeout()); + } + if (speechEndTimeout_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSpeechEndTimeout()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout other = + (com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) obj; + + if (hasSpeechStartTimeout() != other.hasSpeechStartTimeout()) return false; + if (hasSpeechStartTimeout()) { + if (!getSpeechStartTimeout().equals(other.getSpeechStartTimeout())) return false; + } + if (hasSpeechEndTimeout() != other.hasSpeechEndTimeout()) return false; + if (hasSpeechEndTimeout()) { + if (!getSpeechEndTimeout().equals(other.getSpeechEndTimeout())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasSpeechStartTimeout()) { + hash = (37 * hash) + SPEECH_START_TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getSpeechStartTimeout().hashCode(); + } + if (hasSpeechEndTimeout()) { + hash = (37 * hash) + SPEECH_END_TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getSpeechEndTimeout().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Events that a timeout can be set on for voice activity.
+     * 
+ * + * Protobuf type {@code + * google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeoutOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_VoiceActivityTimeout_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_VoiceActivityTimeout_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.class, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.Builder + .class); + } + + // Construct using + // com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (speechStartTimeoutBuilder_ == null) { + speechStartTimeout_ = null; + } else { + speechStartTimeout_ = null; + speechStartTimeoutBuilder_ = null; + } + if (speechEndTimeoutBuilder_ == null) { + speechEndTimeout_ = null; + } else { + speechEndTimeout_ = null; + speechEndTimeoutBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_VoiceActivityTimeout_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + getDefaultInstanceForType() { + return com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout build() { + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + buildPartial() { + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout result = + new com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout(this); + if (speechStartTimeoutBuilder_ == null) { + result.speechStartTimeout_ = speechStartTimeout_; + } else { + result.speechStartTimeout_ = speechStartTimeoutBuilder_.build(); + } + if (speechEndTimeoutBuilder_ == null) { + result.speechEndTimeout_ = speechEndTimeout_; + } else { + result.speechEndTimeout_ = speechEndTimeoutBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) { + return mergeFrom( + (com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout other) { + if (other + == com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .getDefaultInstance()) return this; + if (other.hasSpeechStartTimeout()) { + mergeSpeechStartTimeout(other.getSpeechStartTimeout()); + } + if (other.hasSpeechEndTimeout()) { + mergeSpeechEndTimeout(other.getSpeechEndTimeout()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout parsedMessage = + null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Duration speechStartTimeout_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + speechStartTimeoutBuilder_; + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + * + * @return Whether the speechStartTimeout field is set. + */ + public boolean hasSpeechStartTimeout() { + return speechStartTimeoutBuilder_ != null || speechStartTimeout_ != null; + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + * + * @return The speechStartTimeout. + */ + public com.google.protobuf.Duration getSpeechStartTimeout() { + if (speechStartTimeoutBuilder_ == null) { + return speechStartTimeout_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechStartTimeout_; + } else { + return speechStartTimeoutBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + public Builder setSpeechStartTimeout(com.google.protobuf.Duration value) { + if (speechStartTimeoutBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + speechStartTimeout_ = value; + onChanged(); + } else { + speechStartTimeoutBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + public Builder setSpeechStartTimeout(com.google.protobuf.Duration.Builder builderForValue) { + if (speechStartTimeoutBuilder_ == null) { + speechStartTimeout_ = builderForValue.build(); + onChanged(); + } else { + speechStartTimeoutBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + public Builder mergeSpeechStartTimeout(com.google.protobuf.Duration value) { + if (speechStartTimeoutBuilder_ == null) { + if (speechStartTimeout_ != null) { + speechStartTimeout_ = + com.google.protobuf.Duration.newBuilder(speechStartTimeout_) + .mergeFrom(value) + .buildPartial(); + } else { + speechStartTimeout_ = value; + } + onChanged(); + } else { + speechStartTimeoutBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + public Builder clearSpeechStartTimeout() { + if (speechStartTimeoutBuilder_ == null) { + speechStartTimeout_ = null; + onChanged(); + } else { + speechStartTimeout_ = null; + speechStartTimeoutBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + public com.google.protobuf.Duration.Builder getSpeechStartTimeoutBuilder() { + + onChanged(); + return getSpeechStartTimeoutFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + public com.google.protobuf.DurationOrBuilder getSpeechStartTimeoutOrBuilder() { + if (speechStartTimeoutBuilder_ != null) { + return speechStartTimeoutBuilder_.getMessageOrBuilder(); + } else { + return speechStartTimeout_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechStartTimeout_; + } + } + /** + * + * + *
+       * Duration to timeout the stream if no speech begins. If this is set and
+       * no speech is detected in this duration at the start of the stream, the
+       * server will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_start_timeout = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getSpeechStartTimeoutFieldBuilder() { + if (speechStartTimeoutBuilder_ == null) { + speechStartTimeoutBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getSpeechStartTimeout(), getParentForChildren(), isClean()); + speechStartTimeout_ = null; + } + return speechStartTimeoutBuilder_; + } + + private com.google.protobuf.Duration speechEndTimeout_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + speechEndTimeoutBuilder_; + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + * + * @return Whether the speechEndTimeout field is set. + */ + public boolean hasSpeechEndTimeout() { + return speechEndTimeoutBuilder_ != null || speechEndTimeout_ != null; + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + * + * @return The speechEndTimeout. + */ + public com.google.protobuf.Duration getSpeechEndTimeout() { + if (speechEndTimeoutBuilder_ == null) { + return speechEndTimeout_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechEndTimeout_; + } else { + return speechEndTimeoutBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + public Builder setSpeechEndTimeout(com.google.protobuf.Duration value) { + if (speechEndTimeoutBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + speechEndTimeout_ = value; + onChanged(); + } else { + speechEndTimeoutBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + public Builder setSpeechEndTimeout(com.google.protobuf.Duration.Builder builderForValue) { + if (speechEndTimeoutBuilder_ == null) { + speechEndTimeout_ = builderForValue.build(); + onChanged(); + } else { + speechEndTimeoutBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + public Builder mergeSpeechEndTimeout(com.google.protobuf.Duration value) { + if (speechEndTimeoutBuilder_ == null) { + if (speechEndTimeout_ != null) { + speechEndTimeout_ = + com.google.protobuf.Duration.newBuilder(speechEndTimeout_) + .mergeFrom(value) + .buildPartial(); + } else { + speechEndTimeout_ = value; + } + onChanged(); + } else { + speechEndTimeoutBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + public Builder clearSpeechEndTimeout() { + if (speechEndTimeoutBuilder_ == null) { + speechEndTimeout_ = null; + onChanged(); + } else { + speechEndTimeout_ = null; + speechEndTimeoutBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + public com.google.protobuf.Duration.Builder getSpeechEndTimeoutBuilder() { + + onChanged(); + return getSpeechEndTimeoutFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + public com.google.protobuf.DurationOrBuilder getSpeechEndTimeoutOrBuilder() { + if (speechEndTimeoutBuilder_ != null) { + return speechEndTimeoutBuilder_.getMessageOrBuilder(); + } else { + return speechEndTimeout_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechEndTimeout_; + } + } + /** + * + * + *
+       * Duration to timeout the stream after speech ends. If this is set and no
+       * speech is detected in this duration after speech was detected, the server
+       * will close the stream.
+       * 
+ * + * .google.protobuf.Duration speech_end_timeout = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getSpeechEndTimeoutFieldBuilder() { + if (speechEndTimeoutBuilder_ == null) { + speechEndTimeoutBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getSpeechEndTimeout(), getParentForChildren(), isClean()); + speechEndTimeout_ = null; + } + return speechEndTimeoutBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout) + private static final com.google.cloud.speech.v2.StreamingRecognitionFeatures + .VoiceActivityTimeout + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout(); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public VoiceActivityTimeout parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new VoiceActivityTimeout(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int ENABLE_VOICE_ACTIVITY_EVENTS_FIELD_NUMBER = 1; + private boolean enableVoiceActivityEvents_; + /** + * + * + *
+   * If `true`, responses with voice activity speech events will be returned as
+   * they are detected.
+   * 
+ * + * bool enable_voice_activity_events = 1; + * + * @return The enableVoiceActivityEvents. + */ + @java.lang.Override + public boolean getEnableVoiceActivityEvents() { + return enableVoiceActivityEvents_; + } + + public static final int INTERIM_RESULTS_FIELD_NUMBER = 2; + private boolean interimResults_; + /** + * + * + *
+   * Whether or not to stream interim results to the client. If set to true,
+   * interim results will be streamed to the client. Otherwise, only the final
+   * response will be streamed back.
+   * 
+ * + * bool interim_results = 2; + * + * @return The interimResults. + */ + @java.lang.Override + public boolean getInterimResults() { + return interimResults_; + } + + public static final int VOICE_ACTIVITY_TIMEOUT_FIELD_NUMBER = 3; + private com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + voiceActivityTimeout_; + /** + * + * + *
+   * If set, the server will automatically close the stream after the specified
+   * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+   * sent. The field `voice_activity_events` must also be set to true.
+   * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + * + * @return Whether the voiceActivityTimeout field is set. + */ + @java.lang.Override + public boolean hasVoiceActivityTimeout() { + return voiceActivityTimeout_ != null; + } + /** + * + * + *
+   * If set, the server will automatically close the stream after the specified
+   * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+   * sent. The field `voice_activity_events` must also be set to true.
+   * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + * + * @return The voiceActivityTimeout. + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + getVoiceActivityTimeout() { + return voiceActivityTimeout_ == null + ? com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .getDefaultInstance() + : voiceActivityTimeout_; + } + /** + * + * + *
+   * If set, the server will automatically close the stream after the specified
+   * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+   * sent. The field `voice_activity_events` must also be set to true.
+   * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeoutOrBuilder + getVoiceActivityTimeoutOrBuilder() { + return getVoiceActivityTimeout(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (enableVoiceActivityEvents_ != false) { + output.writeBool(1, enableVoiceActivityEvents_); + } + if (interimResults_ != false) { + output.writeBool(2, interimResults_); + } + if (voiceActivityTimeout_ != null) { + output.writeMessage(3, getVoiceActivityTimeout()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (enableVoiceActivityEvents_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, enableVoiceActivityEvents_); + } + if (interimResults_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, interimResults_); + } + if (voiceActivityTimeout_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(3, getVoiceActivityTimeout()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.StreamingRecognitionFeatures)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.StreamingRecognitionFeatures other = + (com.google.cloud.speech.v2.StreamingRecognitionFeatures) obj; + + if (getEnableVoiceActivityEvents() != other.getEnableVoiceActivityEvents()) return false; + if (getInterimResults() != other.getInterimResults()) return false; + if (hasVoiceActivityTimeout() != other.hasVoiceActivityTimeout()) return false; + if (hasVoiceActivityTimeout()) { + if (!getVoiceActivityTimeout().equals(other.getVoiceActivityTimeout())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENABLE_VOICE_ACTIVITY_EVENTS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableVoiceActivityEvents()); + hash = (37 * hash) + INTERIM_RESULTS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getInterimResults()); + if (hasVoiceActivityTimeout()) { + hash = (37 * hash) + VOICE_ACTIVITY_TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getVoiceActivityTimeout().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.StreamingRecognitionFeatures prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Available recognition features specific to streaming recognition requests.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognitionFeatures} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.StreamingRecognitionFeatures) + com.google.cloud.speech.v2.StreamingRecognitionFeaturesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.class, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.StreamingRecognitionFeatures.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + enableVoiceActivityEvents_ = false; + + interimResults_ = false; + + if (voiceActivityTimeoutBuilder_ == null) { + voiceActivityTimeout_ = null; + } else { + voiceActivityTimeout_ = null; + voiceActivityTimeoutBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionFeatures_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures getDefaultInstanceForType() { + return com.google.cloud.speech.v2.StreamingRecognitionFeatures.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures build() { + com.google.cloud.speech.v2.StreamingRecognitionFeatures result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures buildPartial() { + com.google.cloud.speech.v2.StreamingRecognitionFeatures result = + new com.google.cloud.speech.v2.StreamingRecognitionFeatures(this); + result.enableVoiceActivityEvents_ = enableVoiceActivityEvents_; + result.interimResults_ = interimResults_; + if (voiceActivityTimeoutBuilder_ == null) { + result.voiceActivityTimeout_ = voiceActivityTimeout_; + } else { + result.voiceActivityTimeout_ = voiceActivityTimeoutBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.StreamingRecognitionFeatures) { + return mergeFrom((com.google.cloud.speech.v2.StreamingRecognitionFeatures) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.StreamingRecognitionFeatures other) { + if (other == com.google.cloud.speech.v2.StreamingRecognitionFeatures.getDefaultInstance()) + return this; + if (other.getEnableVoiceActivityEvents() != false) { + setEnableVoiceActivityEvents(other.getEnableVoiceActivityEvents()); + } + if (other.getInterimResults() != false) { + setInterimResults(other.getInterimResults()); + } + if (other.hasVoiceActivityTimeout()) { + mergeVoiceActivityTimeout(other.getVoiceActivityTimeout()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.StreamingRecognitionFeatures parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.StreamingRecognitionFeatures) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean enableVoiceActivityEvents_; + /** + * + * + *
+     * If `true`, responses with voice activity speech events will be returned as
+     * they are detected.
+     * 
+ * + * bool enable_voice_activity_events = 1; + * + * @return The enableVoiceActivityEvents. + */ + @java.lang.Override + public boolean getEnableVoiceActivityEvents() { + return enableVoiceActivityEvents_; + } + /** + * + * + *
+     * If `true`, responses with voice activity speech events will be returned as
+     * they are detected.
+     * 
+ * + * bool enable_voice_activity_events = 1; + * + * @param value The enableVoiceActivityEvents to set. + * @return This builder for chaining. + */ + public Builder setEnableVoiceActivityEvents(boolean value) { + + enableVoiceActivityEvents_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If `true`, responses with voice activity speech events will be returned as
+     * they are detected.
+     * 
+ * + * bool enable_voice_activity_events = 1; + * + * @return This builder for chaining. + */ + public Builder clearEnableVoiceActivityEvents() { + + enableVoiceActivityEvents_ = false; + onChanged(); + return this; + } + + private boolean interimResults_; + /** + * + * + *
+     * Whether or not to stream interim results to the client. If set to true,
+     * interim results will be streamed to the client. Otherwise, only the final
+     * response will be streamed back.
+     * 
+ * + * bool interim_results = 2; + * + * @return The interimResults. + */ + @java.lang.Override + public boolean getInterimResults() { + return interimResults_; + } + /** + * + * + *
+     * Whether or not to stream interim results to the client. If set to true,
+     * interim results will be streamed to the client. Otherwise, only the final
+     * response will be streamed back.
+     * 
+ * + * bool interim_results = 2; + * + * @param value The interimResults to set. + * @return This builder for chaining. + */ + public Builder setInterimResults(boolean value) { + + interimResults_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Whether or not to stream interim results to the client. If set to true,
+     * interim results will be streamed to the client. Otherwise, only the final
+     * response will be streamed back.
+     * 
+ * + * bool interim_results = 2; + * + * @return This builder for chaining. + */ + public Builder clearInterimResults() { + + interimResults_ = false; + onChanged(); + return this; + } + + private com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + voiceActivityTimeout_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.Builder, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeoutOrBuilder> + voiceActivityTimeoutBuilder_; + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + * + * @return Whether the voiceActivityTimeout field is set. + */ + public boolean hasVoiceActivityTimeout() { + return voiceActivityTimeoutBuilder_ != null || voiceActivityTimeout_ != null; + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + * + * @return The voiceActivityTimeout. + */ + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + getVoiceActivityTimeout() { + if (voiceActivityTimeoutBuilder_ == null) { + return voiceActivityTimeout_ == null + ? com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .getDefaultInstance() + : voiceActivityTimeout_; + } else { + return voiceActivityTimeoutBuilder_.getMessage(); + } + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + public Builder setVoiceActivityTimeout( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout value) { + if (voiceActivityTimeoutBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + voiceActivityTimeout_ = value; + onChanged(); + } else { + voiceActivityTimeoutBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + public Builder setVoiceActivityTimeout( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.Builder + builderForValue) { + if (voiceActivityTimeoutBuilder_ == null) { + voiceActivityTimeout_ = builderForValue.build(); + onChanged(); + } else { + voiceActivityTimeoutBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + public Builder mergeVoiceActivityTimeout( + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout value) { + if (voiceActivityTimeoutBuilder_ == null) { + if (voiceActivityTimeout_ != null) { + voiceActivityTimeout_ = + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .newBuilder(voiceActivityTimeout_) + .mergeFrom(value) + .buildPartial(); + } else { + voiceActivityTimeout_ = value; + } + onChanged(); + } else { + voiceActivityTimeoutBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + public Builder clearVoiceActivityTimeout() { + if (voiceActivityTimeoutBuilder_ == null) { + voiceActivityTimeout_ = null; + onChanged(); + } else { + voiceActivityTimeout_ = null; + voiceActivityTimeoutBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.Builder + getVoiceActivityTimeoutBuilder() { + + onChanged(); + return getVoiceActivityTimeoutFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + public com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeoutOrBuilder + getVoiceActivityTimeoutOrBuilder() { + if (voiceActivityTimeoutBuilder_ != null) { + return voiceActivityTimeoutBuilder_.getMessageOrBuilder(); + } else { + return voiceActivityTimeout_ == null + ? com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .getDefaultInstance() + : voiceActivityTimeout_; + } + } + /** + * + * + *
+     * If set, the server will automatically close the stream after the specified
+     * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+     * sent. The field `voice_activity_events` must also be set to true.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout.Builder, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeoutOrBuilder> + getVoiceActivityTimeoutFieldBuilder() { + if (voiceActivityTimeoutBuilder_ == null) { + voiceActivityTimeoutBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout, + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + .Builder, + com.google.cloud.speech.v2.StreamingRecognitionFeatures + .VoiceActivityTimeoutOrBuilder>( + getVoiceActivityTimeout(), getParentForChildren(), isClean()); + voiceActivityTimeout_ = null; + } + return voiceActivityTimeoutBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.StreamingRecognitionFeatures) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.StreamingRecognitionFeatures) + private static final com.google.cloud.speech.v2.StreamingRecognitionFeatures DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.StreamingRecognitionFeatures(); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionFeatures getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingRecognitionFeatures parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new StreamingRecognitionFeatures(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionFeatures getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeaturesOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeaturesOrBuilder.java new file mode 100644 index 000000000000..9774eb7bf4b7 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionFeaturesOrBuilder.java @@ -0,0 +1,103 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface StreamingRecognitionFeaturesOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.StreamingRecognitionFeatures) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * If `true`, responses with voice activity speech events will be returned as
+   * they are detected.
+   * 
+ * + * bool enable_voice_activity_events = 1; + * + * @return The enableVoiceActivityEvents. + */ + boolean getEnableVoiceActivityEvents(); + + /** + * + * + *
+   * Whether or not to stream interim results to the client. If set to true,
+   * interim results will be streamed to the client. Otherwise, only the final
+   * response will be streamed back.
+   * 
+ * + * bool interim_results = 2; + * + * @return The interimResults. + */ + boolean getInterimResults(); + + /** + * + * + *
+   * If set, the server will automatically close the stream after the specified
+   * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+   * sent. The field `voice_activity_events` must also be set to true.
+   * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + * + * @return Whether the voiceActivityTimeout field is set. + */ + boolean hasVoiceActivityTimeout(); + /** + * + * + *
+   * If set, the server will automatically close the stream after the specified
+   * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+   * sent. The field `voice_activity_events` must also be set to true.
+   * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + * + * @return The voiceActivityTimeout. + */ + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout + getVoiceActivityTimeout(); + /** + * + * + *
+   * If set, the server will automatically close the stream after the specified
+   * duration has elapsed after the last VOICE_ACTIVITY speech event has been
+   * sent. The field `voice_activity_events` must also be set to true.
+   * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout voice_activity_timeout = 3; + * + */ + com.google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeoutOrBuilder + getVoiceActivityTimeoutOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResult.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResult.java new file mode 100644 index 000000000000..87d461a72a49 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResult.java @@ -0,0 +1,1824 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * A streaming speech recognition result corresponding to a portion of the audio
+ * that is currently being processed.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognitionResult} + */ +public final class StreamingRecognitionResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.StreamingRecognitionResult) + StreamingRecognitionResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingRecognitionResult.newBuilder() to construct. + private StreamingRecognitionResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingRecognitionResult() { + alternatives_ = java.util.Collections.emptyList(); + languageCode_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingRecognitionResult(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private StreamingRecognitionResult( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + alternatives_ = + new java.util.ArrayList< + com.google.cloud.speech.v2.SpeechRecognitionAlternative>(); + mutable_bitField0_ |= 0x00000001; + } + alternatives_.add( + input.readMessage( + com.google.cloud.speech.v2.SpeechRecognitionAlternative.parser(), + extensionRegistry)); + break; + } + case 16: + { + isFinal_ = input.readBool(); + break; + } + case 29: + { + stability_ = input.readFloat(); + break; + } + case 34: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (resultEndOffset_ != null) { + subBuilder = resultEndOffset_.toBuilder(); + } + resultEndOffset_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(resultEndOffset_); + resultEndOffset_ = subBuilder.buildPartial(); + } + + break; + } + case 40: + { + channelTag_ = input.readInt32(); + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + languageCode_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + alternatives_ = java.util.Collections.unmodifiableList(alternatives_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionResult.class, + com.google.cloud.speech.v2.StreamingRecognitionResult.Builder.class); + } + + public static final int ALTERNATIVES_FIELD_NUMBER = 1; + private java.util.List alternatives_; + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public java.util.List + getAlternativesList() { + return alternatives_; + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public java.util.List + getAlternativesOrBuilderList() { + return alternatives_; + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public int getAlternativesCount() { + return alternatives_.size(); + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternative getAlternatives(int index) { + return alternatives_.get(index); + } + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + @java.lang.Override + public com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder getAlternativesOrBuilder( + int index) { + return alternatives_.get(index); + } + + public static final int IS_FINAL_FIELD_NUMBER = 2; + private boolean isFinal_; + /** + * + * + *
+   * If `false`, this
+   * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult]
+   * represents an interim result that may change. If `true`, this is the final
+   * time the speech service will return this particular
+   * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult],
+   * the recognizer will not return any further hypotheses for this portion of
+   * the transcript and corresponding audio.
+   * 
+ * + * bool is_final = 2; + * + * @return The isFinal. + */ + @java.lang.Override + public boolean getIsFinal() { + return isFinal_; + } + + public static final int STABILITY_FIELD_NUMBER = 3; + private float stability_; + /** + * + * + *
+   * An estimate of the likelihood that the recognizer will not change its guess
+   * about this interim result. Values range from 0.0 (completely unstable)
+   * to 1.0 (completely stable). This field is only provided for interim results
+   * ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`).
+   * The default of 0.0 is a sentinel value indicating `stability` was not set.
+   * 
+ * + * float stability = 3; + * + * @return The stability. + */ + @java.lang.Override + public float getStability() { + return stability_; + } + + public static final int RESULT_END_OFFSET_FIELD_NUMBER = 4; + private com.google.protobuf.Duration resultEndOffset_; + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return Whether the resultEndOffset field is set. + */ + @java.lang.Override + public boolean hasResultEndOffset() { + return resultEndOffset_ != null; + } + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return The resultEndOffset. + */ + @java.lang.Override + public com.google.protobuf.Duration getResultEndOffset() { + return resultEndOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : resultEndOffset_; + } + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getResultEndOffsetOrBuilder() { + return getResultEndOffset(); + } + + public static final int CHANNEL_TAG_FIELD_NUMBER = 5; + private int channelTag_; + /** + * + * + *
+   * For multi-channel audio, this is the channel number corresponding to the
+   * recognized result for the audio from that channel.
+   * For
+   * `audio_channel_count` = `N`, its output values can range from `1` to `N`.
+   * 
+ * + * int32 channel_tag = 5; + * + * @return The channelTag. + */ + @java.lang.Override + public int getChannelTag() { + return channelTag_; + } + + public static final int LANGUAGE_CODE_FIELD_NUMBER = 6; + private volatile java.lang.Object languageCode_; + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The languageCode. + */ + @java.lang.Override + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for languageCode. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < alternatives_.size(); i++) { + output.writeMessage(1, alternatives_.get(i)); + } + if (isFinal_ != false) { + output.writeBool(2, isFinal_); + } + if (java.lang.Float.floatToRawIntBits(stability_) != 0) { + output.writeFloat(3, stability_); + } + if (resultEndOffset_ != null) { + output.writeMessage(4, getResultEndOffset()); + } + if (channelTag_ != 0) { + output.writeInt32(5, channelTag_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(languageCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, languageCode_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < alternatives_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, alternatives_.get(i)); + } + if (isFinal_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, isFinal_); + } + if (java.lang.Float.floatToRawIntBits(stability_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(3, stability_); + } + if (resultEndOffset_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getResultEndOffset()); + } + if (channelTag_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, channelTag_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(languageCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, languageCode_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.StreamingRecognitionResult)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.StreamingRecognitionResult other = + (com.google.cloud.speech.v2.StreamingRecognitionResult) obj; + + if (!getAlternativesList().equals(other.getAlternativesList())) return false; + if (getIsFinal() != other.getIsFinal()) return false; + if (java.lang.Float.floatToIntBits(getStability()) + != java.lang.Float.floatToIntBits(other.getStability())) return false; + if (hasResultEndOffset() != other.hasResultEndOffset()) return false; + if (hasResultEndOffset()) { + if (!getResultEndOffset().equals(other.getResultEndOffset())) return false; + } + if (getChannelTag() != other.getChannelTag()) return false; + if (!getLanguageCode().equals(other.getLanguageCode())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAlternativesCount() > 0) { + hash = (37 * hash) + ALTERNATIVES_FIELD_NUMBER; + hash = (53 * hash) + getAlternativesList().hashCode(); + } + hash = (37 * hash) + IS_FINAL_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getIsFinal()); + hash = (37 * hash) + STABILITY_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getStability()); + if (hasResultEndOffset()) { + hash = (37 * hash) + RESULT_END_OFFSET_FIELD_NUMBER; + hash = (53 * hash) + getResultEndOffset().hashCode(); + } + hash = (37 * hash) + CHANNEL_TAG_FIELD_NUMBER; + hash = (53 * hash) + getChannelTag(); + hash = (37 * hash) + LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getLanguageCode().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.StreamingRecognitionResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A streaming speech recognition result corresponding to a portion of the audio
+   * that is currently being processed.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognitionResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.StreamingRecognitionResult) + com.google.cloud.speech.v2.StreamingRecognitionResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognitionResult.class, + com.google.cloud.speech.v2.StreamingRecognitionResult.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.StreamingRecognitionResult.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getAlternativesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (alternativesBuilder_ == null) { + alternatives_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + alternativesBuilder_.clear(); + } + isFinal_ = false; + + stability_ = 0F; + + if (resultEndOffsetBuilder_ == null) { + resultEndOffset_ = null; + } else { + resultEndOffset_ = null; + resultEndOffsetBuilder_ = null; + } + channelTag_ = 0; + + languageCode_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognitionResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionResult getDefaultInstanceForType() { + return com.google.cloud.speech.v2.StreamingRecognitionResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionResult build() { + com.google.cloud.speech.v2.StreamingRecognitionResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionResult buildPartial() { + com.google.cloud.speech.v2.StreamingRecognitionResult result = + new com.google.cloud.speech.v2.StreamingRecognitionResult(this); + int from_bitField0_ = bitField0_; + if (alternativesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + alternatives_ = java.util.Collections.unmodifiableList(alternatives_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.alternatives_ = alternatives_; + } else { + result.alternatives_ = alternativesBuilder_.build(); + } + result.isFinal_ = isFinal_; + result.stability_ = stability_; + if (resultEndOffsetBuilder_ == null) { + result.resultEndOffset_ = resultEndOffset_; + } else { + result.resultEndOffset_ = resultEndOffsetBuilder_.build(); + } + result.channelTag_ = channelTag_; + result.languageCode_ = languageCode_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.StreamingRecognitionResult) { + return mergeFrom((com.google.cloud.speech.v2.StreamingRecognitionResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.StreamingRecognitionResult other) { + if (other == com.google.cloud.speech.v2.StreamingRecognitionResult.getDefaultInstance()) + return this; + if (alternativesBuilder_ == null) { + if (!other.alternatives_.isEmpty()) { + if (alternatives_.isEmpty()) { + alternatives_ = other.alternatives_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAlternativesIsMutable(); + alternatives_.addAll(other.alternatives_); + } + onChanged(); + } + } else { + if (!other.alternatives_.isEmpty()) { + if (alternativesBuilder_.isEmpty()) { + alternativesBuilder_.dispose(); + alternativesBuilder_ = null; + alternatives_ = other.alternatives_; + bitField0_ = (bitField0_ & ~0x00000001); + alternativesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getAlternativesFieldBuilder() + : null; + } else { + alternativesBuilder_.addAllMessages(other.alternatives_); + } + } + } + if (other.getIsFinal() != false) { + setIsFinal(other.getIsFinal()); + } + if (other.getStability() != 0F) { + setStability(other.getStability()); + } + if (other.hasResultEndOffset()) { + mergeResultEndOffset(other.getResultEndOffset()); + } + if (other.getChannelTag() != 0) { + setChannelTag(other.getChannelTag()); + } + if (!other.getLanguageCode().isEmpty()) { + languageCode_ = other.languageCode_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.StreamingRecognitionResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.StreamingRecognitionResult) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List alternatives_ = + java.util.Collections.emptyList(); + + private void ensureAlternativesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + alternatives_ = + new java.util.ArrayList( + alternatives_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionAlternative, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder, + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder> + alternativesBuilder_; + + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public java.util.List + getAlternativesList() { + if (alternativesBuilder_ == null) { + return java.util.Collections.unmodifiableList(alternatives_); + } else { + return alternativesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public int getAlternativesCount() { + if (alternativesBuilder_ == null) { + return alternatives_.size(); + } else { + return alternativesBuilder_.getCount(); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative getAlternatives(int index) { + if (alternativesBuilder_ == null) { + return alternatives_.get(index); + } else { + return alternativesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder setAlternatives( + int index, com.google.cloud.speech.v2.SpeechRecognitionAlternative value) { + if (alternativesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAlternativesIsMutable(); + alternatives_.set(index, value); + onChanged(); + } else { + alternativesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder setAlternatives( + int index, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder builderForValue) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.set(index, builderForValue.build()); + onChanged(); + } else { + alternativesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives(com.google.cloud.speech.v2.SpeechRecognitionAlternative value) { + if (alternativesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAlternativesIsMutable(); + alternatives_.add(value); + onChanged(); + } else { + alternativesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives( + int index, com.google.cloud.speech.v2.SpeechRecognitionAlternative value) { + if (alternativesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAlternativesIsMutable(); + alternatives_.add(index, value); + onChanged(); + } else { + alternativesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives( + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder builderForValue) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.add(builderForValue.build()); + onChanged(); + } else { + alternativesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAlternatives( + int index, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder builderForValue) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.add(index, builderForValue.build()); + onChanged(); + } else { + alternativesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder addAllAlternatives( + java.lang.Iterable + values) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, alternatives_); + onChanged(); + } else { + alternativesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder clearAlternatives() { + if (alternativesBuilder_ == null) { + alternatives_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + alternativesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public Builder removeAlternatives(int index) { + if (alternativesBuilder_ == null) { + ensureAlternativesIsMutable(); + alternatives_.remove(index); + onChanged(); + } else { + alternativesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder getAlternativesBuilder( + int index) { + return getAlternativesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder + getAlternativesOrBuilder(int index) { + if (alternativesBuilder_ == null) { + return alternatives_.get(index); + } else { + return alternativesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public java.util.List< + ? extends com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder> + getAlternativesOrBuilderList() { + if (alternativesBuilder_ != null) { + return alternativesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(alternatives_); + } + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder + addAlternativesBuilder() { + return getAlternativesFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.SpeechRecognitionAlternative.getDefaultInstance()); + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder addAlternativesBuilder( + int index) { + return getAlternativesFieldBuilder() + .addBuilder( + index, com.google.cloud.speech.v2.SpeechRecognitionAlternative.getDefaultInstance()); + } + /** + * + * + *
+     * May contain one or more recognition hypotheses. These alternatives are
+     * ordered in terms of accuracy, with the top (first) alternative being the
+     * most probable, as ranked by the recognizer.
+     * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + public java.util.List + getAlternativesBuilderList() { + return getAlternativesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionAlternative, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder, + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder> + getAlternativesFieldBuilder() { + if (alternativesBuilder_ == null) { + alternativesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.SpeechRecognitionAlternative, + com.google.cloud.speech.v2.SpeechRecognitionAlternative.Builder, + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder>( + alternatives_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + alternatives_ = null; + } + return alternativesBuilder_; + } + + private boolean isFinal_; + /** + * + * + *
+     * If `false`, this
+     * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult]
+     * represents an interim result that may change. If `true`, this is the final
+     * time the speech service will return this particular
+     * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult],
+     * the recognizer will not return any further hypotheses for this portion of
+     * the transcript and corresponding audio.
+     * 
+ * + * bool is_final = 2; + * + * @return The isFinal. + */ + @java.lang.Override + public boolean getIsFinal() { + return isFinal_; + } + /** + * + * + *
+     * If `false`, this
+     * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult]
+     * represents an interim result that may change. If `true`, this is the final
+     * time the speech service will return this particular
+     * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult],
+     * the recognizer will not return any further hypotheses for this portion of
+     * the transcript and corresponding audio.
+     * 
+ * + * bool is_final = 2; + * + * @param value The isFinal to set. + * @return This builder for chaining. + */ + public Builder setIsFinal(boolean value) { + + isFinal_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If `false`, this
+     * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult]
+     * represents an interim result that may change. If `true`, this is the final
+     * time the speech service will return this particular
+     * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult],
+     * the recognizer will not return any further hypotheses for this portion of
+     * the transcript and corresponding audio.
+     * 
+ * + * bool is_final = 2; + * + * @return This builder for chaining. + */ + public Builder clearIsFinal() { + + isFinal_ = false; + onChanged(); + return this; + } + + private float stability_; + /** + * + * + *
+     * An estimate of the likelihood that the recognizer will not change its guess
+     * about this interim result. Values range from 0.0 (completely unstable)
+     * to 1.0 (completely stable). This field is only provided for interim results
+     * ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`).
+     * The default of 0.0 is a sentinel value indicating `stability` was not set.
+     * 
+ * + * float stability = 3; + * + * @return The stability. + */ + @java.lang.Override + public float getStability() { + return stability_; + } + /** + * + * + *
+     * An estimate of the likelihood that the recognizer will not change its guess
+     * about this interim result. Values range from 0.0 (completely unstable)
+     * to 1.0 (completely stable). This field is only provided for interim results
+     * ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`).
+     * The default of 0.0 is a sentinel value indicating `stability` was not set.
+     * 
+ * + * float stability = 3; + * + * @param value The stability to set. + * @return This builder for chaining. + */ + public Builder setStability(float value) { + + stability_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * An estimate of the likelihood that the recognizer will not change its guess
+     * about this interim result. Values range from 0.0 (completely unstable)
+     * to 1.0 (completely stable). This field is only provided for interim results
+     * ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`).
+     * The default of 0.0 is a sentinel value indicating `stability` was not set.
+     * 
+ * + * float stability = 3; + * + * @return This builder for chaining. + */ + public Builder clearStability() { + + stability_ = 0F; + onChanged(); + return this; + } + + private com.google.protobuf.Duration resultEndOffset_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + resultEndOffsetBuilder_; + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return Whether the resultEndOffset field is set. + */ + public boolean hasResultEndOffset() { + return resultEndOffsetBuilder_ != null || resultEndOffset_ != null; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return The resultEndOffset. + */ + public com.google.protobuf.Duration getResultEndOffset() { + if (resultEndOffsetBuilder_ == null) { + return resultEndOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : resultEndOffset_; + } else { + return resultEndOffsetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder setResultEndOffset(com.google.protobuf.Duration value) { + if (resultEndOffsetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + resultEndOffset_ = value; + onChanged(); + } else { + resultEndOffsetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder setResultEndOffset(com.google.protobuf.Duration.Builder builderForValue) { + if (resultEndOffsetBuilder_ == null) { + resultEndOffset_ = builderForValue.build(); + onChanged(); + } else { + resultEndOffsetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder mergeResultEndOffset(com.google.protobuf.Duration value) { + if (resultEndOffsetBuilder_ == null) { + if (resultEndOffset_ != null) { + resultEndOffset_ = + com.google.protobuf.Duration.newBuilder(resultEndOffset_) + .mergeFrom(value) + .buildPartial(); + } else { + resultEndOffset_ = value; + } + onChanged(); + } else { + resultEndOffsetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public Builder clearResultEndOffset() { + if (resultEndOffsetBuilder_ == null) { + resultEndOffset_ = null; + onChanged(); + } else { + resultEndOffset_ = null; + resultEndOffsetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public com.google.protobuf.Duration.Builder getResultEndOffsetBuilder() { + + onChanged(); + return getResultEndOffsetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + public com.google.protobuf.DurationOrBuilder getResultEndOffsetOrBuilder() { + if (resultEndOffsetBuilder_ != null) { + return resultEndOffsetBuilder_.getMessageOrBuilder(); + } else { + return resultEndOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : resultEndOffset_; + } + } + /** + * + * + *
+     * Time offset of the end of this result relative to the beginning of the
+     * audio.
+     * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getResultEndOffsetFieldBuilder() { + if (resultEndOffsetBuilder_ == null) { + resultEndOffsetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getResultEndOffset(), getParentForChildren(), isClean()); + resultEndOffset_ = null; + } + return resultEndOffsetBuilder_; + } + + private int channelTag_; + /** + * + * + *
+     * For multi-channel audio, this is the channel number corresponding to the
+     * recognized result for the audio from that channel.
+     * For
+     * `audio_channel_count` = `N`, its output values can range from `1` to `N`.
+     * 
+ * + * int32 channel_tag = 5; + * + * @return The channelTag. + */ + @java.lang.Override + public int getChannelTag() { + return channelTag_; + } + /** + * + * + *
+     * For multi-channel audio, this is the channel number corresponding to the
+     * recognized result for the audio from that channel.
+     * For
+     * `audio_channel_count` = `N`, its output values can range from `1` to `N`.
+     * 
+ * + * int32 channel_tag = 5; + * + * @param value The channelTag to set. + * @return This builder for chaining. + */ + public Builder setChannelTag(int value) { + + channelTag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * For multi-channel audio, this is the channel number corresponding to the
+     * recognized result for the audio from that channel.
+     * For
+     * `audio_channel_count` = `N`, its output values can range from `1` to `N`.
+     * 
+ * + * int32 channel_tag = 5; + * + * @return This builder for chaining. + */ + public Builder clearChannelTag() { + + channelTag_ = 0; + onChanged(); + return this; + } + + private java.lang.Object languageCode_ = ""; + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The languageCode. + */ + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for languageCode. + */ + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The languageCode to set. + * @return This builder for chaining. + */ + public Builder setLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + languageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearLanguageCode() { + + languageCode_ = getDefaultInstance().getLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+     * language tag of the language in this result. This language code was
+     * detected to have the most likelihood of being spoken in the audio.
+     * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for languageCode to set. + * @return This builder for chaining. + */ + public Builder setLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + languageCode_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.StreamingRecognitionResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.StreamingRecognitionResult) + private static final com.google.cloud.speech.v2.StreamingRecognitionResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.StreamingRecognitionResult(); + } + + public static com.google.cloud.speech.v2.StreamingRecognitionResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingRecognitionResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new StreamingRecognitionResult(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResultOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResultOrBuilder.java new file mode 100644 index 000000000000..35f98cc5a427 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognitionResultOrBuilder.java @@ -0,0 +1,207 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface StreamingRecognitionResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.StreamingRecognitionResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + java.util.List getAlternativesList(); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + com.google.cloud.speech.v2.SpeechRecognitionAlternative getAlternatives(int index); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + int getAlternativesCount(); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + java.util.List + getAlternativesOrBuilderList(); + /** + * + * + *
+   * May contain one or more recognition hypotheses. These alternatives are
+   * ordered in terms of accuracy, with the top (first) alternative being the
+   * most probable, as ranked by the recognizer.
+   * 
+ * + * repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1; + */ + com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder getAlternativesOrBuilder( + int index); + + /** + * + * + *
+   * If `false`, this
+   * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult]
+   * represents an interim result that may change. If `true`, this is the final
+   * time the speech service will return this particular
+   * [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult],
+   * the recognizer will not return any further hypotheses for this portion of
+   * the transcript and corresponding audio.
+   * 
+ * + * bool is_final = 2; + * + * @return The isFinal. + */ + boolean getIsFinal(); + + /** + * + * + *
+   * An estimate of the likelihood that the recognizer will not change its guess
+   * about this interim result. Values range from 0.0 (completely unstable)
+   * to 1.0 (completely stable). This field is only provided for interim results
+   * ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`).
+   * The default of 0.0 is a sentinel value indicating `stability` was not set.
+   * 
+ * + * float stability = 3; + * + * @return The stability. + */ + float getStability(); + + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return Whether the resultEndOffset field is set. + */ + boolean hasResultEndOffset(); + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + * + * @return The resultEndOffset. + */ + com.google.protobuf.Duration getResultEndOffset(); + /** + * + * + *
+   * Time offset of the end of this result relative to the beginning of the
+   * audio.
+   * 
+ * + * .google.protobuf.Duration result_end_offset = 4; + */ + com.google.protobuf.DurationOrBuilder getResultEndOffsetOrBuilder(); + + /** + * + * + *
+   * For multi-channel audio, this is the channel number corresponding to the
+   * recognized result for the audio from that channel.
+   * For
+   * `audio_channel_count` = `N`, its output values can range from `1` to `N`.
+   * 
+ * + * int32 channel_tag = 5; + * + * @return The channelTag. + */ + int getChannelTag(); + + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The languageCode. + */ + java.lang.String getLanguageCode(); + /** + * + * + *
+   * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
+   * language tag of the language in this result. This language code was
+   * detected to have the most likelihood of being spoken in the audio.
+   * 
+ * + * string language_code = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for languageCode. + */ + com.google.protobuf.ByteString getLanguageCodeBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequest.java new file mode 100644 index 000000000000..94703486ee55 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequest.java @@ -0,0 +1,1262 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [StreamingRecognize][google.cloud.speech.v2.Speech.StreamingRecognize]
+ * method. Multiple
+ * [StreamingRecognizeRequest][google.cloud.speech.v2.StreamingRecognizeRequest]
+ * messages are sent. The first message must contain a
+ * [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer] and
+ * optionally a
+ * [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]
+ * message and must not contain
+ * [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio]. All
+ * subsequent messages must contain
+ * [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio] and must not
+ * contain a
+ * [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]
+ * message.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognizeRequest} + */ +public final class StreamingRecognizeRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.StreamingRecognizeRequest) + StreamingRecognizeRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingRecognizeRequest.newBuilder() to construct. + private StreamingRecognizeRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingRecognizeRequest() { + recognizer_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingRecognizeRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private StreamingRecognizeRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + recognizer_ = s; + break; + } + case 42: + { + streamingRequest_ = input.readBytes(); + streamingRequestCase_ = 5; + break; + } + case 50: + { + com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder subBuilder = null; + if (streamingRequestCase_ == 6) { + subBuilder = + ((com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_) + .toBuilder(); + } + streamingRequest_ = + input.readMessage( + com.google.cloud.speech.v2.StreamingRecognitionConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_); + streamingRequest_ = subBuilder.buildPartial(); + } + streamingRequestCase_ = 6; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognizeRequest.class, + com.google.cloud.speech.v2.StreamingRecognizeRequest.Builder.class); + } + + private int streamingRequestCase_ = 0; + private java.lang.Object streamingRequest_; + + public enum StreamingRequestCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + STREAMING_CONFIG(6), + AUDIO(5), + STREAMINGREQUEST_NOT_SET(0); + private final int value; + + private StreamingRequestCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static StreamingRequestCase valueOf(int value) { + return forNumber(value); + } + + public static StreamingRequestCase forNumber(int value) { + switch (value) { + case 6: + return STREAMING_CONFIG; + case 5: + return AUDIO; + case 0: + return STREAMINGREQUEST_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public StreamingRequestCase getStreamingRequestCase() { + return StreamingRequestCase.forNumber(streamingRequestCase_); + } + + public static final int RECOGNIZER_FIELD_NUMBER = 3; + private volatile java.lang.Object recognizer_; + /** + * + * + *
+   * Required. Streaming recognition should start with an initial request having
+   * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+   * The initial request with configuration can be omitted if the Recognizer
+   * being used has a
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + @java.lang.Override + public java.lang.String getRecognizer() { + java.lang.Object ref = recognizer_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizer_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Streaming recognition should start with an initial request having
+   * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+   * The initial request with configuration can be omitted if the Recognizer
+   * being used has a
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRecognizerBytes() { + java.lang.Object ref = recognizer_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STREAMING_CONFIG_FIELD_NUMBER = 6; + /** + * + * + *
+   * StreamingRecognitionConfig to be used in this recognition attempt.
+   * If provided, it will override the default RecognitionConfig stored in the
+   * Recognizer.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + * + * @return Whether the streamingConfig field is set. + */ + @java.lang.Override + public boolean hasStreamingConfig() { + return streamingRequestCase_ == 6; + } + /** + * + * + *
+   * StreamingRecognitionConfig to be used in this recognition attempt.
+   * If provided, it will override the default RecognitionConfig stored in the
+   * Recognizer.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + * + * @return The streamingConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfig getStreamingConfig() { + if (streamingRequestCase_ == 6) { + return (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_; + } + return com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance(); + } + /** + * + * + *
+   * StreamingRecognitionConfig to be used in this recognition attempt.
+   * If provided, it will override the default RecognitionConfig stored in the
+   * Recognizer.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfigOrBuilder + getStreamingConfigOrBuilder() { + if (streamingRequestCase_ == 6) { + return (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_; + } + return com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance(); + } + + public static final int AUDIO_FIELD_NUMBER = 5; + /** + * + * + *
+   * Inline audio bytes to be Recognized.
+   * 
+ * + * bytes audio = 5; + * + * @return Whether the audio field is set. + */ + @java.lang.Override + public boolean hasAudio() { + return streamingRequestCase_ == 5; + } + /** + * + * + *
+   * Inline audio bytes to be Recognized.
+   * 
+ * + * bytes audio = 5; + * + * @return The audio. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAudio() { + if (streamingRequestCase_ == 5) { + return (com.google.protobuf.ByteString) streamingRequest_; + } + return com.google.protobuf.ByteString.EMPTY; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizer_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, recognizer_); + } + if (streamingRequestCase_ == 5) { + output.writeBytes(5, (com.google.protobuf.ByteString) streamingRequest_); + } + if (streamingRequestCase_ == 6) { + output.writeMessage( + 6, (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(recognizer_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, recognizer_); + } + if (streamingRequestCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeBytesSize( + 5, (com.google.protobuf.ByteString) streamingRequest_); + } + if (streamingRequestCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.StreamingRecognizeRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.StreamingRecognizeRequest other = + (com.google.cloud.speech.v2.StreamingRecognizeRequest) obj; + + if (!getRecognizer().equals(other.getRecognizer())) return false; + if (!getStreamingRequestCase().equals(other.getStreamingRequestCase())) return false; + switch (streamingRequestCase_) { + case 6: + if (!getStreamingConfig().equals(other.getStreamingConfig())) return false; + break; + case 5: + if (!getAudio().equals(other.getAudio())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + RECOGNIZER_FIELD_NUMBER; + hash = (53 * hash) + getRecognizer().hashCode(); + switch (streamingRequestCase_) { + case 6: + hash = (37 * hash) + STREAMING_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getStreamingConfig().hashCode(); + break; + case 5: + hash = (37 * hash) + AUDIO_FIELD_NUMBER; + hash = (53 * hash) + getAudio().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.StreamingRecognizeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [StreamingRecognize][google.cloud.speech.v2.Speech.StreamingRecognize]
+   * method. Multiple
+   * [StreamingRecognizeRequest][google.cloud.speech.v2.StreamingRecognizeRequest]
+   * messages are sent. The first message must contain a
+   * [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer] and
+   * optionally a
+   * [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]
+   * message and must not contain
+   * [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio]. All
+   * subsequent messages must contain
+   * [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio] and must not
+   * contain a
+   * [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]
+   * message.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognizeRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.StreamingRecognizeRequest) + com.google.cloud.speech.v2.StreamingRecognizeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognizeRequest.class, + com.google.cloud.speech.v2.StreamingRecognizeRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.StreamingRecognizeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + recognizer_ = ""; + + streamingRequestCase_ = 0; + streamingRequest_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.StreamingRecognizeRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeRequest build() { + com.google.cloud.speech.v2.StreamingRecognizeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeRequest buildPartial() { + com.google.cloud.speech.v2.StreamingRecognizeRequest result = + new com.google.cloud.speech.v2.StreamingRecognizeRequest(this); + result.recognizer_ = recognizer_; + if (streamingRequestCase_ == 6) { + if (streamingConfigBuilder_ == null) { + result.streamingRequest_ = streamingRequest_; + } else { + result.streamingRequest_ = streamingConfigBuilder_.build(); + } + } + if (streamingRequestCase_ == 5) { + result.streamingRequest_ = streamingRequest_; + } + result.streamingRequestCase_ = streamingRequestCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.StreamingRecognizeRequest) { + return mergeFrom((com.google.cloud.speech.v2.StreamingRecognizeRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.StreamingRecognizeRequest other) { + if (other == com.google.cloud.speech.v2.StreamingRecognizeRequest.getDefaultInstance()) + return this; + if (!other.getRecognizer().isEmpty()) { + recognizer_ = other.recognizer_; + onChanged(); + } + switch (other.getStreamingRequestCase()) { + case STREAMING_CONFIG: + { + mergeStreamingConfig(other.getStreamingConfig()); + break; + } + case AUDIO: + { + setAudio(other.getAudio()); + break; + } + case STREAMINGREQUEST_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.StreamingRecognizeRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.StreamingRecognizeRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int streamingRequestCase_ = 0; + private java.lang.Object streamingRequest_; + + public StreamingRequestCase getStreamingRequestCase() { + return StreamingRequestCase.forNumber(streamingRequestCase_); + } + + public Builder clearStreamingRequest() { + streamingRequestCase_ = 0; + streamingRequest_ = null; + onChanged(); + return this; + } + + private java.lang.Object recognizer_ = ""; + /** + * + * + *
+     * Required. Streaming recognition should start with an initial request having
+     * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+     * The initial request with configuration can be omitted if the Recognizer
+     * being used has a
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + public java.lang.String getRecognizer() { + java.lang.Object ref = recognizer_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + recognizer_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Streaming recognition should start with an initial request having
+     * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+     * The initial request with configuration can be omitted if the Recognizer
+     * being used has a
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + public com.google.protobuf.ByteString getRecognizerBytes() { + java.lang.Object ref = recognizer_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + recognizer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Streaming recognition should start with an initial request having
+     * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+     * The initial request with configuration can be omitted if the Recognizer
+     * being used has a
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The recognizer to set. + * @return This builder for chaining. + */ + public Builder setRecognizer(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + recognizer_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Streaming recognition should start with an initial request having
+     * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+     * The initial request with configuration can be omitted if the Recognizer
+     * being used has a
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearRecognizer() { + + recognizer_ = getDefaultInstance().getRecognizer(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Streaming recognition should start with an initial request having
+     * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+     * The initial request with configuration can be omitted if the Recognizer
+     * being used has a
+     * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+     * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for recognizer to set. + * @return This builder for chaining. + */ + public Builder setRecognizerBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + recognizer_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionConfig, + com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder, + com.google.cloud.speech.v2.StreamingRecognitionConfigOrBuilder> + streamingConfigBuilder_; + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + * + * @return Whether the streamingConfig field is set. + */ + @java.lang.Override + public boolean hasStreamingConfig() { + return streamingRequestCase_ == 6; + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + * + * @return The streamingConfig. + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfig getStreamingConfig() { + if (streamingConfigBuilder_ == null) { + if (streamingRequestCase_ == 6) { + return (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_; + } + return com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance(); + } else { + if (streamingRequestCase_ == 6) { + return streamingConfigBuilder_.getMessage(); + } + return com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + public Builder setStreamingConfig(com.google.cloud.speech.v2.StreamingRecognitionConfig value) { + if (streamingConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + streamingRequest_ = value; + onChanged(); + } else { + streamingConfigBuilder_.setMessage(value); + } + streamingRequestCase_ = 6; + return this; + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + public Builder setStreamingConfig( + com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder builderForValue) { + if (streamingConfigBuilder_ == null) { + streamingRequest_ = builderForValue.build(); + onChanged(); + } else { + streamingConfigBuilder_.setMessage(builderForValue.build()); + } + streamingRequestCase_ = 6; + return this; + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + public Builder mergeStreamingConfig( + com.google.cloud.speech.v2.StreamingRecognitionConfig value) { + if (streamingConfigBuilder_ == null) { + if (streamingRequestCase_ == 6 + && streamingRequest_ + != com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance()) { + streamingRequest_ = + com.google.cloud.speech.v2.StreamingRecognitionConfig.newBuilder( + (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_) + .mergeFrom(value) + .buildPartial(); + } else { + streamingRequest_ = value; + } + onChanged(); + } else { + if (streamingRequestCase_ == 6) { + streamingConfigBuilder_.mergeFrom(value); + } else { + streamingConfigBuilder_.setMessage(value); + } + } + streamingRequestCase_ = 6; + return this; + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + public Builder clearStreamingConfig() { + if (streamingConfigBuilder_ == null) { + if (streamingRequestCase_ == 6) { + streamingRequestCase_ = 0; + streamingRequest_ = null; + onChanged(); + } + } else { + if (streamingRequestCase_ == 6) { + streamingRequestCase_ = 0; + streamingRequest_ = null; + } + streamingConfigBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + public com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder + getStreamingConfigBuilder() { + return getStreamingConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionConfigOrBuilder + getStreamingConfigOrBuilder() { + if ((streamingRequestCase_ == 6) && (streamingConfigBuilder_ != null)) { + return streamingConfigBuilder_.getMessageOrBuilder(); + } else { + if (streamingRequestCase_ == 6) { + return (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_; + } + return com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * StreamingRecognitionConfig to be used in this recognition attempt.
+     * If provided, it will override the default RecognitionConfig stored in the
+     * Recognizer.
+     * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionConfig, + com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder, + com.google.cloud.speech.v2.StreamingRecognitionConfigOrBuilder> + getStreamingConfigFieldBuilder() { + if (streamingConfigBuilder_ == null) { + if (!(streamingRequestCase_ == 6)) { + streamingRequest_ = + com.google.cloud.speech.v2.StreamingRecognitionConfig.getDefaultInstance(); + } + streamingConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionConfig, + com.google.cloud.speech.v2.StreamingRecognitionConfig.Builder, + com.google.cloud.speech.v2.StreamingRecognitionConfigOrBuilder>( + (com.google.cloud.speech.v2.StreamingRecognitionConfig) streamingRequest_, + getParentForChildren(), + isClean()); + streamingRequest_ = null; + } + streamingRequestCase_ = 6; + onChanged(); + ; + return streamingConfigBuilder_; + } + + /** + * + * + *
+     * Inline audio bytes to be Recognized.
+     * 
+ * + * bytes audio = 5; + * + * @return Whether the audio field is set. + */ + public boolean hasAudio() { + return streamingRequestCase_ == 5; + } + /** + * + * + *
+     * Inline audio bytes to be Recognized.
+     * 
+ * + * bytes audio = 5; + * + * @return The audio. + */ + public com.google.protobuf.ByteString getAudio() { + if (streamingRequestCase_ == 5) { + return (com.google.protobuf.ByteString) streamingRequest_; + } + return com.google.protobuf.ByteString.EMPTY; + } + /** + * + * + *
+     * Inline audio bytes to be Recognized.
+     * 
+ * + * bytes audio = 5; + * + * @param value The audio to set. + * @return This builder for chaining. + */ + public Builder setAudio(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + streamingRequestCase_ = 5; + streamingRequest_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Inline audio bytes to be Recognized.
+     * 
+ * + * bytes audio = 5; + * + * @return This builder for chaining. + */ + public Builder clearAudio() { + if (streamingRequestCase_ == 5) { + streamingRequestCase_ = 0; + streamingRequest_ = null; + onChanged(); + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.StreamingRecognizeRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.StreamingRecognizeRequest) + private static final com.google.cloud.speech.v2.StreamingRecognizeRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.StreamingRecognizeRequest(); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingRecognizeRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new StreamingRecognizeRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequestOrBuilder.java new file mode 100644 index 000000000000..c3de2722e8fe --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeRequestOrBuilder.java @@ -0,0 +1,131 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface StreamingRecognizeRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.StreamingRecognizeRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Streaming recognition should start with an initial request having
+   * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+   * The initial request with configuration can be omitted if the Recognizer
+   * being used has a
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The recognizer. + */ + java.lang.String getRecognizer(); + /** + * + * + *
+   * Required. Streaming recognition should start with an initial request having
+   * a `recognizer`. Subsequent requests carry the audio data to be recognized.
+   * The initial request with configuration can be omitted if the Recognizer
+   * being used has a
+   * [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config].
+   * 
+ * + * + * string recognizer = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for recognizer. + */ + com.google.protobuf.ByteString getRecognizerBytes(); + + /** + * + * + *
+   * StreamingRecognitionConfig to be used in this recognition attempt.
+   * If provided, it will override the default RecognitionConfig stored in the
+   * Recognizer.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + * + * @return Whether the streamingConfig field is set. + */ + boolean hasStreamingConfig(); + /** + * + * + *
+   * StreamingRecognitionConfig to be used in this recognition attempt.
+   * If provided, it will override the default RecognitionConfig stored in the
+   * Recognizer.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + * + * @return The streamingConfig. + */ + com.google.cloud.speech.v2.StreamingRecognitionConfig getStreamingConfig(); + /** + * + * + *
+   * StreamingRecognitionConfig to be used in this recognition attempt.
+   * If provided, it will override the default RecognitionConfig stored in the
+   * Recognizer.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognitionConfig streaming_config = 6; + */ + com.google.cloud.speech.v2.StreamingRecognitionConfigOrBuilder getStreamingConfigOrBuilder(); + + /** + * + * + *
+   * Inline audio bytes to be Recognized.
+   * 
+ * + * bytes audio = 5; + * + * @return Whether the audio field is set. + */ + boolean hasAudio(); + /** + * + * + *
+   * Inline audio bytes to be Recognized.
+   * 
+ * + * bytes audio = 5; + * + * @return The audio. + */ + com.google.protobuf.ByteString getAudio(); + + public com.google.cloud.speech.v2.StreamingRecognizeRequest.StreamingRequestCase + getStreamingRequestCase(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponse.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponse.java new file mode 100644 index 000000000000..a68e4c65a903 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponse.java @@ -0,0 +1,2109 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * `StreamingRecognizeResponse` is the only message returned to the client by
+ * `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse`
+ * messages are streamed back to the client. If there is no recognizable
+ * audio then no messages are streamed back to the client.
+ * Here are some examples of `StreamingRecognizeResponse`s that might
+ * be returned while processing audio:
+ * 1. results { alternatives { transcript: "tube" } stability: 0.01 }
+ * 2. results { alternatives { transcript: "to be a" } stability: 0.01 }
+ * 3. results { alternatives { transcript: "to be" } stability: 0.9 }
+ *    results { alternatives { transcript: " or not to be" } stability: 0.01 }
+ * 4. results { alternatives { transcript: "to be or not to be"
+ *                             confidence: 0.92 }
+ *              alternatives { transcript: "to bee or not to bee" }
+ *              is_final: true }
+ * 5. results { alternatives { transcript: " that's" } stability: 0.01 }
+ * 6. results { alternatives { transcript: " that is" } stability: 0.9 }
+ *    results { alternatives { transcript: " the question" } stability: 0.01 }
+ * 7. results { alternatives { transcript: " that is the question"
+ *                             confidence: 0.98 }
+ *              alternatives { transcript: " that was the question" }
+ *              is_final: true }
+ * Notes:
+ * - Only two of the above responses #4 and #7 contain final results; they are
+ *   indicated by `is_final: true`. Concatenating these together generates the
+ *   full transcript: "to be or not to be that is the question".
+ * - The others contain interim `results`. #3 and #6 contain two interim
+ *   `results`: the first portion has a high stability and is less likely to
+ *   change; the second portion has a low stability and is very likely to
+ *   change. A UI designer might choose to show only high stability `results`.
+ * - The specific `stability` and `confidence` values shown above are only for
+ *   illustrative purposes. Actual values may vary.
+ * - In each response, only one of these fields will be set:
+ *     `error`,
+ *     `speech_event_type`, or
+ *     one or more (repeated) `results`.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognizeResponse} + */ +public final class StreamingRecognizeResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.StreamingRecognizeResponse) + StreamingRecognizeResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingRecognizeResponse.newBuilder() to construct. + private StreamingRecognizeResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingRecognizeResponse() { + results_ = java.util.Collections.emptyList(); + speechEventType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingRecognizeResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private StreamingRecognizeResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 24: + { + int rawValue = input.readEnum(); + + speechEventType_ = rawValue; + break; + } + case 42: + { + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder subBuilder = null; + if (metadata_ != null) { + subBuilder = metadata_.toBuilder(); + } + metadata_ = + input.readMessage( + com.google.cloud.speech.v2.RecognitionResponseMetadata.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(metadata_); + metadata_ = subBuilder.buildPartial(); + } + + break; + } + case 50: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList< + com.google.cloud.speech.v2.StreamingRecognitionResult>(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.speech.v2.StreamingRecognitionResult.parser(), + extensionRegistry)); + break; + } + case 58: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (speechEventOffset_ != null) { + subBuilder = speechEventOffset_.toBuilder(); + } + speechEventOffset_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(speechEventOffset_); + speechEventOffset_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognizeResponse.class, + com.google.cloud.speech.v2.StreamingRecognizeResponse.Builder.class); + } + + /** + * + * + *
+   * Indicates the type of speech event.
+   * 
+ * + * Protobuf enum {@code google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType} + */ + public enum SpeechEventType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * No speech event specified.
+     * 
+ * + * SPEECH_EVENT_TYPE_UNSPECIFIED = 0; + */ + SPEECH_EVENT_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * This event indicates that the server has detected the end of the user's
+     * speech utterance and expects no additional speech. Therefore, the server
+     * will not process additional audio and will close the gRPC bidirectional
+     * stream. This event is only sent if there was a force cutoff due to
+     * silence being detected early. This event is only available through the
+     * `latest_short` [model][google.cloud.speech.v2.Recognizer.model].
+     * 
+ * + * END_OF_SINGLE_UTTERANCE = 1; + */ + END_OF_SINGLE_UTTERANCE(1), + /** + * + * + *
+     * This event indicates that the server has detected the beginning of human
+     * voice activity in the stream. This event can be returned multiple times
+     * if speech starts and stops repeatedly throughout the stream. This event
+     * is only sent if `voice_activity_events` is set to true.
+     * 
+ * + * SPEECH_ACTIVITY_BEGIN = 2; + */ + SPEECH_ACTIVITY_BEGIN(2), + /** + * + * + *
+     * This event indicates that the server has detected the end of human voice
+     * activity in the stream. This event can be returned multiple times if
+     * speech starts and stops repeatedly throughout the stream. This event is
+     * only sent if `voice_activity_events` is set to true.
+     * 
+ * + * SPEECH_ACTIVITY_END = 3; + */ + SPEECH_ACTIVITY_END(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * No speech event specified.
+     * 
+ * + * SPEECH_EVENT_TYPE_UNSPECIFIED = 0; + */ + public static final int SPEECH_EVENT_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * This event indicates that the server has detected the end of the user's
+     * speech utterance and expects no additional speech. Therefore, the server
+     * will not process additional audio and will close the gRPC bidirectional
+     * stream. This event is only sent if there was a force cutoff due to
+     * silence being detected early. This event is only available through the
+     * `latest_short` [model][google.cloud.speech.v2.Recognizer.model].
+     * 
+ * + * END_OF_SINGLE_UTTERANCE = 1; + */ + public static final int END_OF_SINGLE_UTTERANCE_VALUE = 1; + /** + * + * + *
+     * This event indicates that the server has detected the beginning of human
+     * voice activity in the stream. This event can be returned multiple times
+     * if speech starts and stops repeatedly throughout the stream. This event
+     * is only sent if `voice_activity_events` is set to true.
+     * 
+ * + * SPEECH_ACTIVITY_BEGIN = 2; + */ + public static final int SPEECH_ACTIVITY_BEGIN_VALUE = 2; + /** + * + * + *
+     * This event indicates that the server has detected the end of human voice
+     * activity in the stream. This event can be returned multiple times if
+     * speech starts and stops repeatedly throughout the stream. This event is
+     * only sent if `voice_activity_events` is set to true.
+     * 
+ * + * SPEECH_ACTIVITY_END = 3; + */ + public static final int SPEECH_ACTIVITY_END_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SpeechEventType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static SpeechEventType forNumber(int value) { + switch (value) { + case 0: + return SPEECH_EVENT_TYPE_UNSPECIFIED; + case 1: + return END_OF_SINGLE_UTTERANCE; + case 2: + return SPEECH_ACTIVITY_BEGIN; + case 3: + return SPEECH_ACTIVITY_END; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SpeechEventType findValueByNumber(int number) { + return SpeechEventType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.speech.v2.StreamingRecognizeResponse.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final SpeechEventType[] VALUES = values(); + + public static SpeechEventType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private SpeechEventType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType) + } + + public static final int RESULTS_FIELD_NUMBER = 6; + private java.util.List results_; + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + @java.lang.Override + public java.util.List getResultsList() { + return results_; + } + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + @java.lang.Override + public java.util.List + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + @java.lang.Override + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionResult getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognitionResultOrBuilder getResultsOrBuilder( + int index) { + return results_.get(index); + } + + public static final int SPEECH_EVENT_TYPE_FIELD_NUMBER = 3; + private int speechEventType_; + /** + * + * + *
+   * Indicates the type of speech event.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @return The enum numeric value on the wire for speechEventType. + */ + @java.lang.Override + public int getSpeechEventTypeValue() { + return speechEventType_; + } + /** + * + * + *
+   * Indicates the type of speech event.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @return The speechEventType. + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType + getSpeechEventType() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType result = + com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType.valueOf( + speechEventType_); + return result == null + ? com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType.UNRECOGNIZED + : result; + } + + public static final int SPEECH_EVENT_OFFSET_FIELD_NUMBER = 7; + private com.google.protobuf.Duration speechEventOffset_; + /** + * + * + *
+   * Time offset between the beginning of the audio and event emission.
+   * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + * + * @return Whether the speechEventOffset field is set. + */ + @java.lang.Override + public boolean hasSpeechEventOffset() { + return speechEventOffset_ != null; + } + /** + * + * + *
+   * Time offset between the beginning of the audio and event emission.
+   * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + * + * @return The speechEventOffset. + */ + @java.lang.Override + public com.google.protobuf.Duration getSpeechEventOffset() { + return speechEventOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechEventOffset_; + } + /** + * + * + *
+   * Time offset between the beginning of the audio and event emission.
+   * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getSpeechEventOffsetOrBuilder() { + return getSpeechEventOffset(); + } + + public static final int METADATA_FIELD_NUMBER = 5; + private com.google.cloud.speech.v2.RecognitionResponseMetadata metadata_; + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + * + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return metadata_ != null; + } + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + * + * @return The metadata. + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadata getMetadata() { + return metadata_ == null + ? com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance() + : metadata_; + } + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder getMetadataOrBuilder() { + return getMetadata(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (speechEventType_ + != com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType + .SPEECH_EVENT_TYPE_UNSPECIFIED + .getNumber()) { + output.writeEnum(3, speechEventType_); + } + if (metadata_ != null) { + output.writeMessage(5, getMetadata()); + } + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(6, results_.get(i)); + } + if (speechEventOffset_ != null) { + output.writeMessage(7, getSpeechEventOffset()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (speechEventType_ + != com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType + .SPEECH_EVENT_TYPE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, speechEventType_); + } + if (metadata_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getMetadata()); + } + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, results_.get(i)); + } + if (speechEventOffset_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getSpeechEventOffset()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.StreamingRecognizeResponse)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.StreamingRecognizeResponse other = + (com.google.cloud.speech.v2.StreamingRecognizeResponse) obj; + + if (!getResultsList().equals(other.getResultsList())) return false; + if (speechEventType_ != other.speechEventType_) return false; + if (hasSpeechEventOffset() != other.hasSpeechEventOffset()) return false; + if (hasSpeechEventOffset()) { + if (!getSpeechEventOffset().equals(other.getSpeechEventOffset())) return false; + } + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata().equals(other.getMetadata())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + hash = (37 * hash) + SPEECH_EVENT_TYPE_FIELD_NUMBER; + hash = (53 * hash) + speechEventType_; + if (hasSpeechEventOffset()) { + hash = (37 * hash) + SPEECH_EVENT_OFFSET_FIELD_NUMBER; + hash = (53 * hash) + getSpeechEventOffset().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.StreamingRecognizeResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * `StreamingRecognizeResponse` is the only message returned to the client by
+   * `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse`
+   * messages are streamed back to the client. If there is no recognizable
+   * audio then no messages are streamed back to the client.
+   * Here are some examples of `StreamingRecognizeResponse`s that might
+   * be returned while processing audio:
+   * 1. results { alternatives { transcript: "tube" } stability: 0.01 }
+   * 2. results { alternatives { transcript: "to be a" } stability: 0.01 }
+   * 3. results { alternatives { transcript: "to be" } stability: 0.9 }
+   *    results { alternatives { transcript: " or not to be" } stability: 0.01 }
+   * 4. results { alternatives { transcript: "to be or not to be"
+   *                             confidence: 0.92 }
+   *              alternatives { transcript: "to bee or not to bee" }
+   *              is_final: true }
+   * 5. results { alternatives { transcript: " that's" } stability: 0.01 }
+   * 6. results { alternatives { transcript: " that is" } stability: 0.9 }
+   *    results { alternatives { transcript: " the question" } stability: 0.01 }
+   * 7. results { alternatives { transcript: " that is the question"
+   *                             confidence: 0.98 }
+   *              alternatives { transcript: " that was the question" }
+   *              is_final: true }
+   * Notes:
+   * - Only two of the above responses #4 and #7 contain final results; they are
+   *   indicated by `is_final: true`. Concatenating these together generates the
+   *   full transcript: "to be or not to be that is the question".
+   * - The others contain interim `results`. #3 and #6 contain two interim
+   *   `results`: the first portion has a high stability and is less likely to
+   *   change; the second portion has a low stability and is very likely to
+   *   change. A UI designer might choose to show only high stability `results`.
+   * - The specific `stability` and `confidence` values shown above are only for
+   *   illustrative purposes. Actual values may vary.
+   * - In each response, only one of these fields will be set:
+   *     `error`,
+   *     `speech_event_type`, or
+   *     one or more (repeated) `results`.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.StreamingRecognizeResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.StreamingRecognizeResponse) + com.google.cloud.speech.v2.StreamingRecognizeResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.StreamingRecognizeResponse.class, + com.google.cloud.speech.v2.StreamingRecognizeResponse.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.StreamingRecognizeResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultsBuilder_.clear(); + } + speechEventType_ = 0; + + if (speechEventOffsetBuilder_ == null) { + speechEventOffset_ = null; + } else { + speechEventOffset_ = null; + speechEventOffsetBuilder_ = null; + } + if (metadataBuilder_ == null) { + metadata_ = null; + } else { + metadata_ = null; + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_StreamingRecognizeResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeResponse getDefaultInstanceForType() { + return com.google.cloud.speech.v2.StreamingRecognizeResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeResponse build() { + com.google.cloud.speech.v2.StreamingRecognizeResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeResponse buildPartial() { + com.google.cloud.speech.v2.StreamingRecognizeResponse result = + new com.google.cloud.speech.v2.StreamingRecognizeResponse(this); + int from_bitField0_ = bitField0_; + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + result.speechEventType_ = speechEventType_; + if (speechEventOffsetBuilder_ == null) { + result.speechEventOffset_ = speechEventOffset_; + } else { + result.speechEventOffset_ = speechEventOffsetBuilder_.build(); + } + if (metadataBuilder_ == null) { + result.metadata_ = metadata_; + } else { + result.metadata_ = metadataBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.StreamingRecognizeResponse) { + return mergeFrom((com.google.cloud.speech.v2.StreamingRecognizeResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.StreamingRecognizeResponse other) { + if (other == com.google.cloud.speech.v2.StreamingRecognizeResponse.getDefaultInstance()) + return this; + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (other.speechEventType_ != 0) { + setSpeechEventTypeValue(other.getSpeechEventTypeValue()); + } + if (other.hasSpeechEventOffset()) { + mergeSpeechEventOffset(other.getSpeechEventOffset()); + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.StreamingRecognizeResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.StreamingRecognizeResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList( + results_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionResult, + com.google.cloud.speech.v2.StreamingRecognitionResult.Builder, + com.google.cloud.speech.v2.StreamingRecognitionResultOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public java.util.List getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public com.google.cloud.speech.v2.StreamingRecognitionResult getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder setResults( + int index, com.google.cloud.speech.v2.StreamingRecognitionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder setResults( + int index, com.google.cloud.speech.v2.StreamingRecognitionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder addResults(com.google.cloud.speech.v2.StreamingRecognitionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder addResults( + int index, com.google.cloud.speech.v2.StreamingRecognitionResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder addResults( + com.google.cloud.speech.v2.StreamingRecognitionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder addResults( + int index, com.google.cloud.speech.v2.StreamingRecognitionResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder addAllResults( + java.lang.Iterable + values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public com.google.cloud.speech.v2.StreamingRecognitionResult.Builder getResultsBuilder( + int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public com.google.cloud.speech.v2.StreamingRecognitionResultOrBuilder getResultsOrBuilder( + int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public java.util.List + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public com.google.cloud.speech.v2.StreamingRecognitionResult.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder(com.google.cloud.speech.v2.StreamingRecognitionResult.getDefaultInstance()); + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public com.google.cloud.speech.v2.StreamingRecognitionResult.Builder addResultsBuilder( + int index) { + return getResultsFieldBuilder() + .addBuilder( + index, com.google.cloud.speech.v2.StreamingRecognitionResult.getDefaultInstance()); + } + /** + * + * + *
+     * This repeated list contains zero or more results that
+     * correspond to consecutive portions of the audio currently being processed.
+     * It contains zero or one
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+     * result (the newly settled portion), followed by zero or more
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+     * results (the interim results).
+     * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionResult, + com.google.cloud.speech.v2.StreamingRecognitionResult.Builder, + com.google.cloud.speech.v2.StreamingRecognitionResultOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.speech.v2.StreamingRecognitionResult, + com.google.cloud.speech.v2.StreamingRecognitionResult.Builder, + com.google.cloud.speech.v2.StreamingRecognitionResultOrBuilder>( + results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private int speechEventType_ = 0; + /** + * + * + *
+     * Indicates the type of speech event.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @return The enum numeric value on the wire for speechEventType. + */ + @java.lang.Override + public int getSpeechEventTypeValue() { + return speechEventType_; + } + /** + * + * + *
+     * Indicates the type of speech event.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @param value The enum numeric value on the wire for speechEventType to set. + * @return This builder for chaining. + */ + public Builder setSpeechEventTypeValue(int value) { + + speechEventType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates the type of speech event.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @return The speechEventType. + */ + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType + getSpeechEventType() { + @SuppressWarnings("deprecation") + com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType result = + com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType.valueOf( + speechEventType_); + return result == null + ? com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Indicates the type of speech event.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @param value The speechEventType to set. + * @return This builder for chaining. + */ + public Builder setSpeechEventType( + com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType value) { + if (value == null) { + throw new NullPointerException(); + } + + speechEventType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates the type of speech event.
+     * 
+ * + * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @return This builder for chaining. + */ + public Builder clearSpeechEventType() { + + speechEventType_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Duration speechEventOffset_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + speechEventOffsetBuilder_; + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + * + * @return Whether the speechEventOffset field is set. + */ + public boolean hasSpeechEventOffset() { + return speechEventOffsetBuilder_ != null || speechEventOffset_ != null; + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + * + * @return The speechEventOffset. + */ + public com.google.protobuf.Duration getSpeechEventOffset() { + if (speechEventOffsetBuilder_ == null) { + return speechEventOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechEventOffset_; + } else { + return speechEventOffsetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + public Builder setSpeechEventOffset(com.google.protobuf.Duration value) { + if (speechEventOffsetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + speechEventOffset_ = value; + onChanged(); + } else { + speechEventOffsetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + public Builder setSpeechEventOffset(com.google.protobuf.Duration.Builder builderForValue) { + if (speechEventOffsetBuilder_ == null) { + speechEventOffset_ = builderForValue.build(); + onChanged(); + } else { + speechEventOffsetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + public Builder mergeSpeechEventOffset(com.google.protobuf.Duration value) { + if (speechEventOffsetBuilder_ == null) { + if (speechEventOffset_ != null) { + speechEventOffset_ = + com.google.protobuf.Duration.newBuilder(speechEventOffset_) + .mergeFrom(value) + .buildPartial(); + } else { + speechEventOffset_ = value; + } + onChanged(); + } else { + speechEventOffsetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + public Builder clearSpeechEventOffset() { + if (speechEventOffsetBuilder_ == null) { + speechEventOffset_ = null; + onChanged(); + } else { + speechEventOffset_ = null; + speechEventOffsetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + public com.google.protobuf.Duration.Builder getSpeechEventOffsetBuilder() { + + onChanged(); + return getSpeechEventOffsetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + public com.google.protobuf.DurationOrBuilder getSpeechEventOffsetOrBuilder() { + if (speechEventOffsetBuilder_ != null) { + return speechEventOffsetBuilder_.getMessageOrBuilder(); + } else { + return speechEventOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : speechEventOffset_; + } + } + /** + * + * + *
+     * Time offset between the beginning of the audio and event emission.
+     * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getSpeechEventOffsetFieldBuilder() { + if (speechEventOffsetBuilder_ == null) { + speechEventOffsetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getSpeechEventOffset(), getParentForChildren(), isClean()); + speechEventOffset_ = null; + } + return speechEventOffsetBuilder_; + } + + private com.google.cloud.speech.v2.RecognitionResponseMetadata metadata_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionResponseMetadata, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder, + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder> + metadataBuilder_; + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + * + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return metadataBuilder_ != null || metadata_ != null; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + * + * @return The metadata. + */ + public com.google.cloud.speech.v2.RecognitionResponseMetadata getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null + ? com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance() + : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + public Builder setMetadata(com.google.cloud.speech.v2.RecognitionResponseMetadata value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + onChanged(); + } else { + metadataBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + public Builder setMetadata( + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + onChanged(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + public Builder mergeMetadata(com.google.cloud.speech.v2.RecognitionResponseMetadata value) { + if (metadataBuilder_ == null) { + if (metadata_ != null) { + metadata_ = + com.google.cloud.speech.v2.RecognitionResponseMetadata.newBuilder(metadata_) + .mergeFrom(value) + .buildPartial(); + } else { + metadata_ = value; + } + onChanged(); + } else { + metadataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + public Builder clearMetadata() { + if (metadataBuilder_ == null) { + metadata_ = null; + onChanged(); + } else { + metadata_ = null; + metadataBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + public com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder getMetadataBuilder() { + + onChanged(); + return getMetadataFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + public com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null + ? com.google.cloud.speech.v2.RecognitionResponseMetadata.getDefaultInstance() + : metadata_; + } + } + /** + * + * + *
+     * Metadata about the recognition.
+     * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionResponseMetadata, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder, + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder> + getMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.RecognitionResponseMetadata, + com.google.cloud.speech.v2.RecognitionResponseMetadata.Builder, + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder>( + getMetadata(), getParentForChildren(), isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.StreamingRecognizeResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.StreamingRecognizeResponse) + private static final com.google.cloud.speech.v2.StreamingRecognizeResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.StreamingRecognizeResponse(); + } + + public static com.google.cloud.speech.v2.StreamingRecognizeResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingRecognizeResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new StreamingRecognizeResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.StreamingRecognizeResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponseOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponseOrBuilder.java new file mode 100644 index 000000000000..5ebe124a6264 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/StreamingRecognizeResponseOrBuilder.java @@ -0,0 +1,204 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface StreamingRecognizeResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.StreamingRecognizeResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + com.google.cloud.speech.v2.StreamingRecognitionResult getResults(int index); + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + int getResultsCount(); + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * This repeated list contains zero or more results that
+   * correspond to consecutive portions of the audio currently being processed.
+   * It contains zero or one
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
+   * result (the newly settled portion), followed by zero or more
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
+   * results (the interim results).
+   * 
+ * + * repeated .google.cloud.speech.v2.StreamingRecognitionResult results = 6; + */ + com.google.cloud.speech.v2.StreamingRecognitionResultOrBuilder getResultsOrBuilder(int index); + + /** + * + * + *
+   * Indicates the type of speech event.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @return The enum numeric value on the wire for speechEventType. + */ + int getSpeechEventTypeValue(); + /** + * + * + *
+   * Indicates the type of speech event.
+   * 
+ * + * .google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType speech_event_type = 3; + * + * + * @return The speechEventType. + */ + com.google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType getSpeechEventType(); + + /** + * + * + *
+   * Time offset between the beginning of the audio and event emission.
+   * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + * + * @return Whether the speechEventOffset field is set. + */ + boolean hasSpeechEventOffset(); + /** + * + * + *
+   * Time offset between the beginning of the audio and event emission.
+   * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + * + * @return The speechEventOffset. + */ + com.google.protobuf.Duration getSpeechEventOffset(); + /** + * + * + *
+   * Time offset between the beginning of the audio and event emission.
+   * 
+ * + * .google.protobuf.Duration speech_event_offset = 7; + */ + com.google.protobuf.DurationOrBuilder getSpeechEventOffsetOrBuilder(); + + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + * + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + * + * @return The metadata. + */ + com.google.cloud.speech.v2.RecognitionResponseMetadata getMetadata(); + /** + * + * + *
+   * Metadata about the recognition.
+   * 
+ * + * .google.cloud.speech.v2.RecognitionResponseMetadata metadata = 5; + */ + com.google.cloud.speech.v2.RecognitionResponseMetadataOrBuilder getMetadataOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequest.java new file mode 100644 index 000000000000..b47b0671f0e5 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequest.java @@ -0,0 +1,958 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [UndeleteCustomClass][google.cloud.speech.v2.Speech.UndeleteCustomClass]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UndeleteCustomClassRequest} + */ +public final class UndeleteCustomClassRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.UndeleteCustomClassRequest) + UndeleteCustomClassRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UndeleteCustomClassRequest.newBuilder() to construct. + private UndeleteCustomClassRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UndeleteCustomClassRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UndeleteCustomClassRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UndeleteCustomClassRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 24: + { + validateOnly_ = input.readBool(); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UndeleteCustomClassRequest.class, + com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the CustomClass to undelete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the CustomClass to undelete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 3; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the undeleted CustomClass, but do
+   * not actually undelete it.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ETAG_FIELD_NUMBER = 4; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, etag_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.UndeleteCustomClassRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.UndeleteCustomClassRequest other = + (com.google.cloud.speech.v2.UndeleteCustomClassRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.speech.v2.UndeleteCustomClassRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [UndeleteCustomClass][google.cloud.speech.v2.Speech.UndeleteCustomClass]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UndeleteCustomClassRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.UndeleteCustomClassRequest) + com.google.cloud.speech.v2.UndeleteCustomClassRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UndeleteCustomClassRequest.class, + com.google.cloud.speech.v2.UndeleteCustomClassRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.UndeleteCustomClassRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteCustomClassRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequest build() { + com.google.cloud.speech.v2.UndeleteCustomClassRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequest buildPartial() { + com.google.cloud.speech.v2.UndeleteCustomClassRequest result = + new com.google.cloud.speech.v2.UndeleteCustomClassRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.UndeleteCustomClassRequest) { + return mergeFrom((com.google.cloud.speech.v2.UndeleteCustomClassRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.UndeleteCustomClassRequest other) { + if (other == com.google.cloud.speech.v2.UndeleteCustomClassRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.UndeleteCustomClassRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.UndeleteCustomClassRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the CustomClass to undelete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the CustomClass to undelete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the CustomClass to undelete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the CustomClass to undelete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the CustomClass to undelete.
+     * Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the undeleted CustomClass, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the undeleted CustomClass, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the undeleted CustomClass, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.UndeleteCustomClassRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.UndeleteCustomClassRequest) + private static final com.google.cloud.speech.v2.UndeleteCustomClassRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.UndeleteCustomClassRequest(); + } + + public static com.google.cloud.speech.v2.UndeleteCustomClassRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UndeleteCustomClassRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UndeleteCustomClassRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteCustomClassRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequestOrBuilder.java new file mode 100644 index 000000000000..3f2932465fef --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteCustomClassRequestOrBuilder.java @@ -0,0 +1,101 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface UndeleteCustomClassRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.UndeleteCustomClassRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the CustomClass to undelete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the CustomClass to undelete.
+   * Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * If set, validate the request and preview the undeleted CustomClass, but do
+   * not actually undelete it.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequest.java new file mode 100644 index 000000000000..2b2e8342159d --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequest.java @@ -0,0 +1,950 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [UndeletePhraseSet][google.cloud.speech.v2.Speech.UndeletePhraseSet]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UndeletePhraseSetRequest} + */ +public final class UndeletePhraseSetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.UndeletePhraseSetRequest) + UndeletePhraseSetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UndeletePhraseSetRequest.newBuilder() to construct. + private UndeletePhraseSetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UndeletePhraseSetRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UndeletePhraseSetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UndeletePhraseSetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 24: + { + validateOnly_ = input.readBool(); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeletePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeletePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UndeletePhraseSetRequest.class, + com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the PhraseSet to undelete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the PhraseSet to undelete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 3; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the undeleted PhraseSet, but do
+   * not actually undelete it.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ETAG_FIELD_NUMBER = 4; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, etag_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.UndeletePhraseSetRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.UndeletePhraseSetRequest other = + (com.google.cloud.speech.v2.UndeletePhraseSetRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.UndeletePhraseSetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [UndeletePhraseSet][google.cloud.speech.v2.Speech.UndeletePhraseSet]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UndeletePhraseSetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.UndeletePhraseSetRequest) + com.google.cloud.speech.v2.UndeletePhraseSetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeletePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeletePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UndeletePhraseSetRequest.class, + com.google.cloud.speech.v2.UndeletePhraseSetRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.UndeletePhraseSetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeletePhraseSetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequest build() { + com.google.cloud.speech.v2.UndeletePhraseSetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequest buildPartial() { + com.google.cloud.speech.v2.UndeletePhraseSetRequest result = + new com.google.cloud.speech.v2.UndeletePhraseSetRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.UndeletePhraseSetRequest) { + return mergeFrom((com.google.cloud.speech.v2.UndeletePhraseSetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.UndeletePhraseSetRequest other) { + if (other == com.google.cloud.speech.v2.UndeletePhraseSetRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.UndeletePhraseSetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.UndeletePhraseSetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the PhraseSet to undelete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the PhraseSet to undelete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the PhraseSet to undelete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the PhraseSet to undelete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the PhraseSet to undelete.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the undeleted PhraseSet, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the undeleted PhraseSet, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the undeleted PhraseSet, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.UndeletePhraseSetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.UndeletePhraseSetRequest) + private static final com.google.cloud.speech.v2.UndeletePhraseSetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.UndeletePhraseSetRequest(); + } + + public static com.google.cloud.speech.v2.UndeletePhraseSetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UndeletePhraseSetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UndeletePhraseSetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeletePhraseSetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequestOrBuilder.java new file mode 100644 index 000000000000..57ddba361792 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeletePhraseSetRequestOrBuilder.java @@ -0,0 +1,99 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface UndeletePhraseSetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.UndeletePhraseSetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the PhraseSet to undelete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the PhraseSet to undelete.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * If set, validate the request and preview the undeleted PhraseSet, but do
+   * not actually undelete it.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequest.java new file mode 100644 index 000000000000..665e2323c16d --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequest.java @@ -0,0 +1,950 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [UndeleteRecognizer][google.cloud.speech.v2.Speech.UndeleteRecognizer]
+ * method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UndeleteRecognizerRequest} + */ +public final class UndeleteRecognizerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.UndeleteRecognizerRequest) + UndeleteRecognizerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UndeleteRecognizerRequest.newBuilder() to construct. + private UndeleteRecognizerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UndeleteRecognizerRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UndeleteRecognizerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UndeleteRecognizerRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 24: + { + validateOnly_ = input.readBool(); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UndeleteRecognizerRequest.class, + com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the Recognizer to undelete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Recognizer to undelete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 3; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the undeleted Recognizer, but do
+   * not actually undelete it.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ETAG_FIELD_NUMBER = 4; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, etag_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.UndeleteRecognizerRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.UndeleteRecognizerRequest other = + (com.google.cloud.speech.v2.UndeleteRecognizerRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.UndeleteRecognizerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [UndeleteRecognizer][google.cloud.speech.v2.Speech.UndeleteRecognizer]
+   * method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UndeleteRecognizerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.UndeleteRecognizerRequest) + com.google.cloud.speech.v2.UndeleteRecognizerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UndeleteRecognizerRequest.class, + com.google.cloud.speech.v2.UndeleteRecognizerRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.UndeleteRecognizerRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UndeleteRecognizerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequest build() { + com.google.cloud.speech.v2.UndeleteRecognizerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequest buildPartial() { + com.google.cloud.speech.v2.UndeleteRecognizerRequest result = + new com.google.cloud.speech.v2.UndeleteRecognizerRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.UndeleteRecognizerRequest) { + return mergeFrom((com.google.cloud.speech.v2.UndeleteRecognizerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.UndeleteRecognizerRequest other) { + if (other == com.google.cloud.speech.v2.UndeleteRecognizerRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.UndeleteRecognizerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.UndeleteRecognizerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Recognizer to undelete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to undelete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Recognizer to undelete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to undelete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Recognizer to undelete.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the undeleted Recognizer, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the undeleted Recognizer, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the undeleted Recognizer, but do
+     * not actually undelete it.
+     * 
+ * + * bool validate_only = 3; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * This checksum is computed by the server based on the value of other
+     * fields. This may be sent on update, undelete, and delete requests to ensure
+     * the client has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 4; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.UndeleteRecognizerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.UndeleteRecognizerRequest) + private static final com.google.cloud.speech.v2.UndeleteRecognizerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.UndeleteRecognizerRequest(); + } + + public static com.google.cloud.speech.v2.UndeleteRecognizerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UndeleteRecognizerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UndeleteRecognizerRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UndeleteRecognizerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequestOrBuilder.java new file mode 100644 index 000000000000..a1a11469b1d1 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UndeleteRecognizerRequestOrBuilder.java @@ -0,0 +1,99 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface UndeleteRecognizerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.UndeleteRecognizerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Recognizer to undelete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Recognizer to undelete.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * If set, validate the request and preview the undeleted Recognizer, but do
+   * not actually undelete it.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * This checksum is computed by the server based on the value of other
+   * fields. This may be sent on update, undelete, and delete requests to ensure
+   * the client has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequest.java new file mode 100644 index 000000000000..0dc5d1422b25 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequest.java @@ -0,0 +1,1034 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [UpdateConfig][google.cloud.speech.v2.Speech.UpdateConfig] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdateConfigRequest} + */ +public final class UpdateConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.UpdateConfigRequest) + UpdateConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateConfigRequest.newBuilder() to construct. + private UpdateConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateConfigRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateConfigRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.Config.Builder subBuilder = null; + if (config_ != null) { + subBuilder = config_.toBuilder(); + } + config_ = + input.readMessage(com.google.cloud.speech.v2.Config.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(config_); + config_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdateConfigRequest.class, + com.google.cloud.speech.v2.UpdateConfigRequest.Builder.class); + } + + public static final int CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.Config config_; + /** + * + * + *
+   * Required. The config to update.
+   * The config's `name` field is used to identify the config to be updated.
+   * The expected format is `projects/{project}/locations/{location}/config`.
+   * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return config_ != null; + } + /** + * + * + *
+   * Required. The config to update.
+   * The config's `name` field is used to identify the config to be updated.
+   * The expected format is `projects/{project}/locations/{location}/config`.
+   * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + @java.lang.Override + public com.google.cloud.speech.v2.Config getConfig() { + return config_ == null ? com.google.cloud.speech.v2.Config.getDefaultInstance() : config_; + } + /** + * + * + *
+   * Required. The config to update.
+   * The config's `name` field is used to identify the config to be updated.
+   * The expected format is `projects/{project}/locations/{location}/config`.
+   * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.ConfigOrBuilder getConfigOrBuilder() { + return getConfig(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The list of fields to be updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The list of fields to be updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The list of fields to be updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (config_ != null) { + output.writeMessage(1, getConfig()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (config_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getConfig()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.UpdateConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.UpdateConfigRequest other = + (com.google.cloud.speech.v2.UpdateConfigRequest) obj; + + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig().equals(other.getConfig())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.UpdateConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [UpdateConfig][google.cloud.speech.v2.Speech.UpdateConfig] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdateConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.UpdateConfigRequest) + com.google.cloud.speech.v2.UpdateConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdateConfigRequest.class, + com.google.cloud.speech.v2.UpdateConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.UpdateConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (configBuilder_ == null) { + config_ = null; + } else { + config_ = null; + configBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequest build() { + com.google.cloud.speech.v2.UpdateConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequest buildPartial() { + com.google.cloud.speech.v2.UpdateConfigRequest result = + new com.google.cloud.speech.v2.UpdateConfigRequest(this); + if (configBuilder_ == null) { + result.config_ = config_; + } else { + result.config_ = configBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.UpdateConfigRequest) { + return mergeFrom((com.google.cloud.speech.v2.UpdateConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.UpdateConfigRequest other) { + if (other == com.google.cloud.speech.v2.UpdateConfigRequest.getDefaultInstance()) return this; + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.UpdateConfigRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.UpdateConfigRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.Config config_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Config, + com.google.cloud.speech.v2.Config.Builder, + com.google.cloud.speech.v2.ConfigOrBuilder> + configBuilder_; + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return configBuilder_ != null || config_ != null; + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + public com.google.cloud.speech.v2.Config getConfig() { + if (configBuilder_ == null) { + return config_ == null ? com.google.cloud.speech.v2.Config.getDefaultInstance() : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConfig(com.google.cloud.speech.v2.Config value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + onChanged(); + } else { + configBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConfig(com.google.cloud.speech.v2.Config.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + onChanged(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeConfig(com.google.cloud.speech.v2.Config value) { + if (configBuilder_ == null) { + if (config_ != null) { + config_ = + com.google.cloud.speech.v2.Config.newBuilder(config_).mergeFrom(value).buildPartial(); + } else { + config_ = value; + } + onChanged(); + } else { + configBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearConfig() { + if (configBuilder_ == null) { + config_ = null; + onChanged(); + } else { + config_ = null; + configBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.Config.Builder getConfigBuilder() { + + onChanged(); + return getConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.ConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null ? com.google.cloud.speech.v2.Config.getDefaultInstance() : config_; + } + } + /** + * + * + *
+     * Required. The config to update.
+     * The config's `name` field is used to identify the config to be updated.
+     * The expected format is `projects/{project}/locations/{location}/config`.
+     * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Config, + com.google.cloud.speech.v2.Config.Builder, + com.google.cloud.speech.v2.ConfigOrBuilder> + getConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Config, + com.google.cloud.speech.v2.Config.Builder, + com.google.cloud.speech.v2.ConfigOrBuilder>( + getConfig(), getParentForChildren(), isClean()); + config_ = null; + } + return configBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The list of fields to be updated.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.UpdateConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.UpdateConfigRequest) + private static final com.google.cloud.speech.v2.UpdateConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.UpdateConfigRequest(); + } + + public static com.google.cloud.speech.v2.UpdateConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateConfigRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequestOrBuilder.java new file mode 100644 index 000000000000..934ae4f143d3 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateConfigRequestOrBuilder.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface UpdateConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.UpdateConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The config to update.
+   * The config's `name` field is used to identify the config to be updated.
+   * The expected format is `projects/{project}/locations/{location}/config`.
+   * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * + * + *
+   * Required. The config to update.
+   * The config's `name` field is used to identify the config to be updated.
+   * The expected format is `projects/{project}/locations/{location}/config`.
+   * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + com.google.cloud.speech.v2.Config getConfig(); + /** + * + * + *
+   * Required. The config to update.
+   * The config's `name` field is used to identify the config to be updated.
+   * The expected format is `projects/{project}/locations/{location}/config`.
+   * 
+ * + * .google.cloud.speech.v2.Config config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.ConfigOrBuilder getConfigOrBuilder(); + + /** + * + * + *
+   * The list of fields to be updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The list of fields to be updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The list of fields to be updated.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequest.java new file mode 100644 index 000000000000..33b76cf9255c --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequest.java @@ -0,0 +1,1175 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [UpdateCustomClass][google.cloud.speech.v2.Speech.UpdateCustomClass] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdateCustomClassRequest} + */ +public final class UpdateCustomClassRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.UpdateCustomClassRequest) + UpdateCustomClassRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateCustomClassRequest.newBuilder() to construct. + private UpdateCustomClassRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateCustomClassRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateCustomClassRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateCustomClassRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.CustomClass.Builder subBuilder = null; + if (customClass_ != null) { + subBuilder = customClass_.toBuilder(); + } + customClass_ = + input.readMessage( + com.google.cloud.speech.v2.CustomClass.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(customClass_); + customClass_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + case 32: + { + validateOnly_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdateCustomClassRequest.class, + com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder.class); + } + + public static final int CUSTOM_CLASS_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.CustomClass customClass_; + /** + * + * + *
+   * Required. The CustomClass to update.
+   * The CustomClass's `name` field is used to identify the CustomClass to
+   * update. Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the customClass field is set. + */ + @java.lang.Override + public boolean hasCustomClass() { + return customClass_ != null; + } + /** + * + * + *
+   * Required. The CustomClass to update.
+   * The CustomClass's `name` field is used to identify the CustomClass to
+   * update. Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The customClass. + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClass getCustomClass() { + return customClass_ == null + ? com.google.cloud.speech.v2.CustomClass.getDefaultInstance() + : customClass_; + } + /** + * + * + *
+   * Required. The CustomClass to update.
+   * The CustomClass's `name` field is used to identify the CustomClass to
+   * update. Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassOrBuilder() { + return getCustomClass(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The list of fields to be updated. If empty, all fields are considered for
+   * update.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The list of fields to be updated. If empty, all fields are considered for
+   * update.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The list of fields to be updated. If empty, all fields are considered for
+   * update.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the updated CustomClass, but do
+   * not actually update it.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (customClass_ != null) { + output.writeMessage(1, getCustomClass()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (customClass_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCustomClass()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.UpdateCustomClassRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.UpdateCustomClassRequest other = + (com.google.cloud.speech.v2.UpdateCustomClassRequest) obj; + + if (hasCustomClass() != other.hasCustomClass()) return false; + if (hasCustomClass()) { + if (!getCustomClass().equals(other.getCustomClass())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCustomClass()) { + hash = (37 * hash) + CUSTOM_CLASS_FIELD_NUMBER; + hash = (53 * hash) + getCustomClass().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.UpdateCustomClassRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [UpdateCustomClass][google.cloud.speech.v2.Speech.UpdateCustomClass] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdateCustomClassRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.UpdateCustomClassRequest) + com.google.cloud.speech.v2.UpdateCustomClassRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateCustomClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateCustomClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdateCustomClassRequest.class, + com.google.cloud.speech.v2.UpdateCustomClassRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.UpdateCustomClassRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (customClassBuilder_ == null) { + customClass_ = null; + } else { + customClass_ = null; + customClassBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateCustomClassRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequest build() { + com.google.cloud.speech.v2.UpdateCustomClassRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequest buildPartial() { + com.google.cloud.speech.v2.UpdateCustomClassRequest result = + new com.google.cloud.speech.v2.UpdateCustomClassRequest(this); + if (customClassBuilder_ == null) { + result.customClass_ = customClass_; + } else { + result.customClass_ = customClassBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + result.validateOnly_ = validateOnly_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.UpdateCustomClassRequest) { + return mergeFrom((com.google.cloud.speech.v2.UpdateCustomClassRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.UpdateCustomClassRequest other) { + if (other == com.google.cloud.speech.v2.UpdateCustomClassRequest.getDefaultInstance()) + return this; + if (other.hasCustomClass()) { + mergeCustomClass(other.getCustomClass()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.UpdateCustomClassRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.UpdateCustomClassRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.CustomClass customClass_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + customClassBuilder_; + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the customClass field is set. + */ + public boolean hasCustomClass() { + return customClassBuilder_ != null || customClass_ != null; + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The customClass. + */ + public com.google.cloud.speech.v2.CustomClass getCustomClass() { + if (customClassBuilder_ == null) { + return customClass_ == null + ? com.google.cloud.speech.v2.CustomClass.getDefaultInstance() + : customClass_; + } else { + return customClassBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCustomClass(com.google.cloud.speech.v2.CustomClass value) { + if (customClassBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + customClass_ = value; + onChanged(); + } else { + customClassBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setCustomClass(com.google.cloud.speech.v2.CustomClass.Builder builderForValue) { + if (customClassBuilder_ == null) { + customClass_ = builderForValue.build(); + onChanged(); + } else { + customClassBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeCustomClass(com.google.cloud.speech.v2.CustomClass value) { + if (customClassBuilder_ == null) { + if (customClass_ != null) { + customClass_ = + com.google.cloud.speech.v2.CustomClass.newBuilder(customClass_) + .mergeFrom(value) + .buildPartial(); + } else { + customClass_ = value; + } + onChanged(); + } else { + customClassBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearCustomClass() { + if (customClassBuilder_ == null) { + customClass_ = null; + onChanged(); + } else { + customClass_ = null; + customClassBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.CustomClass.Builder getCustomClassBuilder() { + + onChanged(); + return getCustomClassFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassOrBuilder() { + if (customClassBuilder_ != null) { + return customClassBuilder_.getMessageOrBuilder(); + } else { + return customClass_ == null + ? com.google.cloud.speech.v2.CustomClass.getDefaultInstance() + : customClass_; + } + } + /** + * + * + *
+     * Required. The CustomClass to update.
+     * The CustomClass's `name` field is used to identify the CustomClass to
+     * update. Format:
+     * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+     * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder> + getCustomClassFieldBuilder() { + if (customClassBuilder_ == null) { + customClassBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.CustomClass, + com.google.cloud.speech.v2.CustomClass.Builder, + com.google.cloud.speech.v2.CustomClassOrBuilder>( + getCustomClass(), getParentForChildren(), isClean()); + customClass_ = null; + } + return customClassBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The list of fields to be updated. If empty, all fields are considered for
+     * update.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the updated CustomClass, but do
+     * not actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the updated CustomClass, but do
+     * not actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the updated CustomClass, but do
+     * not actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.UpdateCustomClassRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.UpdateCustomClassRequest) + private static final com.google.cloud.speech.v2.UpdateCustomClassRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.UpdateCustomClassRequest(); + } + + public static com.google.cloud.speech.v2.UpdateCustomClassRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateCustomClassRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateCustomClassRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateCustomClassRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequestOrBuilder.java new file mode 100644 index 000000000000..fcd686776acc --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateCustomClassRequestOrBuilder.java @@ -0,0 +1,127 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface UpdateCustomClassRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.UpdateCustomClassRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The CustomClass to update.
+   * The CustomClass's `name` field is used to identify the CustomClass to
+   * update. Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the customClass field is set. + */ + boolean hasCustomClass(); + /** + * + * + *
+   * Required. The CustomClass to update.
+   * The CustomClass's `name` field is used to identify the CustomClass to
+   * update. Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The customClass. + */ + com.google.cloud.speech.v2.CustomClass getCustomClass(); + /** + * + * + *
+   * Required. The CustomClass to update.
+   * The CustomClass's `name` field is used to identify the CustomClass to
+   * update. Format:
+   * `projects/{project}/locations/{location}/customClasses/{custom_class}`.
+   * 
+ * + * + * .google.cloud.speech.v2.CustomClass custom_class = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.CustomClassOrBuilder getCustomClassOrBuilder(); + + /** + * + * + *
+   * The list of fields to be updated. If empty, all fields are considered for
+   * update.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The list of fields to be updated. If empty, all fields are considered for
+   * update.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The list of fields to be updated. If empty, all fields are considered for
+   * update.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); + + /** + * + * + *
+   * If set, validate the request and preview the updated CustomClass, but do
+   * not actually update it.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequest.java new file mode 100644 index 000000000000..00890bab8398 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequest.java @@ -0,0 +1,1163 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [UpdatePhraseSet][google.cloud.speech.v2.Speech.UpdatePhraseSet] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdatePhraseSetRequest} + */ +public final class UpdatePhraseSetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.UpdatePhraseSetRequest) + UpdatePhraseSetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdatePhraseSetRequest.newBuilder() to construct. + private UpdatePhraseSetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdatePhraseSetRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdatePhraseSetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdatePhraseSetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.PhraseSet.Builder subBuilder = null; + if (phraseSet_ != null) { + subBuilder = phraseSet_.toBuilder(); + } + phraseSet_ = + input.readMessage( + com.google.cloud.speech.v2.PhraseSet.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(phraseSet_); + phraseSet_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + case 32: + { + validateOnly_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdatePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdatePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdatePhraseSetRequest.class, + com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder.class); + } + + public static final int PHRASE_SET_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.PhraseSet phraseSet_; + /** + * + * + *
+   * Required. The PhraseSet to update.
+   * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the phraseSet field is set. + */ + @java.lang.Override + public boolean hasPhraseSet() { + return phraseSet_ != null; + } + /** + * + * + *
+   * Required. The PhraseSet to update.
+   * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The phraseSet. + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSet getPhraseSet() { + return phraseSet_ == null + ? com.google.cloud.speech.v2.PhraseSet.getDefaultInstance() + : phraseSet_; + } + /** + * + * + *
+   * Required. The PhraseSet to update.
+   * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetOrBuilder() { + return getPhraseSet(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire PhraseSet resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire PhraseSet resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire PhraseSet resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the updated PhraseSet, but do not
+   * actually update it.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (phraseSet_ != null) { + output.writeMessage(1, getPhraseSet()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (phraseSet_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getPhraseSet()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.UpdatePhraseSetRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.UpdatePhraseSetRequest other = + (com.google.cloud.speech.v2.UpdatePhraseSetRequest) obj; + + if (hasPhraseSet() != other.hasPhraseSet()) return false; + if (hasPhraseSet()) { + if (!getPhraseSet().equals(other.getPhraseSet())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasPhraseSet()) { + hash = (37 * hash) + PHRASE_SET_FIELD_NUMBER; + hash = (53 * hash) + getPhraseSet().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.UpdatePhraseSetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [UpdatePhraseSet][google.cloud.speech.v2.Speech.UpdatePhraseSet] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdatePhraseSetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.UpdatePhraseSetRequest) + com.google.cloud.speech.v2.UpdatePhraseSetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdatePhraseSetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdatePhraseSetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdatePhraseSetRequest.class, + com.google.cloud.speech.v2.UpdatePhraseSetRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.UpdatePhraseSetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (phraseSetBuilder_ == null) { + phraseSet_ = null; + } else { + phraseSet_ = null; + phraseSetBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdatePhraseSetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequest build() { + com.google.cloud.speech.v2.UpdatePhraseSetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequest buildPartial() { + com.google.cloud.speech.v2.UpdatePhraseSetRequest result = + new com.google.cloud.speech.v2.UpdatePhraseSetRequest(this); + if (phraseSetBuilder_ == null) { + result.phraseSet_ = phraseSet_; + } else { + result.phraseSet_ = phraseSetBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + result.validateOnly_ = validateOnly_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.UpdatePhraseSetRequest) { + return mergeFrom((com.google.cloud.speech.v2.UpdatePhraseSetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.UpdatePhraseSetRequest other) { + if (other == com.google.cloud.speech.v2.UpdatePhraseSetRequest.getDefaultInstance()) + return this; + if (other.hasPhraseSet()) { + mergePhraseSet(other.getPhraseSet()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.UpdatePhraseSetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.UpdatePhraseSetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.PhraseSet phraseSet_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + phraseSetBuilder_; + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the phraseSet field is set. + */ + public boolean hasPhraseSet() { + return phraseSetBuilder_ != null || phraseSet_ != null; + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The phraseSet. + */ + public com.google.cloud.speech.v2.PhraseSet getPhraseSet() { + if (phraseSetBuilder_ == null) { + return phraseSet_ == null + ? com.google.cloud.speech.v2.PhraseSet.getDefaultInstance() + : phraseSet_; + } else { + return phraseSetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setPhraseSet(com.google.cloud.speech.v2.PhraseSet value) { + if (phraseSetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + phraseSet_ = value; + onChanged(); + } else { + phraseSetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setPhraseSet(com.google.cloud.speech.v2.PhraseSet.Builder builderForValue) { + if (phraseSetBuilder_ == null) { + phraseSet_ = builderForValue.build(); + onChanged(); + } else { + phraseSetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergePhraseSet(com.google.cloud.speech.v2.PhraseSet value) { + if (phraseSetBuilder_ == null) { + if (phraseSet_ != null) { + phraseSet_ = + com.google.cloud.speech.v2.PhraseSet.newBuilder(phraseSet_) + .mergeFrom(value) + .buildPartial(); + } else { + phraseSet_ = value; + } + onChanged(); + } else { + phraseSetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearPhraseSet() { + if (phraseSetBuilder_ == null) { + phraseSet_ = null; + onChanged(); + } else { + phraseSet_ = null; + phraseSetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.PhraseSet.Builder getPhraseSetBuilder() { + + onChanged(); + return getPhraseSetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetOrBuilder() { + if (phraseSetBuilder_ != null) { + return phraseSetBuilder_.getMessageOrBuilder(); + } else { + return phraseSet_ == null + ? com.google.cloud.speech.v2.PhraseSet.getDefaultInstance() + : phraseSet_; + } + } + /** + * + * + *
+     * Required. The PhraseSet to update.
+     * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+     * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+     * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder> + getPhraseSetFieldBuilder() { + if (phraseSetBuilder_ == null) { + phraseSetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.PhraseSet, + com.google.cloud.speech.v2.PhraseSet.Builder, + com.google.cloud.speech.v2.PhraseSetOrBuilder>( + getPhraseSet(), getParentForChildren(), isClean()); + phraseSet_ = null; + } + return phraseSetBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire PhraseSet resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the updated PhraseSet, but do not
+     * actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the updated PhraseSet, but do not
+     * actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the updated PhraseSet, but do not
+     * actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.UpdatePhraseSetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.UpdatePhraseSetRequest) + private static final com.google.cloud.speech.v2.UpdatePhraseSetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.UpdatePhraseSetRequest(); + } + + public static com.google.cloud.speech.v2.UpdatePhraseSetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdatePhraseSetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdatePhraseSetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdatePhraseSetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequestOrBuilder.java new file mode 100644 index 000000000000..c45c34e09307 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdatePhraseSetRequestOrBuilder.java @@ -0,0 +1,124 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface UpdatePhraseSetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.UpdatePhraseSetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The PhraseSet to update.
+   * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the phraseSet field is set. + */ + boolean hasPhraseSet(); + /** + * + * + *
+   * Required. The PhraseSet to update.
+   * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The phraseSet. + */ + com.google.cloud.speech.v2.PhraseSet getPhraseSet(); + /** + * + * + *
+   * Required. The PhraseSet to update.
+   * The PhraseSet's `name` field is used to identify the PhraseSet to update.
+   * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
+   * 
+ * + * + * .google.cloud.speech.v2.PhraseSet phrase_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.PhraseSetOrBuilder getPhraseSetOrBuilder(); + + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire PhraseSet resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire PhraseSet resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire PhraseSet resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); + + /** + * + * + *
+   * If set, validate the request and preview the updated PhraseSet, but do not
+   * actually update it.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequest.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequest.java new file mode 100644 index 000000000000..46d2dcd0803e --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequest.java @@ -0,0 +1,1163 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Request message for the
+ * [UpdateRecognizer][google.cloud.speech.v2.Speech.UpdateRecognizer] method.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdateRecognizerRequest} + */ +public final class UpdateRecognizerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.UpdateRecognizerRequest) + UpdateRecognizerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateRecognizerRequest.newBuilder() to construct. + private UpdateRecognizerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateRecognizerRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateRecognizerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateRecognizerRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.speech.v2.Recognizer.Builder subBuilder = null; + if (recognizer_ != null) { + subBuilder = recognizer_.toBuilder(); + } + recognizer_ = + input.readMessage( + com.google.cloud.speech.v2.Recognizer.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(recognizer_); + recognizer_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + case 32: + { + validateOnly_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdateRecognizerRequest.class, + com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder.class); + } + + public static final int RECOGNIZER_FIELD_NUMBER = 1; + private com.google.cloud.speech.v2.Recognizer recognizer_; + /** + * + * + *
+   * Required. The Recognizer to update.
+   * The Recognizer's `name` field is used to identify the Recognizer to update.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the recognizer field is set. + */ + @java.lang.Override + public boolean hasRecognizer() { + return recognizer_ != null; + } + /** + * + * + *
+   * Required. The Recognizer to update.
+   * The Recognizer's `name` field is used to identify the Recognizer to update.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The recognizer. + */ + @java.lang.Override + public com.google.cloud.speech.v2.Recognizer getRecognizer() { + return recognizer_ == null + ? com.google.cloud.speech.v2.Recognizer.getDefaultInstance() + : recognizer_; + } + /** + * + * + *
+   * Required. The Recognizer to update.
+   * The Recognizer's `name` field is used to identify the Recognizer to update.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizerOrBuilder() { + return getRecognizer(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire Recognizer resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire Recognizer resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire Recognizer resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * If set, validate the request and preview the updated Recognizer, but do not
+   * actually update it.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (recognizer_ != null) { + output.writeMessage(1, getRecognizer()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (recognizer_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getRecognizer()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.UpdateRecognizerRequest)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.UpdateRecognizerRequest other = + (com.google.cloud.speech.v2.UpdateRecognizerRequest) obj; + + if (hasRecognizer() != other.hasRecognizer()) return false; + if (hasRecognizer()) { + if (!getRecognizer().equals(other.getRecognizer())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasRecognizer()) { + hash = (37 * hash) + RECOGNIZER_FIELD_NUMBER; + hash = (53 * hash) + getRecognizer().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.UpdateRecognizerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the
+   * [UpdateRecognizer][google.cloud.speech.v2.Speech.UpdateRecognizer] method.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.UpdateRecognizerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.UpdateRecognizerRequest) + com.google.cloud.speech.v2.UpdateRecognizerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateRecognizerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateRecognizerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.UpdateRecognizerRequest.class, + com.google.cloud.speech.v2.UpdateRecognizerRequest.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.UpdateRecognizerRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (recognizerBuilder_ == null) { + recognizer_ = null; + } else { + recognizer_ = null; + recognizerBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_UpdateRecognizerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequest getDefaultInstanceForType() { + return com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequest build() { + com.google.cloud.speech.v2.UpdateRecognizerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequest buildPartial() { + com.google.cloud.speech.v2.UpdateRecognizerRequest result = + new com.google.cloud.speech.v2.UpdateRecognizerRequest(this); + if (recognizerBuilder_ == null) { + result.recognizer_ = recognizer_; + } else { + result.recognizer_ = recognizerBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + result.validateOnly_ = validateOnly_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.UpdateRecognizerRequest) { + return mergeFrom((com.google.cloud.speech.v2.UpdateRecognizerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.UpdateRecognizerRequest other) { + if (other == com.google.cloud.speech.v2.UpdateRecognizerRequest.getDefaultInstance()) + return this; + if (other.hasRecognizer()) { + mergeRecognizer(other.getRecognizer()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.UpdateRecognizerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.speech.v2.UpdateRecognizerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.speech.v2.Recognizer recognizer_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder> + recognizerBuilder_; + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the recognizer field is set. + */ + public boolean hasRecognizer() { + return recognizerBuilder_ != null || recognizer_ != null; + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The recognizer. + */ + public com.google.cloud.speech.v2.Recognizer getRecognizer() { + if (recognizerBuilder_ == null) { + return recognizer_ == null + ? com.google.cloud.speech.v2.Recognizer.getDefaultInstance() + : recognizer_; + } else { + return recognizerBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setRecognizer(com.google.cloud.speech.v2.Recognizer value) { + if (recognizerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + recognizer_ = value; + onChanged(); + } else { + recognizerBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setRecognizer(com.google.cloud.speech.v2.Recognizer.Builder builderForValue) { + if (recognizerBuilder_ == null) { + recognizer_ = builderForValue.build(); + onChanged(); + } else { + recognizerBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeRecognizer(com.google.cloud.speech.v2.Recognizer value) { + if (recognizerBuilder_ == null) { + if (recognizer_ != null) { + recognizer_ = + com.google.cloud.speech.v2.Recognizer.newBuilder(recognizer_) + .mergeFrom(value) + .buildPartial(); + } else { + recognizer_ = value; + } + onChanged(); + } else { + recognizerBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearRecognizer() { + if (recognizerBuilder_ == null) { + recognizer_ = null; + onChanged(); + } else { + recognizer_ = null; + recognizerBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.Recognizer.Builder getRecognizerBuilder() { + + onChanged(); + return getRecognizerFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizerOrBuilder() { + if (recognizerBuilder_ != null) { + return recognizerBuilder_.getMessageOrBuilder(); + } else { + return recognizer_ == null + ? com.google.cloud.speech.v2.Recognizer.getDefaultInstance() + : recognizer_; + } + } + /** + * + * + *
+     * Required. The Recognizer to update.
+     * The Recognizer's `name` field is used to identify the Recognizer to update.
+     * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+     * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder> + getRecognizerFieldBuilder() { + if (recognizerBuilder_ == null) { + recognizerBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.speech.v2.Recognizer, + com.google.cloud.speech.v2.Recognizer.Builder, + com.google.cloud.speech.v2.RecognizerOrBuilder>( + getRecognizer(), getParentForChildren(), isClean()); + recognizer_ = null; + } + return recognizerBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The list of fields to update. If empty, all non-default valued fields are
+     * considered for update. Use `*` to update the entire Recognizer resource.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + private boolean validateOnly_; + /** + * + * + *
+     * If set, validate the request and preview the updated Recognizer, but do not
+     * actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * If set, validate the request and preview the updated Recognizer, but do not
+     * actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set, validate the request and preview the updated Recognizer, but do not
+     * actually update it.
+     * 
+ * + * bool validate_only = 4; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.UpdateRecognizerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.UpdateRecognizerRequest) + private static final com.google.cloud.speech.v2.UpdateRecognizerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.UpdateRecognizerRequest(); + } + + public static com.google.cloud.speech.v2.UpdateRecognizerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateRecognizerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateRecognizerRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.UpdateRecognizerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequestOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequestOrBuilder.java new file mode 100644 index 000000000000..b2625dfe5eeb --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/UpdateRecognizerRequestOrBuilder.java @@ -0,0 +1,124 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface UpdateRecognizerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.UpdateRecognizerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Recognizer to update.
+   * The Recognizer's `name` field is used to identify the Recognizer to update.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the recognizer field is set. + */ + boolean hasRecognizer(); + /** + * + * + *
+   * Required. The Recognizer to update.
+   * The Recognizer's `name` field is used to identify the Recognizer to update.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The recognizer. + */ + com.google.cloud.speech.v2.Recognizer getRecognizer(); + /** + * + * + *
+   * Required. The Recognizer to update.
+   * The Recognizer's `name` field is used to identify the Recognizer to update.
+   * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
+   * 
+ * + * + * .google.cloud.speech.v2.Recognizer recognizer = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.speech.v2.RecognizerOrBuilder getRecognizerOrBuilder(); + + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire Recognizer resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire Recognizer resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The list of fields to update. If empty, all non-default valued fields are
+   * considered for update. Use `*` to update the entire Recognizer resource.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); + + /** + * + * + *
+   * If set, validate the request and preview the updated Recognizer, but do not
+   * actually update it.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfo.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfo.java new file mode 100644 index 000000000000..d735af7ff477 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfo.java @@ -0,0 +1,1619 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +/** + * + * + *
+ * Word-specific information for recognized words.
+ * 
+ * + * Protobuf type {@code google.cloud.speech.v2.WordInfo} + */ +public final class WordInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.speech.v2.WordInfo) + WordInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use WordInfo.newBuilder() to construct. + private WordInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private WordInfo() { + word_ = ""; + speakerLabel_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new WordInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private WordInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (startOffset_ != null) { + subBuilder = startOffset_.toBuilder(); + } + startOffset_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(startOffset_); + startOffset_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (endOffset_ != null) { + subBuilder = endOffset_.toBuilder(); + } + endOffset_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(endOffset_); + endOffset_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + word_ = s; + break; + } + case 37: + { + confidence_ = input.readFloat(); + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + speakerLabel_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_WordInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_WordInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.WordInfo.class, + com.google.cloud.speech.v2.WordInfo.Builder.class); + } + + public static final int START_OFFSET_FIELD_NUMBER = 1; + private com.google.protobuf.Duration startOffset_; + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the start of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration start_offset = 1; + * + * @return Whether the startOffset field is set. + */ + @java.lang.Override + public boolean hasStartOffset() { + return startOffset_ != null; + } + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the start of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration start_offset = 1; + * + * @return The startOffset. + */ + @java.lang.Override + public com.google.protobuf.Duration getStartOffset() { + return startOffset_ == null ? com.google.protobuf.Duration.getDefaultInstance() : startOffset_; + } + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the start of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getStartOffsetOrBuilder() { + return getStartOffset(); + } + + public static final int END_OFFSET_FIELD_NUMBER = 2; + private com.google.protobuf.Duration endOffset_; + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the end of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration end_offset = 2; + * + * @return Whether the endOffset field is set. + */ + @java.lang.Override + public boolean hasEndOffset() { + return endOffset_ != null; + } + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the end of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration end_offset = 2; + * + * @return The endOffset. + */ + @java.lang.Override + public com.google.protobuf.Duration getEndOffset() { + return endOffset_ == null ? com.google.protobuf.Duration.getDefaultInstance() : endOffset_; + } + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the end of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getEndOffsetOrBuilder() { + return getEndOffset(); + } + + public static final int WORD_FIELD_NUMBER = 3; + private volatile java.lang.Object word_; + /** + * + * + *
+   * The word corresponding to this set of information.
+   * 
+ * + * string word = 3; + * + * @return The word. + */ + @java.lang.Override + public java.lang.String getWord() { + java.lang.Object ref = word_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + word_ = s; + return s; + } + } + /** + * + * + *
+   * The word corresponding to this set of information.
+   * 
+ * + * string word = 3; + * + * @return The bytes for word. + */ + @java.lang.Override + public com.google.protobuf.ByteString getWordBytes() { + java.lang.Object ref = word_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + word_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIDENCE_FIELD_NUMBER = 4; + private float confidence_; + /** + * + * + *
+   * The confidence estimate between 0.0 and 1.0. A higher number
+   * indicates an estimated greater likelihood that the recognized words are
+   * correct. This field is set only for the top alternative of a non-streaming
+   * result or, of a streaming result where
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+   * set to `true`. This field is not guaranteed to be accurate and users should
+   * not rely on it to be always provided. The default of 0.0 is a sentinel
+   * value indicating `confidence` was not set.
+   * 
+ * + * float confidence = 4; + * + * @return The confidence. + */ + @java.lang.Override + public float getConfidence() { + return confidence_; + } + + public static final int SPEAKER_LABEL_FIELD_NUMBER = 6; + private volatile java.lang.Object speakerLabel_; + /** + * + * + *
+   * A distinct label is assigned for every speaker within the audio. This field
+   * specifies which one of those speakers was detected to have spoken this
+   * word. `speaker_label` is set if
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is `true` and only in the top alternative.
+   * 
+ * + * string speaker_label = 6; + * + * @return The speakerLabel. + */ + @java.lang.Override + public java.lang.String getSpeakerLabel() { + java.lang.Object ref = speakerLabel_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + speakerLabel_ = s; + return s; + } + } + /** + * + * + *
+   * A distinct label is assigned for every speaker within the audio. This field
+   * specifies which one of those speakers was detected to have spoken this
+   * word. `speaker_label` is set if
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is `true` and only in the top alternative.
+   * 
+ * + * string speaker_label = 6; + * + * @return The bytes for speakerLabel. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSpeakerLabelBytes() { + java.lang.Object ref = speakerLabel_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + speakerLabel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (startOffset_ != null) { + output.writeMessage(1, getStartOffset()); + } + if (endOffset_ != null) { + output.writeMessage(2, getEndOffset()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(word_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, word_); + } + if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { + output.writeFloat(4, confidence_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(speakerLabel_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, speakerLabel_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (startOffset_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getStartOffset()); + } + if (endOffset_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getEndOffset()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(word_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, word_); + } + if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, confidence_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(speakerLabel_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, speakerLabel_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.speech.v2.WordInfo)) { + return super.equals(obj); + } + com.google.cloud.speech.v2.WordInfo other = (com.google.cloud.speech.v2.WordInfo) obj; + + if (hasStartOffset() != other.hasStartOffset()) return false; + if (hasStartOffset()) { + if (!getStartOffset().equals(other.getStartOffset())) return false; + } + if (hasEndOffset() != other.hasEndOffset()) return false; + if (hasEndOffset()) { + if (!getEndOffset().equals(other.getEndOffset())) return false; + } + if (!getWord().equals(other.getWord())) return false; + if (java.lang.Float.floatToIntBits(getConfidence()) + != java.lang.Float.floatToIntBits(other.getConfidence())) return false; + if (!getSpeakerLabel().equals(other.getSpeakerLabel())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasStartOffset()) { + hash = (37 * hash) + START_OFFSET_FIELD_NUMBER; + hash = (53 * hash) + getStartOffset().hashCode(); + } + if (hasEndOffset()) { + hash = (37 * hash) + END_OFFSET_FIELD_NUMBER; + hash = (53 * hash) + getEndOffset().hashCode(); + } + hash = (37 * hash) + WORD_FIELD_NUMBER; + hash = (53 * hash) + getWord().hashCode(); + hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); + hash = (37 * hash) + SPEAKER_LABEL_FIELD_NUMBER; + hash = (53 * hash) + getSpeakerLabel().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.WordInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.WordInfo parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.speech.v2.WordInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.speech.v2.WordInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Word-specific information for recognized words.
+   * 
+ * + * Protobuf type {@code google.cloud.speech.v2.WordInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.speech.v2.WordInfo) + com.google.cloud.speech.v2.WordInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_WordInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_WordInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.speech.v2.WordInfo.class, + com.google.cloud.speech.v2.WordInfo.Builder.class); + } + + // Construct using com.google.cloud.speech.v2.WordInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (startOffsetBuilder_ == null) { + startOffset_ = null; + } else { + startOffset_ = null; + startOffsetBuilder_ = null; + } + if (endOffsetBuilder_ == null) { + endOffset_ = null; + } else { + endOffset_ = null; + endOffsetBuilder_ = null; + } + word_ = ""; + + confidence_ = 0F; + + speakerLabel_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.speech.v2.CloudSpeechProto + .internal_static_google_cloud_speech_v2_WordInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.speech.v2.WordInfo getDefaultInstanceForType() { + return com.google.cloud.speech.v2.WordInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.speech.v2.WordInfo build() { + com.google.cloud.speech.v2.WordInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.speech.v2.WordInfo buildPartial() { + com.google.cloud.speech.v2.WordInfo result = new com.google.cloud.speech.v2.WordInfo(this); + if (startOffsetBuilder_ == null) { + result.startOffset_ = startOffset_; + } else { + result.startOffset_ = startOffsetBuilder_.build(); + } + if (endOffsetBuilder_ == null) { + result.endOffset_ = endOffset_; + } else { + result.endOffset_ = endOffsetBuilder_.build(); + } + result.word_ = word_; + result.confidence_ = confidence_; + result.speakerLabel_ = speakerLabel_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.speech.v2.WordInfo) { + return mergeFrom((com.google.cloud.speech.v2.WordInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.speech.v2.WordInfo other) { + if (other == com.google.cloud.speech.v2.WordInfo.getDefaultInstance()) return this; + if (other.hasStartOffset()) { + mergeStartOffset(other.getStartOffset()); + } + if (other.hasEndOffset()) { + mergeEndOffset(other.getEndOffset()); + } + if (!other.getWord().isEmpty()) { + word_ = other.word_; + onChanged(); + } + if (other.getConfidence() != 0F) { + setConfidence(other.getConfidence()); + } + if (!other.getSpeakerLabel().isEmpty()) { + speakerLabel_ = other.speakerLabel_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.speech.v2.WordInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.speech.v2.WordInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Duration startOffset_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + startOffsetBuilder_; + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + * + * @return Whether the startOffset field is set. + */ + public boolean hasStartOffset() { + return startOffsetBuilder_ != null || startOffset_ != null; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + * + * @return The startOffset. + */ + public com.google.protobuf.Duration getStartOffset() { + if (startOffsetBuilder_ == null) { + return startOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : startOffset_; + } else { + return startOffsetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + public Builder setStartOffset(com.google.protobuf.Duration value) { + if (startOffsetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startOffset_ = value; + onChanged(); + } else { + startOffsetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + public Builder setStartOffset(com.google.protobuf.Duration.Builder builderForValue) { + if (startOffsetBuilder_ == null) { + startOffset_ = builderForValue.build(); + onChanged(); + } else { + startOffsetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + public Builder mergeStartOffset(com.google.protobuf.Duration value) { + if (startOffsetBuilder_ == null) { + if (startOffset_ != null) { + startOffset_ = + com.google.protobuf.Duration.newBuilder(startOffset_).mergeFrom(value).buildPartial(); + } else { + startOffset_ = value; + } + onChanged(); + } else { + startOffsetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + public Builder clearStartOffset() { + if (startOffsetBuilder_ == null) { + startOffset_ = null; + onChanged(); + } else { + startOffset_ = null; + startOffsetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + public com.google.protobuf.Duration.Builder getStartOffsetBuilder() { + + onChanged(); + return getStartOffsetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + public com.google.protobuf.DurationOrBuilder getStartOffsetOrBuilder() { + if (startOffsetBuilder_ != null) { + return startOffsetBuilder_.getMessageOrBuilder(); + } else { + return startOffset_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : startOffset_; + } + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the start of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getStartOffsetFieldBuilder() { + if (startOffsetBuilder_ == null) { + startOffsetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getStartOffset(), getParentForChildren(), isClean()); + startOffset_ = null; + } + return startOffsetBuilder_; + } + + private com.google.protobuf.Duration endOffset_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + endOffsetBuilder_; + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + * + * @return Whether the endOffset field is set. + */ + public boolean hasEndOffset() { + return endOffsetBuilder_ != null || endOffset_ != null; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + * + * @return The endOffset. + */ + public com.google.protobuf.Duration getEndOffset() { + if (endOffsetBuilder_ == null) { + return endOffset_ == null ? com.google.protobuf.Duration.getDefaultInstance() : endOffset_; + } else { + return endOffsetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + public Builder setEndOffset(com.google.protobuf.Duration value) { + if (endOffsetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endOffset_ = value; + onChanged(); + } else { + endOffsetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + public Builder setEndOffset(com.google.protobuf.Duration.Builder builderForValue) { + if (endOffsetBuilder_ == null) { + endOffset_ = builderForValue.build(); + onChanged(); + } else { + endOffsetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + public Builder mergeEndOffset(com.google.protobuf.Duration value) { + if (endOffsetBuilder_ == null) { + if (endOffset_ != null) { + endOffset_ = + com.google.protobuf.Duration.newBuilder(endOffset_).mergeFrom(value).buildPartial(); + } else { + endOffset_ = value; + } + onChanged(); + } else { + endOffsetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + public Builder clearEndOffset() { + if (endOffsetBuilder_ == null) { + endOffset_ = null; + onChanged(); + } else { + endOffset_ = null; + endOffsetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + public com.google.protobuf.Duration.Builder getEndOffsetBuilder() { + + onChanged(); + return getEndOffsetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + public com.google.protobuf.DurationOrBuilder getEndOffsetOrBuilder() { + if (endOffsetBuilder_ != null) { + return endOffsetBuilder_.getMessageOrBuilder(); + } else { + return endOffset_ == null ? com.google.protobuf.Duration.getDefaultInstance() : endOffset_; + } + } + /** + * + * + *
+     * Time offset relative to the beginning of the audio,
+     * and corresponding to the end of the spoken word.
+     * This field is only set if
+     * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+     * is `true` and only in the top hypothesis. This is an experimental feature
+     * and the accuracy of the time offset can vary.
+     * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getEndOffsetFieldBuilder() { + if (endOffsetBuilder_ == null) { + endOffsetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getEndOffset(), getParentForChildren(), isClean()); + endOffset_ = null; + } + return endOffsetBuilder_; + } + + private java.lang.Object word_ = ""; + /** + * + * + *
+     * The word corresponding to this set of information.
+     * 
+ * + * string word = 3; + * + * @return The word. + */ + public java.lang.String getWord() { + java.lang.Object ref = word_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + word_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The word corresponding to this set of information.
+     * 
+ * + * string word = 3; + * + * @return The bytes for word. + */ + public com.google.protobuf.ByteString getWordBytes() { + java.lang.Object ref = word_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + word_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The word corresponding to this set of information.
+     * 
+ * + * string word = 3; + * + * @param value The word to set. + * @return This builder for chaining. + */ + public Builder setWord(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + word_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The word corresponding to this set of information.
+     * 
+ * + * string word = 3; + * + * @return This builder for chaining. + */ + public Builder clearWord() { + + word_ = getDefaultInstance().getWord(); + onChanged(); + return this; + } + /** + * + * + *
+     * The word corresponding to this set of information.
+     * 
+ * + * string word = 3; + * + * @param value The bytes for word to set. + * @return This builder for chaining. + */ + public Builder setWordBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + word_ = value; + onChanged(); + return this; + } + + private float confidence_; + /** + * + * + *
+     * The confidence estimate between 0.0 and 1.0. A higher number
+     * indicates an estimated greater likelihood that the recognized words are
+     * correct. This field is set only for the top alternative of a non-streaming
+     * result or, of a streaming result where
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+     * set to `true`. This field is not guaranteed to be accurate and users should
+     * not rely on it to be always provided. The default of 0.0 is a sentinel
+     * value indicating `confidence` was not set.
+     * 
+ * + * float confidence = 4; + * + * @return The confidence. + */ + @java.lang.Override + public float getConfidence() { + return confidence_; + } + /** + * + * + *
+     * The confidence estimate between 0.0 and 1.0. A higher number
+     * indicates an estimated greater likelihood that the recognized words are
+     * correct. This field is set only for the top alternative of a non-streaming
+     * result or, of a streaming result where
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+     * set to `true`. This field is not guaranteed to be accurate and users should
+     * not rely on it to be always provided. The default of 0.0 is a sentinel
+     * value indicating `confidence` was not set.
+     * 
+ * + * float confidence = 4; + * + * @param value The confidence to set. + * @return This builder for chaining. + */ + public Builder setConfidence(float value) { + + confidence_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The confidence estimate between 0.0 and 1.0. A higher number
+     * indicates an estimated greater likelihood that the recognized words are
+     * correct. This field is set only for the top alternative of a non-streaming
+     * result or, of a streaming result where
+     * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+     * set to `true`. This field is not guaranteed to be accurate and users should
+     * not rely on it to be always provided. The default of 0.0 is a sentinel
+     * value indicating `confidence` was not set.
+     * 
+ * + * float confidence = 4; + * + * @return This builder for chaining. + */ + public Builder clearConfidence() { + + confidence_ = 0F; + onChanged(); + return this; + } + + private java.lang.Object speakerLabel_ = ""; + /** + * + * + *
+     * A distinct label is assigned for every speaker within the audio. This field
+     * specifies which one of those speakers was detected to have spoken this
+     * word. `speaker_label` is set if
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is `true` and only in the top alternative.
+     * 
+ * + * string speaker_label = 6; + * + * @return The speakerLabel. + */ + public java.lang.String getSpeakerLabel() { + java.lang.Object ref = speakerLabel_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + speakerLabel_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A distinct label is assigned for every speaker within the audio. This field
+     * specifies which one of those speakers was detected to have spoken this
+     * word. `speaker_label` is set if
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is `true` and only in the top alternative.
+     * 
+ * + * string speaker_label = 6; + * + * @return The bytes for speakerLabel. + */ + public com.google.protobuf.ByteString getSpeakerLabelBytes() { + java.lang.Object ref = speakerLabel_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + speakerLabel_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A distinct label is assigned for every speaker within the audio. This field
+     * specifies which one of those speakers was detected to have spoken this
+     * word. `speaker_label` is set if
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is `true` and only in the top alternative.
+     * 
+ * + * string speaker_label = 6; + * + * @param value The speakerLabel to set. + * @return This builder for chaining. + */ + public Builder setSpeakerLabel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + speakerLabel_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A distinct label is assigned for every speaker within the audio. This field
+     * specifies which one of those speakers was detected to have spoken this
+     * word. `speaker_label` is set if
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is `true` and only in the top alternative.
+     * 
+ * + * string speaker_label = 6; + * + * @return This builder for chaining. + */ + public Builder clearSpeakerLabel() { + + speakerLabel_ = getDefaultInstance().getSpeakerLabel(); + onChanged(); + return this; + } + /** + * + * + *
+     * A distinct label is assigned for every speaker within the audio. This field
+     * specifies which one of those speakers was detected to have spoken this
+     * word. `speaker_label` is set if
+     * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+     * is `true` and only in the top alternative.
+     * 
+ * + * string speaker_label = 6; + * + * @param value The bytes for speakerLabel to set. + * @return This builder for chaining. + */ + public Builder setSpeakerLabelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + speakerLabel_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.speech.v2.WordInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.speech.v2.WordInfo) + private static final com.google.cloud.speech.v2.WordInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.speech.v2.WordInfo(); + } + + public static com.google.cloud.speech.v2.WordInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public WordInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new WordInfo(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.speech.v2.WordInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfoOrBuilder.java b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfoOrBuilder.java new file mode 100644 index 000000000000..c6c183016e20 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/java/com/google/cloud/speech/v2/WordInfoOrBuilder.java @@ -0,0 +1,203 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/speech/v2/cloud_speech.proto + +package com.google.cloud.speech.v2; + +public interface WordInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.speech.v2.WordInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the start of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration start_offset = 1; + * + * @return Whether the startOffset field is set. + */ + boolean hasStartOffset(); + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the start of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration start_offset = 1; + * + * @return The startOffset. + */ + com.google.protobuf.Duration getStartOffset(); + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the start of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration start_offset = 1; + */ + com.google.protobuf.DurationOrBuilder getStartOffsetOrBuilder(); + + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the end of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration end_offset = 2; + * + * @return Whether the endOffset field is set. + */ + boolean hasEndOffset(); + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the end of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration end_offset = 2; + * + * @return The endOffset. + */ + com.google.protobuf.Duration getEndOffset(); + /** + * + * + *
+   * Time offset relative to the beginning of the audio,
+   * and corresponding to the end of the spoken word.
+   * This field is only set if
+   * [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
+   * is `true` and only in the top hypothesis. This is an experimental feature
+   * and the accuracy of the time offset can vary.
+   * 
+ * + * .google.protobuf.Duration end_offset = 2; + */ + com.google.protobuf.DurationOrBuilder getEndOffsetOrBuilder(); + + /** + * + * + *
+   * The word corresponding to this set of information.
+   * 
+ * + * string word = 3; + * + * @return The word. + */ + java.lang.String getWord(); + /** + * + * + *
+   * The word corresponding to this set of information.
+   * 
+ * + * string word = 3; + * + * @return The bytes for word. + */ + com.google.protobuf.ByteString getWordBytes(); + + /** + * + * + *
+   * The confidence estimate between 0.0 and 1.0. A higher number
+   * indicates an estimated greater likelihood that the recognized words are
+   * correct. This field is set only for the top alternative of a non-streaming
+   * result or, of a streaming result where
+   * [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
+   * set to `true`. This field is not guaranteed to be accurate and users should
+   * not rely on it to be always provided. The default of 0.0 is a sentinel
+   * value indicating `confidence` was not set.
+   * 
+ * + * float confidence = 4; + * + * @return The confidence. + */ + float getConfidence(); + + /** + * + * + *
+   * A distinct label is assigned for every speaker within the audio. This field
+   * specifies which one of those speakers was detected to have spoken this
+   * word. `speaker_label` is set if
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is `true` and only in the top alternative.
+   * 
+ * + * string speaker_label = 6; + * + * @return The speakerLabel. + */ + java.lang.String getSpeakerLabel(); + /** + * + * + *
+   * A distinct label is assigned for every speaker within the audio. This field
+   * specifies which one of those speakers was detected to have spoken this
+   * word. `speaker_label` is set if
+   * [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization]
+   * is `true` and only in the top alternative.
+   * 
+ * + * string speaker_label = 6; + * + * @return The bytes for speakerLabel. + */ + com.google.protobuf.ByteString getSpeakerLabelBytes(); +} diff --git a/java-speech/proto-google-cloud-speech-v2/src/main/proto/google/cloud/speech/v2/cloud_speech.proto b/java-speech/proto-google-cloud-speech-v2/src/main/proto/google/cloud/speech/v2/cloud_speech.proto new file mode 100644 index 000000000000..a3512e316c42 --- /dev/null +++ b/java-speech/proto-google-cloud-speech-v2/src/main/proto/google/cloud/speech/v2/cloud_speech.proto @@ -0,0 +1,1965 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.speech.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v2;speech"; +option java_multiple_files = true; +option java_outer_classname = "CloudSpeechProto"; +option java_package = "com.google.cloud.speech.v2"; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" +}; + +// Enables speech transcription and resource management. +service Speech { + option (google.api.default_host) = "speech.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a [Recognizer][google.cloud.speech.v2.Recognizer]. + rpc CreateRecognizer(CreateRecognizerRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/recognizers" + body: "recognizer" + }; + option (google.api.method_signature) = "parent,recognizer,recognizer_id"; + option (google.longrunning.operation_info) = { + response_type: "Recognizer" + metadata_type: "OperationMetadata" + }; + } + + // Lists Recognizers. + rpc ListRecognizers(ListRecognizersRequest) + returns (ListRecognizersResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/recognizers" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the requested + // [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with + // [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested recognizer doesn't + // exist. + rpc GetRecognizer(GetRecognizerRequest) returns (Recognizer) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/recognizers/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [Recognizer][google.cloud.speech.v2.Recognizer]. + rpc UpdateRecognizer(UpdateRecognizerRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{recognizer.name=projects/*/locations/*/recognizers/*}" + body: "recognizer" + }; + option (google.api.method_signature) = "recognizer,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Recognizer" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + rpc DeleteRecognizer(DeleteRecognizerRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/recognizers/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Recognizer" + metadata_type: "OperationMetadata" + }; + } + + // Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer]. + rpc UndeleteRecognizer(UndeleteRecognizerRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/recognizers/*}:undelete" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Recognizer" + metadata_type: "OperationMetadata" + }; + } + + // Performs synchronous Speech recognition: receive results after all audio + // has been sent and processed. + rpc Recognize(RecognizeRequest) returns (RecognizeResponse) { + option (google.api.http) = { + post: "/v2/{recognizer=projects/*/locations/*/recognizers/*}:recognize" + body: "*" + }; + option (google.api.method_signature) = + "recognizer,config,config_mask,content"; + option (google.api.method_signature) = "recognizer,config,config_mask,uri"; + } + + // Performs bidirectional streaming speech recognition: receive results while + // sending audio. This method is only available via the gRPC API (not REST). + rpc StreamingRecognize(stream StreamingRecognizeRequest) + returns (stream StreamingRecognizeResponse) {} + + // Performs batch asynchronous speech recognition: send a request with N + // audio files and receive a long running operation that can be polled to see + // when the transcriptions are finished. + rpc BatchRecognize(BatchRecognizeRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{recognizer=projects/*/locations/*/recognizers/*}:batchRecognize" + body: "*" + }; + option (google.api.method_signature) = + "recognizer,config,config_mask,files"; + option (google.longrunning.operation_info) = { + response_type: "BatchRecognizeResponse" + metadata_type: "OperationMetadata" + }; + } + + // Returns the requested [Config][google.cloud.speech.v2.Config]. + rpc GetConfig(GetConfigRequest) returns (Config) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/config}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [Config][google.cloud.speech.v2.Config]. + rpc UpdateConfig(UpdateConfigRequest) returns (Config) { + option (google.api.http) = { + patch: "/v2/{config.name=projects/*/locations/*/config}" + body: "config" + }; + option (google.api.method_signature) = "config,update_mask"; + } + + // Creates a [CustomClass][google.cloud.speech.v2.CustomClass]. + rpc CreateCustomClass(CreateCustomClassRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/customClasses" + body: "custom_class" + }; + option (google.api.method_signature) = + "parent,custom_class,custom_class_id"; + option (google.longrunning.operation_info) = { + response_type: "CustomClass" + metadata_type: "OperationMetadata" + }; + } + + // Lists CustomClasses. + rpc ListCustomClasses(ListCustomClassesRequest) + returns (ListCustomClassesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/customClasses" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the requested + // [CustomClass][google.cloud.speech.v2.CustomClass]. + rpc GetCustomClass(GetCustomClassRequest) returns (CustomClass) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/customClasses/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [CustomClass][google.cloud.speech.v2.CustomClass]. + rpc UpdateCustomClass(UpdateCustomClassRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{custom_class.name=projects/*/locations/*/customClasses/*}" + body: "custom_class" + }; + option (google.api.method_signature) = "custom_class,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "CustomClass" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + rpc DeleteCustomClass(DeleteCustomClassRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/customClasses/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CustomClass" + metadata_type: "OperationMetadata" + }; + } + + // Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass]. + rpc UndeleteCustomClass(UndeleteCustomClassRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/customClasses/*}:undelete" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "CustomClass" + metadata_type: "OperationMetadata" + }; + } + + // Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet]. + rpc CreatePhraseSet(CreatePhraseSetRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/phraseSets" + body: "phrase_set" + }; + option (google.api.method_signature) = "parent,phrase_set,phrase_set_id"; + option (google.longrunning.operation_info) = { + response_type: "PhraseSet" + metadata_type: "OperationMetadata" + }; + } + + // Lists PhraseSets. + rpc ListPhraseSets(ListPhraseSetsRequest) returns (ListPhraseSetsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/phraseSets" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the requested + // [PhraseSet][google.cloud.speech.v2.PhraseSet]. + rpc GetPhraseSet(GetPhraseSetRequest) returns (PhraseSet) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/phraseSets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + rpc UpdatePhraseSet(UpdatePhraseSetRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{phrase_set.name=projects/*/locations/*/phraseSets/*}" + body: "phrase_set" + }; + option (google.api.method_signature) = "phrase_set,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "PhraseSet" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + rpc DeletePhraseSet(DeletePhraseSetRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/phraseSets/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "PhraseSet" + metadata_type: "OperationMetadata" + }; + } + + // Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. + rpc UndeletePhraseSet(UndeletePhraseSetRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/phraseSets/*}:undelete" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "PhraseSet" + metadata_type: "OperationMetadata" + }; + } +} + +// Request message for the +// [CreateRecognizer][google.cloud.speech.v2.Speech.CreateRecognizer] method. +message CreateRecognizerRequest { + // Required. The Recognizer to create. + Recognizer recognizer = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the Recognizer, but do not + // actually create it. + bool validate_only = 2; + + // The ID to use for the Recognizer, which will become the final component of + // the Recognizer's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string recognizer_id = 3; + + // Required. The project and location where this Recognizer will be created. + // The expected format is `projects/{project}/locations/{location}`. + string parent = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "speech.googleapis.com/Recognizer" + } + ]; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation was last updated. + google.protobuf.Timestamp update_time = 2; + + // The resource path for the target of the operation. + string resource = 3; + + // The method that triggered the operation. + string method = 4; + + // The [KMS key + // name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which + // the content of the Operation is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 6 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; + + // The [KMS key version + // name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions) + // with which content of the Operation is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`. + string kms_key_version_name = 7 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + }]; + + // The request that spawned the Operation. + oneof request { + // The BatchRecognizeRequest that spawned the Operation. + BatchRecognizeRequest batch_recognize_request = 8; + + // The CreateRecognizerRequest that spawned the Operation. + CreateRecognizerRequest create_recognizer_request = 9; + + // The UpdateRecognizerRequest that spawned the Operation. + UpdateRecognizerRequest update_recognizer_request = 10; + + // The DeleteRecognizerRequest that spawned the Operation. + DeleteRecognizerRequest delete_recognizer_request = 11; + + // The UndeleteRecognizerRequest that spawned the Operation. + UndeleteRecognizerRequest undelete_recognizer_request = 12; + + // The CreateCustomClassRequest that spawned the Operation. + CreateCustomClassRequest create_custom_class_request = 13; + + // The UpdateCustomClassRequest that spawned the Operation. + UpdateCustomClassRequest update_custom_class_request = 14; + + // The DeleteCustomClassRequest that spawned the Operation. + DeleteCustomClassRequest delete_custom_class_request = 15; + + // The UndeleteCustomClassRequest that spawned the Operation. + UndeleteCustomClassRequest undelete_custom_class_request = 16; + + // The CreatePhraseSetRequest that spawned the Operation. + CreatePhraseSetRequest create_phrase_set_request = 17; + + // The UpdatePhraseSetRequest that spawned the Operation. + UpdatePhraseSetRequest update_phrase_set_request = 18; + + // The DeletePhraseSetRequest that spawned the Operation. + DeletePhraseSetRequest delete_phrase_set_request = 19; + + // The UndeletePhraseSetRequest that spawned the Operation. + UndeletePhraseSetRequest undelete_phrase_set_request = 20; + + // The UpdateConfigRequest that spawned the Operation. + UpdateConfigRequest update_config_request = 21; + } + + // The percent progress of the Operation. Values can range from 0-100. If the + // value is 100, then the operation is finished. + int32 progress_percent = 22; + + // Specific metadata per RPC + oneof metadata { + // Metadata specific to the BatchRecognize method. + BatchRecognizeMetadata batch_recognize_metadata = 23; + } +} + +// Request message for the +// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method. +message ListRecognizersRequest { + // Required. The project and location of Recognizers to list. The expected + // format is `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of Recognizers to return. The service may return fewer + // than this value. If unspecified, at most 20 Recognizers will be returned. + // The maximum value is 20; values above 20 will be coerced to 20. + int32 page_size = 2; + + // A page token, received from a previous + // [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match + // the call that provided the page token. + string page_token = 3; + + // Whether, or not, to show resources that have been deleted. + bool show_deleted = 4; +} + +// Response message for the +// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method. +message ListRecognizersResponse { + // The list of requested Recognizers. + repeated Recognizer recognizers = 1; + + // A token, which can be sent as + // [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to + // retrieve the next page. If this field is omitted, there are no subsequent + // pages. This token expires after 72 hours. + string next_page_token = 2; +} + +// Request message for the +// [GetRecognizer][google.cloud.speech.v2.Speech.GetRecognizer] method. +message GetRecognizerRequest { + // Required. The name of the Recognizer to retrieve. The expected format is + // `projects/{project}/locations/{location}/recognizers/{recognizer}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/Recognizer" + } + ]; +} + +// Request message for the +// [UpdateRecognizer][google.cloud.speech.v2.Speech.UpdateRecognizer] method. +message UpdateRecognizerRequest { + // Required. The Recognizer to update. + // + // The Recognizer's `name` field is used to identify the Recognizer to update. + // Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`. + Recognizer recognizer = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to update. If empty, all non-default valued fields are + // considered for update. Use `*` to update the entire Recognizer resource. + google.protobuf.FieldMask update_mask = 2; + + // If set, validate the request and preview the updated Recognizer, but do not + // actually update it. + bool validate_only = 4; +} + +// Request message for the +// [DeleteRecognizer][google.cloud.speech.v2.Speech.DeleteRecognizer] method. +message DeleteRecognizerRequest { + // Required. The name of the Recognizer to delete. + // Format: `projects/{project}/locations/{location}/recognizers/{recognizer}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/Recognizer" + } + ]; + + // If set, validate the request and preview the deleted Recognizer, but do not + // actually delete it. + bool validate_only = 2; + + // If set to true, and the Recognizer is not found, the request will succeed + // and be a no-op (no Operation is recorded in this case). + bool allow_missing = 4; + + // This checksum is computed by the server based on the value of other + // fields. This may be sent on update, undelete, and delete requests to ensure + // the client has an up-to-date value before proceeding. + string etag = 3; +} + +// Request message for the +// [UndeleteRecognizer][google.cloud.speech.v2.Speech.UndeleteRecognizer] +// method. +message UndeleteRecognizerRequest { + // Required. The name of the Recognizer to undelete. + // Format: `projects/{project}/locations/{location}/recognizers/{recognizer}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/Recognizer" + } + ]; + + // If set, validate the request and preview the undeleted Recognizer, but do + // not actually undelete it. + bool validate_only = 3; + + // This checksum is computed by the server based on the value of other + // fields. This may be sent on update, undelete, and delete requests to ensure + // the client has an up-to-date value before proceeding. + string etag = 4; +} + +// A Recognizer message. Stores recognition configuration and metadata. +message Recognizer { + option (google.api.resource) = { + type: "speech.googleapis.com/Recognizer" + pattern: "projects/{project}/locations/{location}/recognizers/{recognizer}" + style: DECLARATIVE_FRIENDLY + }; + + // Set of states that define the lifecycle of a Recognizer. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The Recognizer is active and ready for use. + ACTIVE = 2; + + // This Recognizer has been deleted. + DELETED = 4; + } + + // Output only. The resource name of the Recognizer. + // Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. System-assigned unique identifier for the Recognizer. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-settable, human-readable name for the Recognizer. Must be 63 + // characters or less. + string display_name = 3; + + // Required. Which model to use for recognition requests. Select the model + // best suited to your domain to get best results. + // + // Supported models: + // + // - `latest_long` + // + // Best for long form content like media or conversation. + // + // - `latest_short` + // + // Best for short form content like commands or single shot directed speech. + // When using this model, the service will stop transcribing audio after the + // first utterance is detected and completed. + // + // When using this model, + // [SEPARATE_RECOGNITION_PER_CHANNEL][google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode.SEPARATE_RECOGNITION_PER_CHANNEL] + // is not supported; multi-channel audio is accepted, but only the first + // channel will be processed and transcribed. + string model = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The language of the supplied audio as a + // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + // + // Supported languages: + // + // - `en-US` + // + // - `en-GB` + // + // - `fr-FR` + // + // If additional languages are provided, recognition result will contain + // recognition in the most likely language detected. The recognition result + // will include the language tag of the language detected in the audio. + // When you create or update a Recognizer, these values are + // stored in normalized BCP-47 form. For example, "en-us" is stored as + // "en-US". + repeated string language_codes = 17 [(google.api.field_behavior) = REQUIRED]; + + // Default configuration to use for requests with this Recognizer. + // This can be overwritten by inline configuration in the + // [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config] + // field. + RecognitionConfig default_recognition_config = 6; + + // Allows users to store small amounts of arbitrary data. + // Both the key and the value must be 63 characters or less each. + // At most 100 annotations. + map annotations = 7; + + // Output only. The Recognizer lifecycle state. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time. + google.protobuf.Timestamp create_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time this Recognizer was modified. + google.protobuf.Timestamp update_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this Recognizer was requested for deletion. + google.protobuf.Timestamp delete_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this Recognizer will be purged. + google.protobuf.Timestamp expire_time = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This checksum is computed by the server based on the value of + // other fields. This may be sent on update, undelete, and delete requests to + // ensure the client has an up-to-date value before proceeding. + string etag = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether or not this Recognizer is in the process of being + // updated. + bool reconciling = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [KMS key + // name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which + // the Recognizer is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 15 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Output only. The [KMS key version + // name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions) + // with which the Recognizer is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`. + string kms_key_version_name = 16 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Automatically detected decoding parameters. +// Supported for the following encodings: +// * WAV_LINEAR16: 16-bit signed little-endian PCM samples in a WAV container. +// * WAV_MULAW: 8-bit companded mulaw samples in a WAV container. +// * WAV_ALAW: 8-bit companded alaw samples in a WAV container. +// * RFC4867_5_AMR: AMR frames with an rfc4867.5 header. +// * RFC4867_5_AMRWB: AMR-WB frames with an rfc4867.5 header. +// * FLAC: FLAC frames in the "native FLAC" container format. +// * MP3: MPEG audio frames with optional (ignored) ID3 metadata. +// * OGG_OPUS: Opus audio frames in an Ogg container. +// * WEBM_OPUS: Opus audio frames in a WebM container. +message AutoDetectDecodingConfig {} + +// Explicitly specified decoding parameters. +message ExplicitDecodingConfig { + // Supported audio data encodings. + enum AudioEncoding { + // Default value. This value is unused. + AUDIO_ENCODING_UNSPECIFIED = 0; + + // Headerless 16-bit signed little-endian PCM samples. + LINEAR16 = 1; + + // Headerless 8-bit companded mulaw samples. + MULAW = 2; + + // Headerless 8-bit companded alaw samples. + ALAW = 3; + } + + // Required. Encoding of the audio data sent for recognition. + AudioEncoding encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // Sample rate in Hertz of the audio data sent for recognition. Valid + // values are: 8000-48000. 16000 is optimal. For best results, set the + // sampling rate of the audio source to 16000 Hz. If that's not possible, use + // the native sample rate of the audio source (instead of re-sampling). + // Supported for the following encodings: + // * LINEAR16: Headerless 16-bit signed little-endian PCM samples. + // * MULAW: Headerless 8-bit companded mulaw samples. + // * ALAW: Headerless 8-bit companded alaw samples. + int32 sample_rate_hertz = 2; + + // Number of channels present in the audio data sent for recognition. + // Supported for the following encodings: + // * LINEAR16: Headerless 16-bit signed little-endian PCM samples. + // * MULAW: Headerless 8-bit companded mulaw samples. + // * ALAW: Headerless 8-bit companded alaw samples. + int32 audio_channel_count = 3; +} + +// Configuration to enable speaker diarization. +message SpeakerDiarizationConfig { + // Required. Minimum number of speakers in the conversation. This range gives + // you more flexibility by allowing the system to automatically determine the + // correct number of speakers. If not set, the default value is 2. + // + // To fix the number of speakers detected in the audio, set + // `min_speaker_count` = `max_speaker_count`. + int32 min_speaker_count = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Maximum number of speakers in the conversation. Valid values are: + // 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility + // by allowing the system to automatically determine the correct number of + // speakers. + int32 max_speaker_count = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Available recognition features. +message RecognitionFeatures { + // Options for how to recognize multi-channel audio. + enum MultiChannelMode { + // Default value for the multi-channel mode. If the audio contains + // multiple channels, only the first channel will be transcribed; other + // channels will be ignored. + MULTI_CHANNEL_MODE_UNSPECIFIED = 0; + + // If selected, each channel in the provided audio is transcribed + // independently. This cannot be selected if the selected + // [model][google.cloud.speech.v2.Recognizer.model] is `latest_short`. + SEPARATE_RECOGNITION_PER_CHANNEL = 1; + } + + // If set to `true`, the server will attempt to filter out profanities, + // replacing all but the initial character in each filtered word with + // asterisks, for instance, "f***". If set to `false` or omitted, profanities + // won't be filtered out. + bool profanity_filter = 1; + + // If `true`, the top result includes a list of words and the start and end + // time offsets (timestamps) for those words. If `false`, no word-level time + // offset information is returned. The default is `false`. + bool enable_word_time_offsets = 2; + + // If `true`, the top result includes a list of words and the confidence for + // those words. If `false`, no word-level confidence information is returned. + // The default is `false`. + bool enable_word_confidence = 3; + + // If `true`, adds punctuation to recognition result hypotheses. This feature + // is only available in select languages. The default `false` value does not + // add punctuation to result hypotheses. + bool enable_automatic_punctuation = 4; + + // The spoken punctuation behavior for the call. If `true`, replaces spoken + // punctuation with the corresponding symbols in the request. For example, + // "how are you question mark" becomes "how are you?". See + // https://cloud.google.com/speech-to-text/docs/spoken-punctuation for + // support. If `false`, spoken punctuation is not replaced. + bool enable_spoken_punctuation = 14; + + // The spoken emoji behavior for the call. If `true`, adds spoken emoji + // formatting for the request. This will replace spoken emojis with the + // corresponding Unicode symbols in the final transcript. If `false`, spoken + // emojis are not replaced. + bool enable_spoken_emojis = 15; + + // Mode for recognizing multi-channel audio. + MultiChannelMode multi_channel_mode = 17; + + // Configuration to enable speaker diarization and set additional + // parameters to make diarization better suited for your application. + // When this is enabled, we send all the words from the beginning of the + // audio for the top alternative in every consecutive STREAMING responses. + // This is done in order to improve our speaker tags as our models learn to + // identify the speakers in the conversation over time. + // For non-streaming requests, the diarization results will be provided only + // in the top alternative of the FINAL SpeechRecognitionResult. + SpeakerDiarizationConfig diarization_config = 9; + + // Maximum number of recognition hypotheses to be returned. + // The server may return fewer than `max_alternatives`. + // Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of + // one. If omitted, will return a maximum of one. + int32 max_alternatives = 16; +} + +// Provides "hints" to the speech recognizer to favor specific words and phrases +// in the results. Phrase sets can be specified as an inline resource, or a +// reference to an existing phrase set resource. +message SpeechAdaptation { + // A biasing phrase set, which can be either a string referencing the name of + // an existing phrase set resource, or an inline definition of a phrase set. + message AdaptationPhraseSet { + oneof value { + // The name of an existing phrase set resource. The user must have read + // access to the resource and it must not be deleted. + string phrase_set = 1 [(google.api.resource_reference) = { + type: "speech.googleapis.com/PhraseSet" + }]; + + // An inline defined phrase set. + PhraseSet inline_phrase_set = 2; + } + } + + // A list of inline or referenced phrase sets. + repeated AdaptationPhraseSet phrase_sets = 1; + + // A list of inline custom classes. Existing custom class resources can be + // referenced directly in a phrase set. + repeated CustomClass custom_classes = 2; +} + +// Provides information to the Recognizer that specifies how to process the +// recognition request. +message RecognitionConfig { + // Decoding parameters for audio being sent for recognition. + oneof decoding_config { + // Automatically detect decoding parameters. + // Preferred for supported formats. + AutoDetectDecodingConfig auto_decoding_config = 7; + + // Explicitly specified decoding parameters. + // Required if using headerless PCM audio (linear16, mulaw, alaw). + ExplicitDecodingConfig explicit_decoding_config = 8; + } + + // Speech recognition features to enable. + RecognitionFeatures features = 2; + + // Speech adaptation context that weights recognizer predictions for specific + // words and phrases. + SpeechAdaptation adaptation = 6; +} + +// Request message for the +// [Recognize][google.cloud.speech.v2.Speech.Recognize] method. Either +// `content` or `uri` must be supplied. Supplying both or neither returns +// [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See [content +// limits](https://cloud.google.com/speech-to-text/quotas#content). +message RecognizeRequest { + // Required. The name of the Recognizer to use during recognition. The + // expected format is + // `projects/{project}/locations/{location}/recognizers/{recognizer}`. + string recognizer = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/Recognizer" + } + ]; + + // Features and audio metadata to use for the Automatic Speech Recognition. + // This field in combination with the + // [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field + // can be used to override parts of the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the Recognizer resource. + RecognitionConfig config = 1; + + // The list of fields in + // [config][google.cloud.speech.v2.RecognizeRequest.config] that override the + // values in the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the recognizer during this recognition request. If no mask is provided, + // all non-default valued fields in + // [config][google.cloud.speech.v2.RecognizeRequest.config] override the + // values in the recognizer for this recognition request. If a mask is + // provided, only the fields listed in the mask override the config in the + // recognizer for this recognition request. If a wildcard (`*`) is provided, + // [config][google.cloud.speech.v2.RecognizeRequest.config] completely + // overrides and replaces the config in the recognizer for this recognition + // request. + google.protobuf.FieldMask config_mask = 8; + + // The audio source, which is either inline content or a Google Cloud + // Storage URI. + oneof audio_source { + // The audio data bytes encoded as specified in + // [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As + // with all bytes fields, proto buffers use a pure binary representation, + // whereas JSON representations use base64. + bytes content = 5; + + // URI that points to a file that contains audio data bytes as specified in + // [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file + // must not be compressed (for example, gzip). Currently, only Google Cloud + // Storage URIs are supported, which must be specified in the following + // format: `gs://bucket_name/object_name` (other URI formats return + // [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more + // information, see [Request + // URIs](https://cloud.google.com/storage/docs/reference-uris). + string uri = 6; + } +} + +// Metadata about the recognition request and response. +message RecognitionResponseMetadata { + // When available, billed audio seconds for the corresponding request. + google.protobuf.Duration total_billed_duration = 6; +} + +// Alternative hypotheses (a.k.a. n-best list). +message SpeechRecognitionAlternative { + // Transcript text representing the words that the user spoke. + string transcript = 1; + + // The confidence estimate between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. This field is set only for the top alternative of a non-streaming + // result or, of a streaming result where + // [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is + // set to `true`. This field is not guaranteed to be accurate and users should + // not rely on it to be always provided. The default of 0.0 is a sentinel + // value indicating `confidence` was not set. + float confidence = 2; + + // A list of word-specific information for each recognized word. + // When + // [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization] + // is true, you will see all the words from the beginning of the audio. + repeated WordInfo words = 3; +} + +// Word-specific information for recognized words. +message WordInfo { + // Time offset relative to the beginning of the audio, + // and corresponding to the start of the spoken word. + // This field is only set if + // [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets] + // is `true` and only in the top hypothesis. This is an experimental feature + // and the accuracy of the time offset can vary. + google.protobuf.Duration start_offset = 1; + + // Time offset relative to the beginning of the audio, + // and corresponding to the end of the spoken word. + // This field is only set if + // [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets] + // is `true` and only in the top hypothesis. This is an experimental feature + // and the accuracy of the time offset can vary. + google.protobuf.Duration end_offset = 2; + + // The word corresponding to this set of information. + string word = 3; + + // The confidence estimate between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. This field is set only for the top alternative of a non-streaming + // result or, of a streaming result where + // [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is + // set to `true`. This field is not guaranteed to be accurate and users should + // not rely on it to be always provided. The default of 0.0 is a sentinel + // value indicating `confidence` was not set. + float confidence = 4; + + // A distinct label is assigned for every speaker within the audio. This field + // specifies which one of those speakers was detected to have spoken this + // word. `speaker_label` is set if + // [enable_speaker_diarization][google.cloud.speech.v2.SpeakerDiarizationConfig.enable_speaker_diarization] + // is `true` and only in the top alternative. + string speaker_label = 6; +} + +// A speech recognition result corresponding to a portion of the audio. +message SpeechRecognitionResult { + // May contain one or more recognition hypotheses. These alternatives are + // ordered in terms of accuracy, with the top (first) alternative being the + // most probable, as ranked by the recognizer. + repeated SpeechRecognitionAlternative alternatives = 1; + + // For multi-channel audio, this is the channel number corresponding to the + // recognized result for the audio from that channel. + // For `audio_channel_count` = `N`, its output values can range from `1` to + // `N`. + int32 channel_tag = 2; + + // Time offset of the end of this result relative to the beginning of the + // audio. + google.protobuf.Duration result_end_offset = 4; + + // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag of the language in this result. This language code was + // detected to have the most likelihood of being spoken in the audio. + string language_code = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Response message for the +// [Recognize][google.cloud.speech.v2.Speech.Recognize] method. +message RecognizeResponse { + // Sequential list of transcription results corresponding to sequential + // portions of audio. + repeated SpeechRecognitionResult results = 3; + + // Metadata about the recognition. + RecognitionResponseMetadata metadata = 2; +} + +// Available recognition features specific to streaming recognition requests. +message StreamingRecognitionFeatures { + // Events that a timeout can be set on for voice activity. + message VoiceActivityTimeout { + // Duration to timeout the stream if no speech begins. If this is set and + // no speech is detected in this duration at the start of the stream, the + // server will close the stream. + google.protobuf.Duration speech_start_timeout = 1; + + // Duration to timeout the stream after speech ends. If this is set and no + // speech is detected in this duration after speech was detected, the server + // will close the stream. + google.protobuf.Duration speech_end_timeout = 2; + } + + // If `true`, responses with voice activity speech events will be returned as + // they are detected. + bool enable_voice_activity_events = 1; + + // Whether or not to stream interim results to the client. If set to true, + // interim results will be streamed to the client. Otherwise, only the final + // response will be streamed back. + bool interim_results = 2; + + // If set, the server will automatically close the stream after the specified + // duration has elapsed after the last VOICE_ACTIVITY speech event has been + // sent. The field `voice_activity_events` must also be set to true. + VoiceActivityTimeout voice_activity_timeout = 3; +} + +// Provides configuration information for the StreamingRecognize request. +message StreamingRecognitionConfig { + // Required. Features and audio metadata to use for the Automatic Speech + // Recognition. This field in combination with the + // [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask] + // field can be used to override parts of the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the Recognizer resource. + RecognitionConfig config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields in + // [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that + // override the values in the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the recognizer during this recognition request. If no mask is provided, + // all non-default valued fields in + // [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override + // the values in the recognizer for this recognition request. If a mask is + // provided, only the fields listed in the mask override the config in the + // recognizer for this recognition request. If a wildcard (`*`) is provided, + // [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] + // completely overrides and replaces the config in the recognizer for this + // recognition request. + google.protobuf.FieldMask config_mask = 3; + + // Speech recognition features to enable specific to streaming audio + // recognition requests. + StreamingRecognitionFeatures streaming_features = 2; +} + +// Request message for the +// [StreamingRecognize][google.cloud.speech.v2.Speech.StreamingRecognize] +// method. Multiple +// [StreamingRecognizeRequest][google.cloud.speech.v2.StreamingRecognizeRequest] +// messages are sent. The first message must contain a +// [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer] and +// optionally a +// [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config] +// message and must not contain +// [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio]. All +// subsequent messages must contain +// [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio] and must not +// contain a +// [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config] +// message. +message StreamingRecognizeRequest { + // Required. Streaming recognition should start with an initial request having + // a `recognizer`. Subsequent requests carry the audio data to be recognized. + // + // The initial request with configuration can be omitted if the Recognizer + // being used has a + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]. + string recognizer = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/Recognizer" + } + ]; + + oneof streaming_request { + // StreamingRecognitionConfig to be used in this recognition attempt. + // If provided, it will override the default RecognitionConfig stored in the + // Recognizer. + StreamingRecognitionConfig streaming_config = 6; + + // Inline audio bytes to be Recognized. + bytes audio = 5; + } +} + +// Request message for the +// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize] +// method. +message BatchRecognizeRequest { + // Required. Resource name of the recognizer to be used for ASR. + string recognizer = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/Recognizer" + } + ]; + + // Features and audio metadata to use for the Automatic Speech Recognition. + // This field in combination with the + // [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] + // field can be used to override parts of the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the Recognizer resource. + RecognitionConfig config = 4; + + // The list of fields in + // [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override + // the values in the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the recognizer during this recognition request. If no mask is provided, + // all given fields in + // [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the + // values in the recognizer for this recognition request. If a mask is + // provided, only the fields listed in the mask override the config in the + // recognizer for this recognition request. If a wildcard (`*`) is provided, + // [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely + // overrides and replaces the config in the recognizer for this recognition + // request. + google.protobuf.FieldMask config_mask = 5; + + // Audio files with file metadata for ASR. + repeated BatchRecognizeFileMetadata files = 3; +} + +// Response message for +// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize] that is +// packaged into a longrunning [Operation][google.longrunning.Operation]. +message BatchRecognizeResponse { + // Map from filename to the final result for that file. + map results = 1; +} + +// Final results for a single file. +message BatchRecognizeFileResult { + // The GCS URI to which recognition results were written. + string uri = 1; + + // Error if one was encountered. + google.rpc.Status error = 2; +} + +// Metadata about transcription for a single file (for example, progress +// percent). +message BatchRecognizeTranscriptionMetadata { + // How much of the file has been transcribed so far. + int32 progress_percent = 1; + + // Error if one was encountered. + google.rpc.Status error = 2; + + // The GCS URI to which recognition results will be written. + string uri = 3; +} + +// Operation metadata for +// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]. +message BatchRecognizeMetadata { + // Map from provided filename to the transcription metadata for that file. + map transcription_metadata = 1; +} + +// Metadata about a single file in a batch for BatchRecognize. +message BatchRecognizeFileMetadata { + // The audio source, which is a Google Cloud Storage URI. + oneof audio_source { + // Cloud Storage URI for the audio file. + string uri = 1; + } + + // Features and audio metadata to use for the Automatic Speech Recognition. + // This field in combination with the + // [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask] + // field can be used to override parts of the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the Recognizer resource as well as the + // [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the + // request level. + RecognitionConfig config = 4; + + // The list of fields in + // [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that + // override the values in the + // [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] + // of the recognizer during this recognition request. If no mask is provided, + // all non-default valued fields in + // [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override + // the values in the recognizer for this recognition request. If a mask is + // provided, only the fields listed in the mask override the config in the + // recognizer for this recognition request. If a wildcard (`*`) is provided, + // [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] + // completely overrides and replaces the config in the recognizer for this + // recognition request. + google.protobuf.FieldMask config_mask = 5; +} + +// A streaming speech recognition result corresponding to a portion of the audio +// that is currently being processed. +message StreamingRecognitionResult { + // May contain one or more recognition hypotheses. These alternatives are + // ordered in terms of accuracy, with the top (first) alternative being the + // most probable, as ranked by the recognizer. + repeated SpeechRecognitionAlternative alternatives = 1; + + // If `false`, this + // [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult] + // represents an interim result that may change. If `true`, this is the final + // time the speech service will return this particular + // [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult], + // the recognizer will not return any further hypotheses for this portion of + // the transcript and corresponding audio. + bool is_final = 2; + + // An estimate of the likelihood that the recognizer will not change its guess + // about this interim result. Values range from 0.0 (completely unstable) + // to 1.0 (completely stable). This field is only provided for interim results + // ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`). + // The default of 0.0 is a sentinel value indicating `stability` was not set. + float stability = 3; + + // Time offset of the end of this result relative to the beginning of the + // audio. + google.protobuf.Duration result_end_offset = 4; + + // For multi-channel audio, this is the channel number corresponding to the + // recognized result for the audio from that channel. + // For + // `audio_channel_count` = `N`, its output values can range from `1` to `N`. + int32 channel_tag = 5; + + // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag of the language in this result. This language code was + // detected to have the most likelihood of being spoken in the audio. + string language_code = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// `StreamingRecognizeResponse` is the only message returned to the client by +// `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse` +// messages are streamed back to the client. If there is no recognizable +// audio then no messages are streamed back to the client. +// +// Here are some examples of `StreamingRecognizeResponse`s that might +// be returned while processing audio: +// +// 1. results { alternatives { transcript: "tube" } stability: 0.01 } +// +// 2. results { alternatives { transcript: "to be a" } stability: 0.01 } +// +// 3. results { alternatives { transcript: "to be" } stability: 0.9 } +// results { alternatives { transcript: " or not to be" } stability: 0.01 } +// +// 4. results { alternatives { transcript: "to be or not to be" +// confidence: 0.92 } +// alternatives { transcript: "to bee or not to bee" } +// is_final: true } +// +// 5. results { alternatives { transcript: " that's" } stability: 0.01 } +// +// 6. results { alternatives { transcript: " that is" } stability: 0.9 } +// results { alternatives { transcript: " the question" } stability: 0.01 } +// +// 7. results { alternatives { transcript: " that is the question" +// confidence: 0.98 } +// alternatives { transcript: " that was the question" } +// is_final: true } +// +// Notes: +// +// - Only two of the above responses #4 and #7 contain final results; they are +// indicated by `is_final: true`. Concatenating these together generates the +// full transcript: "to be or not to be that is the question". +// +// - The others contain interim `results`. #3 and #6 contain two interim +// `results`: the first portion has a high stability and is less likely to +// change; the second portion has a low stability and is very likely to +// change. A UI designer might choose to show only high stability `results`. +// +// - The specific `stability` and `confidence` values shown above are only for +// illustrative purposes. Actual values may vary. +// +// - In each response, only one of these fields will be set: +// `error`, +// `speech_event_type`, or +// one or more (repeated) `results`. +message StreamingRecognizeResponse { + // Indicates the type of speech event. + enum SpeechEventType { + // No speech event specified. + SPEECH_EVENT_TYPE_UNSPECIFIED = 0; + + // This event indicates that the server has detected the end of the user's + // speech utterance and expects no additional speech. Therefore, the server + // will not process additional audio and will close the gRPC bidirectional + // stream. This event is only sent if there was a force cutoff due to + // silence being detected early. This event is only available through the + // `latest_short` [model][google.cloud.speech.v2.Recognizer.model]. + END_OF_SINGLE_UTTERANCE = 1; + + // This event indicates that the server has detected the beginning of human + // voice activity in the stream. This event can be returned multiple times + // if speech starts and stops repeatedly throughout the stream. This event + // is only sent if `voice_activity_events` is set to true. + SPEECH_ACTIVITY_BEGIN = 2; + + // This event indicates that the server has detected the end of human voice + // activity in the stream. This event can be returned multiple times if + // speech starts and stops repeatedly throughout the stream. This event is + // only sent if `voice_activity_events` is set to true. + SPEECH_ACTIVITY_END = 3; + } + + // This repeated list contains zero or more results that + // correspond to consecutive portions of the audio currently being processed. + // It contains zero or one + // [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true` + // result (the newly settled portion), followed by zero or more + // [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false` + // results (the interim results). + repeated StreamingRecognitionResult results = 6; + + // Indicates the type of speech event. + SpeechEventType speech_event_type = 3; + + // Time offset between the beginning of the audio and event emission. + google.protobuf.Duration speech_event_offset = 7; + + // Metadata about the recognition. + RecognitionResponseMetadata metadata = 5; +} + +// Message representing the config for the Speech-to-Text API. This includes an +// optional [KMS key](https://cloud.google.com/kms/docs/resource-hierarchy#keys) +// with which incoming data will be encrypted. +message Config { + option (google.api.resource) = { + type: "speech.googleapis.com/Config" + pattern: "projects/{project}/locations/{location}/config" + }; + + // Output only. The name of the config resource. There is exactly one config + // resource per project per location. The expected format is + // `projects/{project}/locations/{location}/config`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. An optional [KMS key + // name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if + // present, will be used to encrypt Speech-to-Text resources at-rest. Updating + // this key will not encrypt existing resources using this key; only new + // resources will be encrypted using this key. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Output only. The most recent time this resource was modified. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for the +// [GetConfig][google.cloud.speech.v2.Speech.GetConfig] method. +message GetConfigRequest { + // Required. The name of the config to retrieve. There is exactly one config + // resource per project per location. The expected format is + // `projects/{project}/locations/{location}/config`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "speech.googleapis.com/Config" } + ]; +} + +// Request message for the +// [UpdateConfig][google.cloud.speech.v2.Speech.UpdateConfig] method. +message UpdateConfigRequest { + // Required. The config to update. + // + // The config's `name` field is used to identify the config to be updated. + // The expected format is `projects/{project}/locations/{location}/config`. + Config config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// CustomClass for biasing in speech recognition. Used to define a set of words +// or phrases that represents a common concept or theme likely to appear in your +// audio, for example a list of passenger ship names. +message CustomClass { + option (google.api.resource) = { + type: "speech.googleapis.com/CustomClass" + pattern: "projects/{project}/locations/{location}/customClasses/{custom_class}" + style: DECLARATIVE_FRIENDLY + }; + + // An item of the class. + message ClassItem { + // The class item's value. + string value = 1; + } + + // Set of states that define the lifecycle of a CustomClass. + enum State { + // Unspecified state. This is only used/useful for distinguishing + // unset values. + STATE_UNSPECIFIED = 0; + + // The normal and active state. + ACTIVE = 2; + + // This CustomClass has been deleted. + DELETED = 4; + } + + // Output only. The resource name of the CustomClass. + // Format: + // `projects/{project}/locations/{location}/customClasses/{custom_class}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. System-assigned unique identifier for the CustomClass. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-settable, human-readable name for the CustomClass. Must be 63 + // characters or less. + string display_name = 4; + + // A collection of class items. + repeated ClassItem items = 5; + + // Output only. The CustomClass lifecycle state. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time this resource was modified. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this resource was requested for deletion. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this resource will be purged. + google.protobuf.Timestamp expire_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows users to store small amounts of arbitrary data. + // Both the key and the value must be 63 characters or less each. + // At most 100 annotations. + map annotations = 10; + + // Output only. This checksum is computed by the server based on the value of + // other fields. This may be sent on update, undelete, and delete requests to + // ensure the client has an up-to-date value before proceeding. + string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether or not this CustomClass is in the process of being + // updated. + bool reconciling = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [KMS key + // name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which + // the CustomClass is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 13 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Output only. The [KMS key version + // name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions) + // with which the CustomClass is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`. + string kms_key_version_name = 14 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// PhraseSet for biasing in speech recognition. A PhraseSet is used to provide +// "hints" to the speech recognizer to favor specific words and phrases in the +// results. +message PhraseSet { + option (google.api.resource) = { + type: "speech.googleapis.com/PhraseSet" + pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" + style: DECLARATIVE_FRIENDLY + }; + + // A Phrase contains words and phrase "hints" so that the speech recognition + // is more likely to recognize them. This can be used to improve the accuracy + // for specific words and phrases, for example, if specific commands are + // typically spoken by the user. This can also be used to add additional words + // to the vocabulary of the recognizer. + // + // List items can also include CustomClass references containing groups of + // words that represent common concepts that occur in natural language. + message Phrase { + // The phrase itself. + string value = 1; + + // Hint Boost. Overrides the boost set at the phrase set level. + // Positive value will increase the probability that a specific phrase will + // be recognized over other similar sounding phrases. The higher the boost, + // the higher the chance of false positive recognition as well. Negative + // boost values would correspond to anti-biasing. Anti-biasing is not + // enabled, so negative boost will simply be ignored. Though `boost` can + // accept a wide range of positive values, most use cases are best served + // with values between 0 and 20. We recommend using a binary search approach + // to finding the optimal value for your use case. Speech recognition + // will skip PhraseSets with a boost value of 0. + float boost = 2; + } + + // Set of states that define the lifecycle of a PhraseSet. + enum State { + // Unspecified state. This is only used/useful for distinguishing + // unset values. + STATE_UNSPECIFIED = 0; + + // The normal and active state. + ACTIVE = 2; + + // This PhraseSet has been deleted. + DELETED = 4; + } + + // Output only. The resource name of the PhraseSet. + // Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. System-assigned unique identifier for the PhraseSet. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A list of word and phrases. + repeated Phrase phrases = 3; + + // Hint Boost. Positive value will increase the probability that a specific + // phrase will be recognized over other similar sounding phrases. The higher + // the boost, the higher the chance of false positive recognition as well. + // Valid `boost` values are between 0 (exclusive) and 20. We recommend using a + // binary search approach to finding the optimal value for your use case. + float boost = 4; + + // User-settable, human-readable name for the PhraseSet. Must be 63 + // characters or less. + string display_name = 5; + + // Output only. The PhraseSet lifecycle state. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Creation time. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time this resource was modified. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this resource was requested for deletion. + google.protobuf.Timestamp delete_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this resource will be purged. + google.protobuf.Timestamp expire_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows users to store small amounts of arbitrary data. + // Both the key and the value must be 63 characters or less each. + // At most 100 annotations. + map annotations = 10; + + // Output only. This checksum is computed by the server based on the value of + // other fields. This may be sent on update, undelete, and delete requests to + // ensure the client has an up-to-date value before proceeding. + string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether or not this PhraseSet is in the process of being + // updated. + bool reconciling = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [KMS key + // name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which + // the PhraseSet is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + string kms_key_name = 13 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Output only. The [KMS key version + // name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions) + // with which the PhraseSet is encrypted. The expected format is + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`. + string kms_key_version_name = 14 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for the +// [CreateCustomClass][google.cloud.speech.v2.Speech.CreateCustomClass] method. +message CreateCustomClassRequest { + // Required. The CustomClass to create. + CustomClass custom_class = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the CustomClass, but do not + // actually create it. + bool validate_only = 2; + + // The ID to use for the CustomClass, which will become the final component of + // the CustomClass's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string custom_class_id = 3; + + // Required. The project and location where this CustomClass will be created. + // The expected format is `projects/{project}/locations/{location}`. + string parent = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "speech.googleapis.com/CustomClass" + } + ]; +} + +// Request message for the +// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method. +message ListCustomClassesRequest { + // Required. The project and location of CustomClass resources to list. The + // expected format is `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Number of results per requests. A valid page_size ranges from 0 to 20 + // inclusive. If the page_size is zero or unspecified, a page size of 5 will + // be chosen. If the page size exceeds 20, it will be coerced down to 20. Note + // that a call might return fewer results than the requested page size. + int32 page_size = 2; + + // A page token, received from a previous + // [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must + // match the call that provided the page token. + string page_token = 3; + + // Whether, or not, to show resources that have been deleted. + bool show_deleted = 4; +} + +// Response message for the +// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method. +message ListCustomClassesResponse { + // The list of requested CustomClasses. + repeated CustomClass custom_classes = 1; + + // A token, which can be sent as + // [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to + // retrieve the next page. If this field is omitted, there are no subsequent + // pages. This token expires after 72 hours. + string next_page_token = 2; +} + +// Request message for the +// [GetCustomClass][google.cloud.speech.v2.Speech.GetCustomClass] method. +message GetCustomClassRequest { + // Required. The name of the CustomClass to retrieve. The expected format is + // `projects/{project}/locations/{location}/customClasses/{custom_class}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/CustomClass" + } + ]; +} + +// Request message for the +// [UpdateCustomClass][google.cloud.speech.v2.Speech.UpdateCustomClass] method. +message UpdateCustomClassRequest { + // Required. The CustomClass to update. + // + // The CustomClass's `name` field is used to identify the CustomClass to + // update. Format: + // `projects/{project}/locations/{location}/customClasses/{custom_class}`. + CustomClass custom_class = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If empty, all fields are considered for + // update. + google.protobuf.FieldMask update_mask = 2; + + // If set, validate the request and preview the updated CustomClass, but do + // not actually update it. + bool validate_only = 4; +} + +// Request message for the +// [DeleteCustomClass][google.cloud.speech.v2.Speech.DeleteCustomClass] method. +message DeleteCustomClassRequest { + // Required. The name of the CustomClass to delete. + // Format: + // `projects/{project}/locations/{location}/customClasses/{custom_class}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/CustomClass" + } + ]; + + // If set, validate the request and preview the deleted CustomClass, but do + // not actually delete it. + bool validate_only = 2; + + // If set to true, and the CustomClass is not found, the request will succeed + // and be a no-op (no Operation is recorded in this case). + bool allow_missing = 4; + + // This checksum is computed by the server based on the value of other + // fields. This may be sent on update, undelete, and delete requests to ensure + // the client has an up-to-date value before proceeding. + string etag = 3; +} + +// Request message for the +// [UndeleteCustomClass][google.cloud.speech.v2.Speech.UndeleteCustomClass] +// method. +message UndeleteCustomClassRequest { + // Required. The name of the CustomClass to undelete. + // Format: + // `projects/{project}/locations/{location}/customClasses/{custom_class}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/CustomClass" + } + ]; + + // If set, validate the request and preview the undeleted CustomClass, but do + // not actually undelete it. + bool validate_only = 3; + + // This checksum is computed by the server based on the value of other + // fields. This may be sent on update, undelete, and delete requests to ensure + // the client has an up-to-date value before proceeding. + string etag = 4; +} + +// Request message for the +// [CreatePhraseSet][google.cloud.speech.v2.Speech.CreatePhraseSet] method. +message CreatePhraseSetRequest { + // Required. The PhraseSet to create. + PhraseSet phrase_set = 1 [(google.api.field_behavior) = REQUIRED]; + + // If set, validate the request and preview the PhraseSet, but do not + // actually create it. + bool validate_only = 2; + + // The ID to use for the PhraseSet, which will become the final component of + // the PhraseSet's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string phrase_set_id = 3; + + // Required. The project and location where this PhraseSet will be created. + // The expected format is `projects/{project}/locations/{location}`. + string parent = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "speech.googleapis.com/PhraseSet" + } + ]; +} + +// Request message for the +// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method. +message ListPhraseSetsRequest { + // Required. The project and location of PhraseSet resources to list. The + // expected format is `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of PhraseSets to return. The service may return fewer + // than this value. If unspecified, at most 20 PhraseSets will be returned. + // The maximum value is 20; values above 20 will be coerced to 20. + int32 page_size = 2; + + // A page token, received from a previous + // [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match + // the call that provided the page token. + string page_token = 3; + + // Whether, or not, to show resources that have been deleted. + bool show_deleted = 4; +} + +// Response message for the +// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method. +message ListPhraseSetsResponse { + // The list of requested PhraseSets. + repeated PhraseSet phrase_sets = 1; + + // A token, which can be sent as + // [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to + // retrieve the next page. If this field is omitted, there are no subsequent + // pages. This token expires after 72 hours. + string next_page_token = 2; +} + +// Request message for the +// [GetPhraseSet][google.cloud.speech.v2.Speech.GetPhraseSet] method. +message GetPhraseSetRequest { + // Required. The name of the PhraseSet to retrieve. The expected format is + // `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/PhraseSet" + } + ]; +} + +// Request message for the +// [UpdatePhraseSet][google.cloud.speech.v2.Speech.UpdatePhraseSet] method. +message UpdatePhraseSetRequest { + // Required. The PhraseSet to update. + // + // The PhraseSet's `name` field is used to identify the PhraseSet to update. + // Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. + PhraseSet phrase_set = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to update. If empty, all non-default valued fields are + // considered for update. Use `*` to update the entire PhraseSet resource. + google.protobuf.FieldMask update_mask = 2; + + // If set, validate the request and preview the updated PhraseSet, but do not + // actually update it. + bool validate_only = 4; +} + +// Request message for the +// [DeletePhraseSet][google.cloud.speech.v2.Speech.DeletePhraseSet] method. +message DeletePhraseSetRequest { + // Required. The name of the PhraseSet to delete. + // Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/PhraseSet" + } + ]; + + // If set, validate the request and preview the deleted PhraseSet, but do not + // actually delete it. + bool validate_only = 2; + + // If set to true, and the PhraseSet is not found, the request will succeed + // and be a no-op (no Operation is recorded in this case). + bool allow_missing = 4; + + // This checksum is computed by the server based on the value of other + // fields. This may be sent on update, undelete, and delete requests to ensure + // the client has an up-to-date value before proceeding. + string etag = 3; +} + +// Request message for the +// [UndeletePhraseSet][google.cloud.speech.v2.Speech.UndeletePhraseSet] +// method. +message UndeletePhraseSetRequest { + // Required. The name of the PhraseSet to undelete. + // Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "speech.googleapis.com/PhraseSet" + } + ]; + + // If set, validate the request and preview the undeleted PhraseSet, but do + // not actually undelete it. + bool validate_only = 3; + + // This checksum is computed by the server based on the value of other + // fields. This may be sent on update, undelete, and delete requests to ensure + // the client has an up-to-date value before proceeding. + string etag = 4; +} diff --git a/java-speech/renovate.json b/java-speech/renovate.json new file mode 100644 index 000000000000..3f3ad25c023c --- /dev/null +++ b/java-speech/renovate.json @@ -0,0 +1,74 @@ +{ + "extends": [ + ":separateMajorReleases", + ":combinePatchMinorReleases", + ":ignoreUnstable", + ":prImmediately", + ":updateNotScheduled", + ":automergeDisabled", + ":ignoreModulesAndTests", + ":maintainLockFilesDisabled", + ":autodetectPinVersions" + ], + "packageRules": [ + { + "packagePatterns": [ + "^com.google.guava:" + ], + "versionScheme": "docker" + }, + { + "packagePatterns": [ + "*" + ], + "semanticCommitType": "deps", + "semanticCommitScope": null + }, + { + "packagePatterns": [ + "^org.apache.maven", + "^org.jacoco:", + "^org.codehaus.mojo:", + "^org.sonatype.plugins:", + "^com.coveo:", + "^com.google.cloud:google-cloud-shared-config" + ], + "semanticCommitType": "build", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-speech", + "^com.google.cloud:libraries-bom", + "^com.google.cloud.samples:shared-configuration" + ], + "semanticCommitType": "chore", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^junit:junit", + "^com.google.truth:truth", + "^org.mockito:mockito-core", + "^org.objenesis:objenesis", + "^com.google.cloud:google-cloud-conformance-tests" + ], + "semanticCommitType": "test", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-" + ], + "ignoreUnstable": false + }, + { + "packagePatterns": [ + "^com.fasterxml.jackson.core" + ], + "groupName": "jackson dependencies" + } + ], + "semanticCommits": true, + "dependencyDashboard": true +} diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognize.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognize.java new file mode 100644 index 000000000000..4f2f1bca20a5 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognize.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_batchrecognize_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.BatchRecognizeFileMetadata; +import com.google.cloud.speech.v2.BatchRecognizeRequest; +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncBatchRecognize { + + public static void main(String[] args) throws Exception { + asyncBatchRecognize(); + } + + public static void asyncBatchRecognize() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + BatchRecognizeRequest request = + BatchRecognizeRequest.newBuilder() + .setRecognizer( + RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setConfig(RecognitionConfig.newBuilder().build()) + .setConfigMask(FieldMask.newBuilder().build()) + .addAllFiles(new ArrayList()) + .build(); + ApiFuture future = speechClient.batchRecognizeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_batchrecognize_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognizeLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognizeLRO.java new file mode 100644 index 000000000000..f879b820711c --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/AsyncBatchRecognizeLRO.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_batchrecognize_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.BatchRecognizeFileMetadata; +import com.google.cloud.speech.v2.BatchRecognizeRequest; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncBatchRecognizeLRO { + + public static void main(String[] args) throws Exception { + asyncBatchRecognizeLRO(); + } + + public static void asyncBatchRecognizeLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + BatchRecognizeRequest request = + BatchRecognizeRequest.newBuilder() + .setRecognizer( + RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setConfig(RecognitionConfig.newBuilder().build()) + .setConfigMask(FieldMask.newBuilder().build()) + .addAllFiles(new ArrayList()) + .build(); + OperationFuture future = + speechClient.batchRecognizeOperationCallable().futureCall(request); + // Do something. + BatchRecognizeResponse response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_batchrecognize_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognize.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognize.java new file mode 100644 index 000000000000..c1aff957c713 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognize.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_batchrecognize_sync] +import com.google.cloud.speech.v2.BatchRecognizeFileMetadata; +import com.google.cloud.speech.v2.BatchRecognizeRequest; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncBatchRecognize { + + public static void main(String[] args) throws Exception { + syncBatchRecognize(); + } + + public static void syncBatchRecognize() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + BatchRecognizeRequest request = + BatchRecognizeRequest.newBuilder() + .setRecognizer( + RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setConfig(RecognitionConfig.newBuilder().build()) + .setConfigMask(FieldMask.newBuilder().build()) + .addAllFiles(new ArrayList()) + .build(); + BatchRecognizeResponse response = speechClient.batchRecognizeAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_batchrecognize_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeRecognizernameRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeRecognizernameRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java new file mode 100644 index 000000000000..10d4b024d46e --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeRecognizernameRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_batchrecognize_recognizernamerecognitionconfigfieldmasklistbatchrecognizefilemetadata_sync] +import com.google.cloud.speech.v2.BatchRecognizeFileMetadata; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; +import java.util.List; + +public +class SyncBatchRecognizeRecognizernameRecognitionconfigFieldmaskListbatchrecognizefilemetadata { + + public static void main(String[] args) throws Exception { + syncBatchRecognizeRecognizernameRecognitionconfigFieldmaskListbatchrecognizefilemetadata(); + } + + public static void + syncBatchRecognizeRecognizernameRecognitionconfigFieldmaskListbatchrecognizefilemetadata() + throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + BatchRecognizeResponse response = + speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get(); + } + } +} +// [END speech_v2_generated_speechclient_batchrecognize_recognizernamerecognitionconfigfieldmasklistbatchrecognizefilemetadata_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeStringRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeStringRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java new file mode 100644 index 000000000000..ef74b76451bf --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/batchrecognize/SyncBatchRecognizeStringRecognitionconfigFieldmaskListbatchrecognizefilemetadata.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_batchrecognize_stringrecognitionconfigfieldmasklistbatchrecognizefilemetadata_sync] +import com.google.cloud.speech.v2.BatchRecognizeFileMetadata; +import com.google.cloud.speech.v2.BatchRecognizeResponse; +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchRecognizeStringRecognitionconfigFieldmaskListbatchrecognizefilemetadata { + + public static void main(String[] args) throws Exception { + syncBatchRecognizeStringRecognitionconfigFieldmaskListbatchrecognizefilemetadata(); + } + + public static void + syncBatchRecognizeStringRecognitionconfigFieldmaskListbatchrecognizefilemetadata() + throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString(); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + List files = new ArrayList<>(); + BatchRecognizeResponse response = + speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get(); + } + } +} +// [END speech_v2_generated_speechclient_batchrecognize_stringrecognitionconfigfieldmasklistbatchrecognizefilemetadata_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..4d7b1fc08509 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.SpeechSettings; +import com.google.cloud.speech.v2.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SpeechSettings speechSettings = + SpeechSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SpeechClient speechClient = SpeechClient.create(speechSettings); + } +} +// [END speech_v2_generated_speechclient_create_setcredentialsprovider_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider1.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..c4f1cf6a5758 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_create_setcredentialsprovider1_sync] +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.SpeechSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SpeechSettings speechSettings = + SpeechSettings.newBuilder() + .setTransportChannelProvider( + SpeechSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + SpeechClient speechClient = SpeechClient.create(speechSettings); + } +} +// [END speech_v2_generated_speechclient_create_setcredentialsprovider1_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetEndpoint.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..9f6c2cd5e53d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_create_setendpoint_sync] +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.SpeechSettings; +import com.google.cloud.speech.v2.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SpeechSettings speechSettings = SpeechSettings.newBuilder().setEndpoint(myEndpoint).build(); + SpeechClient speechClient = SpeechClient.create(speechSettings); + } +} +// [END speech_v2_generated_speechclient_create_setendpoint_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClass.java new file mode 100644 index 000000000000..f963eea4882e --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClass.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createcustomclass_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CreateCustomClassRequest; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.longrunning.Operation; + +public class AsyncCreateCustomClass { + + public static void main(String[] args) throws Exception { + asyncCreateCustomClass(); + } + + public static void asyncCreateCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreateCustomClassRequest request = + CreateCustomClassRequest.newBuilder() + .setCustomClass(CustomClass.newBuilder().build()) + .setValidateOnly(true) + .setCustomClassId("customClassId1871032322") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = speechClient.createCustomClassCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_createcustomclass_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClassLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClassLRO.java new file mode 100644 index 000000000000..b53c3f468130 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/AsyncCreateCustomClassLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createcustomclass_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.CreateCustomClassRequest; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncCreateCustomClassLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCustomClassLRO(); + } + + public static void asyncCreateCustomClassLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreateCustomClassRequest request = + CreateCustomClassRequest.newBuilder() + .setCustomClass(CustomClass.newBuilder().build()) + .setValidateOnly(true) + .setCustomClassId("customClassId1871032322") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + OperationFuture future = + speechClient.createCustomClassOperationCallable().futureCall(request); + // Do something. + CustomClass response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_createcustomclass_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClass.java new file mode 100644 index 000000000000..ee6756d9c20b --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClass.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createcustomclass_sync] +import com.google.cloud.speech.v2.CreateCustomClassRequest; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreateCustomClass { + + public static void main(String[] args) throws Exception { + syncCreateCustomClass(); + } + + public static void syncCreateCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreateCustomClassRequest request = + CreateCustomClassRequest.newBuilder() + .setCustomClass(CustomClass.newBuilder().build()) + .setValidateOnly(true) + .setCustomClassId("customClassId1871032322") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + CustomClass response = speechClient.createCustomClassAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_createcustomclass_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassLocationnameCustomclassString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassLocationnameCustomclassString.java new file mode 100644 index 000000000000..be114848b4c2 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassLocationnameCustomclassString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createcustomclass_locationnamecustomclassstring_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreateCustomClassLocationnameCustomclassString { + + public static void main(String[] args) throws Exception { + syncCreateCustomClassLocationnameCustomclassString(); + } + + public static void syncCreateCustomClassLocationnameCustomclassString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + CustomClass response = + speechClient.createCustomClassAsync(parent, customClass, customClassId).get(); + } + } +} +// [END speech_v2_generated_speechclient_createcustomclass_locationnamecustomclassstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassStringCustomclassString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassStringCustomclassString.java new file mode 100644 index 000000000000..31a6523d9ea3 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createcustomclass/SyncCreateCustomClassStringCustomclassString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createcustomclass_stringcustomclassstring_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreateCustomClassStringCustomclassString { + + public static void main(String[] args) throws Exception { + syncCreateCustomClassStringCustomclassString(); + } + + public static void syncCreateCustomClassStringCustomclassString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CustomClass customClass = CustomClass.newBuilder().build(); + String customClassId = "customClassId1871032322"; + CustomClass response = + speechClient.createCustomClassAsync(parent, customClass, customClassId).get(); + } + } +} +// [END speech_v2_generated_speechclient_createcustomclass_stringcustomclassstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSet.java new file mode 100644 index 000000000000..f480e96494a9 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSet.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createphraseset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CreatePhraseSetRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.longrunning.Operation; + +public class AsyncCreatePhraseSet { + + public static void main(String[] args) throws Exception { + asyncCreatePhraseSet(); + } + + public static void asyncCreatePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreatePhraseSetRequest request = + CreatePhraseSetRequest.newBuilder() + .setPhraseSet(PhraseSet.newBuilder().build()) + .setValidateOnly(true) + .setPhraseSetId("phraseSetId959902180") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = speechClient.createPhraseSetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_createphraseset_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSetLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSetLRO.java new file mode 100644 index 000000000000..5bdf18360ff3 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/AsyncCreatePhraseSetLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createphraseset_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.CreatePhraseSetRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncCreatePhraseSetLRO { + + public static void main(String[] args) throws Exception { + asyncCreatePhraseSetLRO(); + } + + public static void asyncCreatePhraseSetLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreatePhraseSetRequest request = + CreatePhraseSetRequest.newBuilder() + .setPhraseSet(PhraseSet.newBuilder().build()) + .setValidateOnly(true) + .setPhraseSetId("phraseSetId959902180") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + OperationFuture future = + speechClient.createPhraseSetOperationCallable().futureCall(request); + // Do something. + PhraseSet response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_createphraseset_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSet.java new file mode 100644 index 000000000000..342a4f7bf1ee --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSet.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createphraseset_sync] +import com.google.cloud.speech.v2.CreatePhraseSetRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreatePhraseSet { + + public static void main(String[] args) throws Exception { + syncCreatePhraseSet(); + } + + public static void syncCreatePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreatePhraseSetRequest request = + CreatePhraseSetRequest.newBuilder() + .setPhraseSet(PhraseSet.newBuilder().build()) + .setValidateOnly(true) + .setPhraseSetId("phraseSetId959902180") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + PhraseSet response = speechClient.createPhraseSetAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_createphraseset_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetLocationnamePhrasesetString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetLocationnamePhrasesetString.java new file mode 100644 index 000000000000..72427e1c6103 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetLocationnamePhrasesetString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createphraseset_locationnamephrasesetstring_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreatePhraseSetLocationnamePhrasesetString { + + public static void main(String[] args) throws Exception { + syncCreatePhraseSetLocationnamePhrasesetString(); + } + + public static void syncCreatePhraseSetLocationnamePhrasesetString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + } + } +} +// [END speech_v2_generated_speechclient_createphraseset_locationnamephrasesetstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetStringPhrasesetString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetStringPhrasesetString.java new file mode 100644 index 000000000000..fde45612c7cf --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createphraseset/SyncCreatePhraseSetStringPhrasesetString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createphraseset_stringphrasesetstring_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreatePhraseSetStringPhrasesetString { + + public static void main(String[] args) throws Exception { + syncCreatePhraseSetStringPhrasesetString(); + } + + public static void syncCreatePhraseSetStringPhrasesetString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + String phraseSetId = "phraseSetId959902180"; + PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get(); + } + } +} +// [END speech_v2_generated_speechclient_createphraseset_stringphrasesetstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizer.java new file mode 100644 index 000000000000..de2abddc86db --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizer.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createrecognizer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CreateRecognizerRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.longrunning.Operation; + +public class AsyncCreateRecognizer { + + public static void main(String[] args) throws Exception { + asyncCreateRecognizer(); + } + + public static void asyncCreateRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreateRecognizerRequest request = + CreateRecognizerRequest.newBuilder() + .setRecognizer(Recognizer.newBuilder().build()) + .setValidateOnly(true) + .setRecognizerId("recognizerId771963359") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = speechClient.createRecognizerCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_createrecognizer_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizerLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizerLRO.java new file mode 100644 index 000000000000..0f02656055db --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/AsyncCreateRecognizerLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createrecognizer_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.CreateRecognizerRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncCreateRecognizerLRO { + + public static void main(String[] args) throws Exception { + asyncCreateRecognizerLRO(); + } + + public static void asyncCreateRecognizerLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreateRecognizerRequest request = + CreateRecognizerRequest.newBuilder() + .setRecognizer(Recognizer.newBuilder().build()) + .setValidateOnly(true) + .setRecognizerId("recognizerId771963359") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + OperationFuture future = + speechClient.createRecognizerOperationCallable().futureCall(request); + // Do something. + Recognizer response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_createrecognizer_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizer.java new file mode 100644 index 000000000000..9afa726831bd --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizer.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createrecognizer_sync] +import com.google.cloud.speech.v2.CreateRecognizerRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreateRecognizer { + + public static void main(String[] args) throws Exception { + syncCreateRecognizer(); + } + + public static void syncCreateRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CreateRecognizerRequest request = + CreateRecognizerRequest.newBuilder() + .setRecognizer(Recognizer.newBuilder().build()) + .setValidateOnly(true) + .setRecognizerId("recognizerId771963359") + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + Recognizer response = speechClient.createRecognizerAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_createrecognizer_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerLocationnameRecognizerString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerLocationnameRecognizerString.java new file mode 100644 index 000000000000..1cf85630355c --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerLocationnameRecognizerString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createrecognizer_locationnamerecognizerstring_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreateRecognizerLocationnameRecognizerString { + + public static void main(String[] args) throws Exception { + syncCreateRecognizerLocationnameRecognizerString(); + } + + public static void syncCreateRecognizerLocationnameRecognizerString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + Recognizer response = + speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get(); + } + } +} +// [END speech_v2_generated_speechclient_createrecognizer_locationnamerecognizerstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerStringRecognizerString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerStringRecognizerString.java new file mode 100644 index 000000000000..a2a3b63821f7 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/createrecognizer/SyncCreateRecognizerStringRecognizerString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_createrecognizer_stringrecognizerstring_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncCreateRecognizerStringRecognizerString { + + public static void main(String[] args) throws Exception { + syncCreateRecognizerStringRecognizerString(); + } + + public static void syncCreateRecognizerStringRecognizerString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Recognizer recognizer = Recognizer.newBuilder().build(); + String recognizerId = "recognizerId771963359"; + Recognizer response = + speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get(); + } + } +} +// [END speech_v2_generated_speechclient_createrecognizer_stringrecognizerstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClass.java new file mode 100644 index 000000000000..7e02db06ced6 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClass.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletecustomclass_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.DeleteCustomClassRequest; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteCustomClass { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomClass(); + } + + public static void asyncDeleteCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeleteCustomClassRequest request = + DeleteCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = speechClient.deleteCustomClassCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_deletecustomclass_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClassLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClassLRO.java new file mode 100644 index 000000000000..2bf77b3d6976 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/AsyncDeleteCustomClassLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletecustomclass_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.DeleteCustomClassRequest; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncDeleteCustomClassLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCustomClassLRO(); + } + + public static void asyncDeleteCustomClassLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeleteCustomClassRequest request = + DeleteCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + speechClient.deleteCustomClassOperationCallable().futureCall(request); + // Do something. + CustomClass response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_deletecustomclass_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClass.java new file mode 100644 index 000000000000..d386e79abded --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClass.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletecustomclass_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.DeleteCustomClassRequest; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeleteCustomClass { + + public static void main(String[] args) throws Exception { + syncDeleteCustomClass(); + } + + public static void syncDeleteCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeleteCustomClassRequest request = + DeleteCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + CustomClass response = speechClient.deleteCustomClassAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_deletecustomclass_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassCustomclassname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassCustomclassname.java new file mode 100644 index 000000000000..88e2349ae6c8 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassCustomclassname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletecustomclass_customclassname_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeleteCustomClassCustomclassname { + + public static void main(String[] args) throws Exception { + syncDeleteCustomClassCustomclassname(); + } + + public static void syncDeleteCustomClassCustomclassname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + CustomClass response = speechClient.deleteCustomClassAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_deletecustomclass_customclassname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassString.java new file mode 100644 index 000000000000..33acc907fd4c --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletecustomclass/SyncDeleteCustomClassString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletecustomclass_string_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeleteCustomClassString { + + public static void main(String[] args) throws Exception { + syncDeleteCustomClassString(); + } + + public static void syncDeleteCustomClassString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString(); + CustomClass response = speechClient.deleteCustomClassAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_deletecustomclass_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSet.java new file mode 100644 index 000000000000..311b50c93fd2 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSet.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletephraseset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.DeletePhraseSetRequest; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.longrunning.Operation; + +public class AsyncDeletePhraseSet { + + public static void main(String[] args) throws Exception { + asyncDeletePhraseSet(); + } + + public static void asyncDeletePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeletePhraseSetRequest request = + DeletePhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = speechClient.deletePhraseSetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_deletephraseset_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSetLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSetLRO.java new file mode 100644 index 000000000000..04af1e9d970f --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/AsyncDeletePhraseSetLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletephraseset_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.DeletePhraseSetRequest; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncDeletePhraseSetLRO { + + public static void main(String[] args) throws Exception { + asyncDeletePhraseSetLRO(); + } + + public static void asyncDeletePhraseSetLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeletePhraseSetRequest request = + DeletePhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + speechClient.deletePhraseSetOperationCallable().futureCall(request); + // Do something. + PhraseSet response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_deletephraseset_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSet.java new file mode 100644 index 000000000000..060f6aaccabd --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSet.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletephraseset_sync] +import com.google.cloud.speech.v2.DeletePhraseSetRequest; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeletePhraseSet { + + public static void main(String[] args) throws Exception { + syncDeletePhraseSet(); + } + + public static void syncDeletePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeletePhraseSetRequest request = + DeletePhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + PhraseSet response = speechClient.deletePhraseSetAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_deletephraseset_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetPhrasesetname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetPhrasesetname.java new file mode 100644 index 000000000000..6cd453c627e4 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetPhrasesetname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletephraseset_phrasesetname_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeletePhraseSetPhrasesetname { + + public static void main(String[] args) throws Exception { + syncDeletePhraseSetPhrasesetname(); + } + + public static void syncDeletePhraseSetPhrasesetname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + PhraseSet response = speechClient.deletePhraseSetAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_deletephraseset_phrasesetname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetString.java new file mode 100644 index 000000000000..fed29050f857 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deletephraseset/SyncDeletePhraseSetString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deletephraseset_string_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeletePhraseSetString { + + public static void main(String[] args) throws Exception { + syncDeletePhraseSetString(); + } + + public static void syncDeletePhraseSetString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString(); + PhraseSet response = speechClient.deletePhraseSetAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_deletephraseset_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizer.java new file mode 100644 index 000000000000..6e7f86d12b0d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizer.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deleterecognizer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.DeleteRecognizerRequest; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteRecognizer { + + public static void main(String[] args) throws Exception { + asyncDeleteRecognizer(); + } + + public static void asyncDeleteRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeleteRecognizerRequest request = + DeleteRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = speechClient.deleteRecognizerCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_deleterecognizer_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizerLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizerLRO.java new file mode 100644 index 000000000000..2992dd6a399f --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/AsyncDeleteRecognizerLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deleterecognizer_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.DeleteRecognizerRequest; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncDeleteRecognizerLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteRecognizerLRO(); + } + + public static void asyncDeleteRecognizerLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeleteRecognizerRequest request = + DeleteRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + speechClient.deleteRecognizerOperationCallable().futureCall(request); + // Do something. + Recognizer response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_deleterecognizer_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizer.java new file mode 100644 index 000000000000..8ff8481b6b29 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizer.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deleterecognizer_sync] +import com.google.cloud.speech.v2.DeleteRecognizerRequest; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeleteRecognizer { + + public static void main(String[] args) throws Exception { + syncDeleteRecognizer(); + } + + public static void syncDeleteRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + DeleteRecognizerRequest request = + DeleteRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setValidateOnly(true) + .setAllowMissing(true) + .setEtag("etag3123477") + .build(); + Recognizer response = speechClient.deleteRecognizerAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_deleterecognizer_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerRecognizername.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerRecognizername.java new file mode 100644 index 000000000000..e0cfd01d5b86 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerRecognizername.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deleterecognizer_recognizername_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeleteRecognizerRecognizername { + + public static void main(String[] args) throws Exception { + syncDeleteRecognizerRecognizername(); + } + + public static void syncDeleteRecognizerRecognizername() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + Recognizer response = speechClient.deleteRecognizerAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_deleterecognizer_recognizername_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerString.java new file mode 100644 index 000000000000..aef0235775a7 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/deleterecognizer/SyncDeleteRecognizerString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_deleterecognizer_string_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncDeleteRecognizerString { + + public static void main(String[] args) throws Exception { + syncDeleteRecognizerString(); + } + + public static void syncDeleteRecognizerString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString(); + Recognizer response = speechClient.deleteRecognizerAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_deleterecognizer_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/AsyncGetConfig.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/AsyncGetConfig.java new file mode 100644 index 000000000000..5dad9983b6f8 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/AsyncGetConfig.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.ConfigName; +import com.google.cloud.speech.v2.GetConfigRequest; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncGetConfig { + + public static void main(String[] args) throws Exception { + asyncGetConfig(); + } + + public static void asyncGetConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetConfigRequest request = + GetConfigRequest.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = speechClient.getConfigCallable().futureCall(request); + // Do something. + Config response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_getconfig_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfig.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfig.java new file mode 100644 index 000000000000..abfb3c222c27 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getconfig_sync] +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.ConfigName; +import com.google.cloud.speech.v2.GetConfigRequest; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetConfig { + + public static void main(String[] args) throws Exception { + syncGetConfig(); + } + + public static void syncGetConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetConfigRequest request = + GetConfigRequest.newBuilder() + .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + Config response = speechClient.getConfig(request); + } + } +} +// [END speech_v2_generated_speechclient_getconfig_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigConfigname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigConfigname.java new file mode 100644 index 000000000000..5620217537a8 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigConfigname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getconfig_configname_sync] +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.ConfigName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetConfigConfigname { + + public static void main(String[] args) throws Exception { + syncGetConfigConfigname(); + } + + public static void syncGetConfigConfigname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]"); + Config response = speechClient.getConfig(name); + } + } +} +// [END speech_v2_generated_speechclient_getconfig_configname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigString.java new file mode 100644 index 000000000000..f34915948319 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getconfig/SyncGetConfigString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getconfig_string_sync] +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.ConfigName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetConfigString { + + public static void main(String[] args) throws Exception { + syncGetConfigString(); + } + + public static void syncGetConfigString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = ConfigName.of("[PROJECT]", "[LOCATION]").toString(); + Config response = speechClient.getConfig(name); + } + } +} +// [END speech_v2_generated_speechclient_getconfig_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/AsyncGetCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/AsyncGetCustomClass.java new file mode 100644 index 000000000000..6515208685a1 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/AsyncGetCustomClass.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getcustomclass_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.GetCustomClassRequest; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncGetCustomClass { + + public static void main(String[] args) throws Exception { + asyncGetCustomClass(); + } + + public static void asyncGetCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetCustomClassRequest request = + GetCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .build(); + ApiFuture future = speechClient.getCustomClassCallable().futureCall(request); + // Do something. + CustomClass response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_getcustomclass_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClass.java new file mode 100644 index 000000000000..c6d0c43c1510 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClass.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getcustomclass_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.GetCustomClassRequest; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetCustomClass { + + public static void main(String[] args) throws Exception { + syncGetCustomClass(); + } + + public static void syncGetCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetCustomClassRequest request = + GetCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .build(); + CustomClass response = speechClient.getCustomClass(request); + } + } +} +// [END speech_v2_generated_speechclient_getcustomclass_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassCustomclassname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassCustomclassname.java new file mode 100644 index 000000000000..5aa0ff5f6231 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassCustomclassname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getcustomclass_customclassname_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetCustomClassCustomclassname { + + public static void main(String[] args) throws Exception { + syncGetCustomClassCustomclassname(); + } + + public static void syncGetCustomClassCustomclassname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + CustomClass response = speechClient.getCustomClass(name); + } + } +} +// [END speech_v2_generated_speechclient_getcustomclass_customclassname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassString.java new file mode 100644 index 000000000000..1c3fb54c4750 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getcustomclass/SyncGetCustomClassString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getcustomclass_string_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetCustomClassString { + + public static void main(String[] args) throws Exception { + syncGetCustomClassString(); + } + + public static void syncGetCustomClassString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString(); + CustomClass response = speechClient.getCustomClass(name); + } + } +} +// [END speech_v2_generated_speechclient_getcustomclass_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/AsyncGetPhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/AsyncGetPhraseSet.java new file mode 100644 index 000000000000..21ccd7ffe4da --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/AsyncGetPhraseSet.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getphraseset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.GetPhraseSetRequest; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncGetPhraseSet { + + public static void main(String[] args) throws Exception { + asyncGetPhraseSet(); + } + + public static void asyncGetPhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetPhraseSetRequest request = + GetPhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .build(); + ApiFuture future = speechClient.getPhraseSetCallable().futureCall(request); + // Do something. + PhraseSet response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_getphraseset_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSet.java new file mode 100644 index 000000000000..c9c4f529bd90 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSet.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getphraseset_sync] +import com.google.cloud.speech.v2.GetPhraseSetRequest; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetPhraseSet { + + public static void main(String[] args) throws Exception { + syncGetPhraseSet(); + } + + public static void syncGetPhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetPhraseSetRequest request = + GetPhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .build(); + PhraseSet response = speechClient.getPhraseSet(request); + } + } +} +// [END speech_v2_generated_speechclient_getphraseset_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetPhrasesetname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetPhrasesetname.java new file mode 100644 index 000000000000..45bc74748aa6 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetPhrasesetname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getphraseset_phrasesetname_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetPhraseSetPhrasesetname { + + public static void main(String[] args) throws Exception { + syncGetPhraseSetPhrasesetname(); + } + + public static void syncGetPhraseSetPhrasesetname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + PhraseSet response = speechClient.getPhraseSet(name); + } + } +} +// [END speech_v2_generated_speechclient_getphraseset_phrasesetname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetString.java new file mode 100644 index 000000000000..222c075ea5bd --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getphraseset/SyncGetPhraseSetString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getphraseset_string_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetPhraseSetString { + + public static void main(String[] args) throws Exception { + syncGetPhraseSetString(); + } + + public static void syncGetPhraseSetString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString(); + PhraseSet response = speechClient.getPhraseSet(name); + } + } +} +// [END speech_v2_generated_speechclient_getphraseset_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/AsyncGetRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/AsyncGetRecognizer.java new file mode 100644 index 000000000000..4672da86f089 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/AsyncGetRecognizer.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getrecognizer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.GetRecognizerRequest; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncGetRecognizer { + + public static void main(String[] args) throws Exception { + asyncGetRecognizer(); + } + + public static void asyncGetRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetRecognizerRequest request = + GetRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .build(); + ApiFuture future = speechClient.getRecognizerCallable().futureCall(request); + // Do something. + Recognizer response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_getrecognizer_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizer.java new file mode 100644 index 000000000000..cab68d697474 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizer.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getrecognizer_sync] +import com.google.cloud.speech.v2.GetRecognizerRequest; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetRecognizer { + + public static void main(String[] args) throws Exception { + syncGetRecognizer(); + } + + public static void syncGetRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + GetRecognizerRequest request = + GetRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .build(); + Recognizer response = speechClient.getRecognizer(request); + } + } +} +// [END speech_v2_generated_speechclient_getrecognizer_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerRecognizername.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerRecognizername.java new file mode 100644 index 000000000000..596cd33535d0 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerRecognizername.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getrecognizer_recognizername_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetRecognizerRecognizername { + + public static void main(String[] args) throws Exception { + syncGetRecognizerRecognizername(); + } + + public static void syncGetRecognizerRecognizername() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + Recognizer response = speechClient.getRecognizer(name); + } + } +} +// [END speech_v2_generated_speechclient_getrecognizer_recognizername_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerString.java new file mode 100644 index 000000000000..8ac8eafb8abc --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/getrecognizer/SyncGetRecognizerString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_getrecognizer_string_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncGetRecognizerString { + + public static void main(String[] args) throws Exception { + syncGetRecognizerString(); + } + + public static void syncGetRecognizerString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString(); + Recognizer response = speechClient.getRecognizer(name); + } + } +} +// [END speech_v2_generated_speechclient_getrecognizer_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClasses.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClasses.java new file mode 100644 index 000000000000..3d224641acdb --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClasses.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listcustomclasses_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.ListCustomClassesRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncListCustomClasses { + + public static void main(String[] args) throws Exception { + asyncListCustomClasses(); + } + + public static void asyncListCustomClasses() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListCustomClassesRequest request = + ListCustomClassesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + ApiFuture future = + speechClient.listCustomClassesPagedCallable().futureCall(request); + // Do something. + for (CustomClass element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listcustomclasses_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClassesPaged.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClassesPaged.java new file mode 100644 index 000000000000..bd0a6f8e1d9f --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/AsyncListCustomClassesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listcustomclasses_paged_async] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.ListCustomClassesRequest; +import com.google.cloud.speech.v2.ListCustomClassesResponse; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.common.base.Strings; + +public class AsyncListCustomClassesPaged { + + public static void main(String[] args) throws Exception { + asyncListCustomClassesPaged(); + } + + public static void asyncListCustomClassesPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListCustomClassesRequest request = + ListCustomClassesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + while (true) { + ListCustomClassesResponse response = speechClient.listCustomClassesCallable().call(request); + for (CustomClass element : response.getCustomClassesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END speech_v2_generated_speechclient_listcustomclasses_paged_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClasses.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClasses.java new file mode 100644 index 000000000000..a01b794f9bd6 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClasses.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listcustomclasses_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.ListCustomClassesRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListCustomClasses { + + public static void main(String[] args) throws Exception { + syncListCustomClasses(); + } + + public static void syncListCustomClasses() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListCustomClassesRequest request = + ListCustomClassesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + for (CustomClass element : speechClient.listCustomClasses(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listcustomclasses_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesLocationname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesLocationname.java new file mode 100644 index 000000000000..8058b3d459ce --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listcustomclasses_locationname_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListCustomClassesLocationname { + + public static void main(String[] args) throws Exception { + syncListCustomClassesLocationname(); + } + + public static void syncListCustomClassesLocationname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listcustomclasses_locationname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesString.java new file mode 100644 index 000000000000..cd0e226395fb --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listcustomclasses/SyncListCustomClassesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listcustomclasses_string_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListCustomClassesString { + + public static void main(String[] args) throws Exception { + syncListCustomClassesString(); + } + + public static void syncListCustomClassesString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listcustomclasses_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSets.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSets.java new file mode 100644 index 000000000000..9589a8434681 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSets.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listphrasesets_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.ListPhraseSetsRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncListPhraseSets { + + public static void main(String[] args) throws Exception { + asyncListPhraseSets(); + } + + public static void asyncListPhraseSets() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListPhraseSetsRequest request = + ListPhraseSetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + ApiFuture future = speechClient.listPhraseSetsPagedCallable().futureCall(request); + // Do something. + for (PhraseSet element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listphrasesets_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSetsPaged.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSetsPaged.java new file mode 100644 index 000000000000..1a04576732b0 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/AsyncListPhraseSetsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listphrasesets_paged_async] +import com.google.cloud.speech.v2.ListPhraseSetsRequest; +import com.google.cloud.speech.v2.ListPhraseSetsResponse; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.common.base.Strings; + +public class AsyncListPhraseSetsPaged { + + public static void main(String[] args) throws Exception { + asyncListPhraseSetsPaged(); + } + + public static void asyncListPhraseSetsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListPhraseSetsRequest request = + ListPhraseSetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + while (true) { + ListPhraseSetsResponse response = speechClient.listPhraseSetsCallable().call(request); + for (PhraseSet element : response.getPhraseSetsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END speech_v2_generated_speechclient_listphrasesets_paged_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSets.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSets.java new file mode 100644 index 000000000000..2c8de2851c9d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSets.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listphrasesets_sync] +import com.google.cloud.speech.v2.ListPhraseSetsRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListPhraseSets { + + public static void main(String[] args) throws Exception { + syncListPhraseSets(); + } + + public static void syncListPhraseSets() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListPhraseSetsRequest request = + ListPhraseSetsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + for (PhraseSet element : speechClient.listPhraseSets(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listphrasesets_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsLocationname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsLocationname.java new file mode 100644 index 000000000000..b7b0a4663c1b --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listphrasesets_locationname_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListPhraseSetsLocationname { + + public static void main(String[] args) throws Exception { + syncListPhraseSetsLocationname(); + } + + public static void syncListPhraseSetsLocationname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listphrasesets_locationname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsString.java new file mode 100644 index 000000000000..57e59cef6aa9 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listphrasesets/SyncListPhraseSetsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listphrasesets_string_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListPhraseSetsString { + + public static void main(String[] args) throws Exception { + syncListPhraseSetsString(); + } + + public static void syncListPhraseSetsString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listphrasesets_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizers.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizers.java new file mode 100644 index 000000000000..ada6c93afd5a --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizers.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listrecognizers_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.ListRecognizersRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class AsyncListRecognizers { + + public static void main(String[] args) throws Exception { + asyncListRecognizers(); + } + + public static void asyncListRecognizers() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListRecognizersRequest request = + ListRecognizersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + ApiFuture future = + speechClient.listRecognizersPagedCallable().futureCall(request); + // Do something. + for (Recognizer element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listrecognizers_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizersPaged.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizersPaged.java new file mode 100644 index 000000000000..3a84cac02b3f --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/AsyncListRecognizersPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listrecognizers_paged_async] +import com.google.cloud.speech.v2.ListRecognizersRequest; +import com.google.cloud.speech.v2.ListRecognizersResponse; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.common.base.Strings; + +public class AsyncListRecognizersPaged { + + public static void main(String[] args) throws Exception { + asyncListRecognizersPaged(); + } + + public static void asyncListRecognizersPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListRecognizersRequest request = + ListRecognizersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + while (true) { + ListRecognizersResponse response = speechClient.listRecognizersCallable().call(request); + for (Recognizer element : response.getRecognizersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END speech_v2_generated_speechclient_listrecognizers_paged_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizers.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizers.java new file mode 100644 index 000000000000..692fbff89930 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizers.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listrecognizers_sync] +import com.google.cloud.speech.v2.ListRecognizersRequest; +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListRecognizers { + + public static void main(String[] args) throws Exception { + syncListRecognizers(); + } + + public static void syncListRecognizers() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + ListRecognizersRequest request = + ListRecognizersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + for (Recognizer element : speechClient.listRecognizers(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listrecognizers_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersLocationname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersLocationname.java new file mode 100644 index 000000000000..3026a1d50a91 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listrecognizers_locationname_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListRecognizersLocationname { + + public static void main(String[] args) throws Exception { + syncListRecognizersLocationname(); + } + + public static void syncListRecognizersLocationname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listrecognizers_locationname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersString.java new file mode 100644 index 000000000000..3f53a899c7d9 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/listrecognizers/SyncListRecognizersString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_listrecognizers_string_sync] +import com.google.cloud.speech.v2.LocationName; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncListRecognizersString { + + public static void main(String[] args) throws Exception { + syncListRecognizersString(); + } + + public static void syncListRecognizersString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END speech_v2_generated_speechclient_listrecognizers_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/AsyncRecognize.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/AsyncRecognize.java new file mode 100644 index 000000000000..dafd1857aa6d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/AsyncRecognize.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_recognize_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizeRequest; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class AsyncRecognize { + + public static void main(String[] args) throws Exception { + asyncRecognize(); + } + + public static void asyncRecognize() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizeRequest request = + RecognizeRequest.newBuilder() + .setRecognizer( + RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setConfig(RecognitionConfig.newBuilder().build()) + .setConfigMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = speechClient.recognizeCallable().futureCall(request); + // Do something. + RecognizeResponse response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_recognize_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognize.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognize.java new file mode 100644 index 000000000000..e69335eb02ca --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognize.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_recognize_sync] +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizeRequest; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class SyncRecognize { + + public static void main(String[] args) throws Exception { + syncRecognize(); + } + + public static void syncRecognize() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizeRequest request = + RecognizeRequest.newBuilder() + .setRecognizer( + RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setConfig(RecognitionConfig.newBuilder().build()) + .setConfigMask(FieldMask.newBuilder().build()) + .build(); + RecognizeResponse response = speechClient.recognize(request); + } + } +} +// [END speech_v2_generated_speechclient_recognize_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskBytestring.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskBytestring.java new file mode 100644 index 000000000000..da40ff086009 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskBytestring.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_recognize_recognizernamerecognitionconfigfieldmaskbytestring_sync] +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.ByteString; +import com.google.protobuf.FieldMask; + +public class SyncRecognizeRecognizernameRecognitionconfigFieldmaskBytestring { + + public static void main(String[] args) throws Exception { + syncRecognizeRecognizernameRecognitionconfigFieldmaskBytestring(); + } + + public static void syncRecognizeRecognizernameRecognitionconfigFieldmaskBytestring() + throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content); + } + } +} +// [END speech_v2_generated_speechclient_recognize_recognizernamerecognitionconfigfieldmaskbytestring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskString.java new file mode 100644 index 000000000000..5ba847e59090 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeRecognizernameRecognitionconfigFieldmaskString.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_recognize_recognizernamerecognitionconfigfieldmaskstring_sync] +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class SyncRecognizeRecognizernameRecognitionconfigFieldmaskString { + + public static void main(String[] args) throws Exception { + syncRecognizeRecognizernameRecognitionconfigFieldmaskString(); + } + + public static void syncRecognizeRecognizernameRecognitionconfigFieldmaskString() + throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri); + } + } +} +// [END speech_v2_generated_speechclient_recognize_recognizernamerecognitionconfigfieldmaskstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskBytestring.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskBytestring.java new file mode 100644 index 000000000000..140daf6ca98b --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskBytestring.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_recognize_stringrecognitionconfigfieldmaskbytestring_sync] +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.ByteString; +import com.google.protobuf.FieldMask; + +public class SyncRecognizeStringRecognitionconfigFieldmaskBytestring { + + public static void main(String[] args) throws Exception { + syncRecognizeStringRecognitionconfigFieldmaskBytestring(); + } + + public static void syncRecognizeStringRecognitionconfigFieldmaskBytestring() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString(); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + ByteString content = ByteString.EMPTY; + RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content); + } + } +} +// [END speech_v2_generated_speechclient_recognize_stringrecognitionconfigfieldmaskbytestring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskString.java new file mode 100644 index 000000000000..4766e769a257 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/recognize/SyncRecognizeStringRecognitionconfigFieldmaskString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_recognize_stringrecognitionconfigfieldmaskstring_sync] +import com.google.cloud.speech.v2.RecognitionConfig; +import com.google.cloud.speech.v2.RecognizeResponse; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class SyncRecognizeStringRecognitionconfigFieldmaskString { + + public static void main(String[] args) throws Exception { + syncRecognizeStringRecognitionconfigFieldmaskString(); + } + + public static void syncRecognizeStringRecognitionconfigFieldmaskString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString(); + RecognitionConfig config = RecognitionConfig.newBuilder().build(); + FieldMask configMask = FieldMask.newBuilder().build(); + String uri = "uri116076"; + RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri); + } + } +} +// [END speech_v2_generated_speechclient_recognize_stringrecognitionconfigfieldmaskstring_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/streamingrecognize/AsyncStreamingRecognize.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/streamingrecognize/AsyncStreamingRecognize.java new file mode 100644 index 000000000000..b76d8db5df08 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/streamingrecognize/AsyncStreamingRecognize.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_streamingrecognize_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.StreamingRecognizeRequest; +import com.google.cloud.speech.v2.StreamingRecognizeResponse; + +public class AsyncStreamingRecognize { + + public static void main(String[] args) throws Exception { + asyncStreamingRecognize(); + } + + public static void asyncStreamingRecognize() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + BidiStream bidiStream = + speechClient.streamingRecognizeCallable().call(); + StreamingRecognizeRequest request = + StreamingRecognizeRequest.newBuilder() + .setRecognizer( + RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .build(); + bidiStream.send(request); + for (StreamingRecognizeResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END speech_v2_generated_speechclient_streamingrecognize_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClass.java new file mode 100644 index 000000000000..6db8720412de --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClass.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletecustomclass_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeleteCustomClassRequest; +import com.google.longrunning.Operation; + +public class AsyncUndeleteCustomClass { + + public static void main(String[] args) throws Exception { + asyncUndeleteCustomClass(); + } + + public static void asyncUndeleteCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeleteCustomClassRequest request = + UndeleteCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = speechClient.undeleteCustomClassCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletecustomclass_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClassLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClassLRO.java new file mode 100644 index 000000000000..b7cd20e2ca68 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/AsyncUndeleteCustomClassLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletecustomclass_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeleteCustomClassRequest; + +public class AsyncUndeleteCustomClassLRO { + + public static void main(String[] args) throws Exception { + asyncUndeleteCustomClassLRO(); + } + + public static void asyncUndeleteCustomClassLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeleteCustomClassRequest request = + UndeleteCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + speechClient.undeleteCustomClassOperationCallable().futureCall(request); + // Do something. + CustomClass response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletecustomclass_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClass.java new file mode 100644 index 000000000000..0acd321d0538 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClass.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletecustomclass_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeleteCustomClassRequest; + +public class SyncUndeleteCustomClass { + + public static void main(String[] args) throws Exception { + syncUndeleteCustomClass(); + } + + public static void syncUndeleteCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeleteCustomClassRequest request = + UndeleteCustomClassRequest.newBuilder() + .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + CustomClass response = speechClient.undeleteCustomClassAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletecustomclass_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassCustomclassname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassCustomclassname.java new file mode 100644 index 000000000000..1382324ea7d5 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassCustomclassname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletecustomclass_customclassname_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncUndeleteCustomClassCustomclassname { + + public static void main(String[] args) throws Exception { + syncUndeleteCustomClassCustomclassname(); + } + + public static void syncUndeleteCustomClassCustomclassname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); + CustomClass response = speechClient.undeleteCustomClassAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletecustomclass_customclassname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassString.java new file mode 100644 index 000000000000..d95fae3ab176 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletecustomclass/SyncUndeleteCustomClassString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletecustomclass_string_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.CustomClassName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncUndeleteCustomClassString { + + public static void main(String[] args) throws Exception { + syncUndeleteCustomClassString(); + } + + public static void syncUndeleteCustomClassString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString(); + CustomClass response = speechClient.undeleteCustomClassAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletecustomclass_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSet.java new file mode 100644 index 000000000000..70830c4dee84 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSet.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletephraseset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeletePhraseSetRequest; +import com.google.longrunning.Operation; + +public class AsyncUndeletePhraseSet { + + public static void main(String[] args) throws Exception { + asyncUndeletePhraseSet(); + } + + public static void asyncUndeletePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeletePhraseSetRequest request = + UndeletePhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = speechClient.undeletePhraseSetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletephraseset_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSetLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSetLRO.java new file mode 100644 index 000000000000..dcab3251142c --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/AsyncUndeletePhraseSetLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletephraseset_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeletePhraseSetRequest; + +public class AsyncUndeletePhraseSetLRO { + + public static void main(String[] args) throws Exception { + asyncUndeletePhraseSetLRO(); + } + + public static void asyncUndeletePhraseSetLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeletePhraseSetRequest request = + UndeletePhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + speechClient.undeletePhraseSetOperationCallable().futureCall(request); + // Do something. + PhraseSet response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletephraseset_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSet.java new file mode 100644 index 000000000000..4255720c80e0 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSet.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletephraseset_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeletePhraseSetRequest; + +public class SyncUndeletePhraseSet { + + public static void main(String[] args) throws Exception { + syncUndeletePhraseSet(); + } + + public static void syncUndeletePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeletePhraseSetRequest request = + UndeletePhraseSetRequest.newBuilder() + .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + PhraseSet response = speechClient.undeletePhraseSetAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletephraseset_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetPhrasesetname.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetPhrasesetname.java new file mode 100644 index 000000000000..f0fd26d80a45 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetPhrasesetname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletephraseset_phrasesetname_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncUndeletePhraseSetPhrasesetname { + + public static void main(String[] args) throws Exception { + syncUndeletePhraseSetPhrasesetname(); + } + + public static void syncUndeletePhraseSetPhrasesetname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); + PhraseSet response = speechClient.undeletePhraseSetAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletephraseset_phrasesetname_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetString.java new file mode 100644 index 000000000000..2fe5c947d57b --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeletephraseset/SyncUndeletePhraseSetString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeletephraseset_string_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.PhraseSetName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncUndeletePhraseSetString { + + public static void main(String[] args) throws Exception { + syncUndeletePhraseSetString(); + } + + public static void syncUndeletePhraseSetString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString(); + PhraseSet response = speechClient.undeletePhraseSetAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeletephraseset_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizer.java new file mode 100644 index 000000000000..9100bd536b58 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizer.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeleterecognizer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeleteRecognizerRequest; +import com.google.longrunning.Operation; + +public class AsyncUndeleteRecognizer { + + public static void main(String[] args) throws Exception { + asyncUndeleteRecognizer(); + } + + public static void asyncUndeleteRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeleteRecognizerRequest request = + UndeleteRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = speechClient.undeleteRecognizerCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_undeleterecognizer_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizerLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizerLRO.java new file mode 100644 index 000000000000..19c46e2836fb --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/AsyncUndeleteRecognizerLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeleterecognizer_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeleteRecognizerRequest; + +public class AsyncUndeleteRecognizerLRO { + + public static void main(String[] args) throws Exception { + asyncUndeleteRecognizerLRO(); + } + + public static void asyncUndeleteRecognizerLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeleteRecognizerRequest request = + UndeleteRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + speechClient.undeleteRecognizerOperationCallable().futureCall(request); + // Do something. + Recognizer response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_undeleterecognizer_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizer.java new file mode 100644 index 000000000000..cbca17973d0f --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizer.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeleterecognizer_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UndeleteRecognizerRequest; + +public class SyncUndeleteRecognizer { + + public static void main(String[] args) throws Exception { + syncUndeleteRecognizer(); + } + + public static void syncUndeleteRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UndeleteRecognizerRequest request = + UndeleteRecognizerRequest.newBuilder() + .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + Recognizer response = speechClient.undeleteRecognizerAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeleterecognizer_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerRecognizername.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerRecognizername.java new file mode 100644 index 000000000000..c742c469b56a --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerRecognizername.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeleterecognizer_recognizername_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncUndeleteRecognizerRecognizername { + + public static void main(String[] args) throws Exception { + syncUndeleteRecognizerRecognizername(); + } + + public static void syncUndeleteRecognizerRecognizername() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]"); + Recognizer response = speechClient.undeleteRecognizerAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeleterecognizer_recognizername_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerString.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerString.java new file mode 100644 index 000000000000..425b8e58e00c --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/undeleterecognizer/SyncUndeleteRecognizerString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_undeleterecognizer_string_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.RecognizerName; +import com.google.cloud.speech.v2.SpeechClient; + +public class SyncUndeleteRecognizerString { + + public static void main(String[] args) throws Exception { + syncUndeleteRecognizerString(); + } + + public static void syncUndeleteRecognizerString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString(); + Recognizer response = speechClient.undeleteRecognizerAsync(name).get(); + } + } +} +// [END speech_v2_generated_speechclient_undeleterecognizer_string_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/AsyncUpdateConfig.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/AsyncUpdateConfig.java new file mode 100644 index 000000000000..a7b5257dbcaa --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/AsyncUpdateConfig.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updateconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateConfigRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateConfig { + + public static void main(String[] args) throws Exception { + asyncUpdateConfig(); + } + + public static void asyncUpdateConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateConfigRequest request = + UpdateConfigRequest.newBuilder() + .setConfig(Config.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = speechClient.updateConfigCallable().futureCall(request); + // Do something. + Config response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_updateconfig_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfig.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfig.java new file mode 100644 index 000000000000..ba87bdb14602 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updateconfig_sync] +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateConfigRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConfig { + + public static void main(String[] args) throws Exception { + syncUpdateConfig(); + } + + public static void syncUpdateConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateConfigRequest request = + UpdateConfigRequest.newBuilder() + .setConfig(Config.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Config response = speechClient.updateConfig(request); + } + } +} +// [END speech_v2_generated_speechclient_updateconfig_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfigConfigFieldmask.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfigConfigFieldmask.java new file mode 100644 index 000000000000..0f38e88b6703 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updateconfig/SyncUpdateConfigConfigFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updateconfig_configfieldmask_sync] +import com.google.cloud.speech.v2.Config; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConfigConfigFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateConfigConfigFieldmask(); + } + + public static void syncUpdateConfigConfigFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + Config config = Config.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Config response = speechClient.updateConfig(config, updateMask); + } + } +} +// [END speech_v2_generated_speechclient_updateconfig_configfieldmask_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClass.java new file mode 100644 index 000000000000..4ac53b0c917d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClass.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatecustomclass_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateCustomClassRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCustomClass { + + public static void main(String[] args) throws Exception { + asyncUpdateCustomClass(); + } + + public static void asyncUpdateCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateCustomClassRequest request = + UpdateCustomClassRequest.newBuilder() + .setCustomClass(CustomClass.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = speechClient.updateCustomClassCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_updatecustomclass_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClassLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClassLRO.java new file mode 100644 index 000000000000..7cef5b02ebc5 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/AsyncUpdateCustomClassLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatecustomclass_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateCustomClassRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCustomClassLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCustomClassLRO(); + } + + public static void asyncUpdateCustomClassLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateCustomClassRequest request = + UpdateCustomClassRequest.newBuilder() + .setCustomClass(CustomClass.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + speechClient.updateCustomClassOperationCallable().futureCall(request); + // Do something. + CustomClass response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_updatecustomclass_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClass.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClass.java new file mode 100644 index 000000000000..6a6e0753e2ef --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClass.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatecustomclass_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateCustomClassRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCustomClass { + + public static void main(String[] args) throws Exception { + syncUpdateCustomClass(); + } + + public static void syncUpdateCustomClass() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateCustomClassRequest request = + UpdateCustomClassRequest.newBuilder() + .setCustomClass(CustomClass.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + CustomClass response = speechClient.updateCustomClassAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_updatecustomclass_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClassCustomclassFieldmask.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClassCustomclassFieldmask.java new file mode 100644 index 000000000000..1a289c693cd8 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatecustomclass/SyncUpdateCustomClassCustomclassFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatecustomclass_customclassfieldmask_sync] +import com.google.cloud.speech.v2.CustomClass; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCustomClassCustomclassFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCustomClassCustomclassFieldmask(); + } + + public static void syncUpdateCustomClassCustomclassFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + CustomClass customClass = CustomClass.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CustomClass response = speechClient.updateCustomClassAsync(customClass, updateMask).get(); + } + } +} +// [END speech_v2_generated_speechclient_updatecustomclass_customclassfieldmask_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSet.java new file mode 100644 index 000000000000..5549760e9823 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSet.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatephraseset_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdatePhraseSetRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdatePhraseSet { + + public static void main(String[] args) throws Exception { + asyncUpdatePhraseSet(); + } + + public static void asyncUpdatePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdatePhraseSetRequest request = + UpdatePhraseSetRequest.newBuilder() + .setPhraseSet(PhraseSet.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = speechClient.updatePhraseSetCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_updatephraseset_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSetLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSetLRO.java new file mode 100644 index 000000000000..b3d9d22b3c13 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/AsyncUpdatePhraseSetLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatephraseset_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdatePhraseSetRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdatePhraseSetLRO { + + public static void main(String[] args) throws Exception { + asyncUpdatePhraseSetLRO(); + } + + public static void asyncUpdatePhraseSetLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdatePhraseSetRequest request = + UpdatePhraseSetRequest.newBuilder() + .setPhraseSet(PhraseSet.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + speechClient.updatePhraseSetOperationCallable().futureCall(request); + // Do something. + PhraseSet response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_updatephraseset_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSet.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSet.java new file mode 100644 index 000000000000..2be39796ee0a --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSet.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatephraseset_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdatePhraseSetRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePhraseSet { + + public static void main(String[] args) throws Exception { + syncUpdatePhraseSet(); + } + + public static void syncUpdatePhraseSet() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdatePhraseSetRequest request = + UpdatePhraseSetRequest.newBuilder() + .setPhraseSet(PhraseSet.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + PhraseSet response = speechClient.updatePhraseSetAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_updatephraseset_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSetPhrasesetFieldmask.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSetPhrasesetFieldmask.java new file mode 100644 index 000000000000..65f34fdb736b --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updatephraseset/SyncUpdatePhraseSetPhrasesetFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updatephraseset_phrasesetfieldmask_sync] +import com.google.cloud.speech.v2.PhraseSet; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePhraseSetPhrasesetFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdatePhraseSetPhrasesetFieldmask(); + } + + public static void syncUpdatePhraseSetPhrasesetFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + PhraseSet phraseSet = PhraseSet.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + PhraseSet response = speechClient.updatePhraseSetAsync(phraseSet, updateMask).get(); + } + } +} +// [END speech_v2_generated_speechclient_updatephraseset_phrasesetfieldmask_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizer.java new file mode 100644 index 000000000000..356302b70e1d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizer.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updaterecognizer_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateRecognizerRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRecognizer { + + public static void main(String[] args) throws Exception { + asyncUpdateRecognizer(); + } + + public static void asyncUpdateRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateRecognizerRequest request = + UpdateRecognizerRequest.newBuilder() + .setRecognizer(Recognizer.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + ApiFuture future = speechClient.updateRecognizerCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_updaterecognizer_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizerLRO.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizerLRO.java new file mode 100644 index 000000000000..d75575020325 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/AsyncUpdateRecognizerLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updaterecognizer_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.speech.v2.OperationMetadata; +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateRecognizerRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateRecognizerLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateRecognizerLRO(); + } + + public static void asyncUpdateRecognizerLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateRecognizerRequest request = + UpdateRecognizerRequest.newBuilder() + .setRecognizer(Recognizer.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + OperationFuture future = + speechClient.updateRecognizerOperationCallable().futureCall(request); + // Do something. + Recognizer response = future.get(); + } + } +} +// [END speech_v2_generated_speechclient_updaterecognizer_lro_async] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizer.java new file mode 100644 index 000000000000..40d9a9b0e796 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizer.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updaterecognizer_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.cloud.speech.v2.UpdateRecognizerRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRecognizer { + + public static void main(String[] args) throws Exception { + syncUpdateRecognizer(); + } + + public static void syncUpdateRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + UpdateRecognizerRequest request = + UpdateRecognizerRequest.newBuilder() + .setRecognizer(Recognizer.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setValidateOnly(true) + .build(); + Recognizer response = speechClient.updateRecognizerAsync(request).get(); + } + } +} +// [END speech_v2_generated_speechclient_updaterecognizer_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizerRecognizerFieldmask.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizerRecognizerFieldmask.java new file mode 100644 index 000000000000..86f864d4fc12 --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechclient/updaterecognizer/SyncUpdateRecognizerRecognizerFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechclient_updaterecognizer_recognizerfieldmask_sync] +import com.google.cloud.speech.v2.Recognizer; +import com.google.cloud.speech.v2.SpeechClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateRecognizerRecognizerFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateRecognizerRecognizerFieldmask(); + } + + public static void syncUpdateRecognizerRecognizerFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SpeechClient speechClient = SpeechClient.create()) { + Recognizer recognizer = Recognizer.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Recognizer response = speechClient.updateRecognizerAsync(recognizer, updateMask).get(); + } + } +} +// [END speech_v2_generated_speechclient_updaterecognizer_recognizerfieldmask_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechsettings/getrecognizer/SyncGetRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechsettings/getrecognizer/SyncGetRecognizer.java new file mode 100644 index 000000000000..d70c3561f19d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/speechsettings/getrecognizer/SyncGetRecognizer.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.samples; + +// [START speech_v2_generated_speechsettings_getrecognizer_sync] +import com.google.cloud.speech.v2.SpeechSettings; +import java.time.Duration; + +public class SyncGetRecognizer { + + public static void main(String[] args) throws Exception { + syncGetRecognizer(); + } + + public static void syncGetRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SpeechSettings.Builder speechSettingsBuilder = SpeechSettings.newBuilder(); + speechSettingsBuilder + .getRecognizerSettings() + .setRetrySettings( + speechSettingsBuilder.getRecognizerSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpeechSettings speechSettings = speechSettingsBuilder.build(); + } +} +// [END speech_v2_generated_speechsettings_getrecognizer_sync] diff --git a/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/stub/speechstubsettings/getrecognizer/SyncGetRecognizer.java b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/stub/speechstubsettings/getrecognizer/SyncGetRecognizer.java new file mode 100644 index 000000000000..1a7eb8d4581d --- /dev/null +++ b/java-speech/samples/snippets/generated/com/google/cloud/speech/v2/stub/speechstubsettings/getrecognizer/SyncGetRecognizer.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v2.stub.samples; + +// [START speech_v2_generated_speechstubsettings_getrecognizer_sync] +import com.google.cloud.speech.v2.stub.SpeechStubSettings; +import java.time.Duration; + +public class SyncGetRecognizer { + + public static void main(String[] args) throws Exception { + syncGetRecognizer(); + } + + public static void syncGetRecognizer() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SpeechStubSettings.Builder speechSettingsBuilder = SpeechStubSettings.newBuilder(); + speechSettingsBuilder + .getRecognizerSettings() + .setRetrySettings( + speechSettingsBuilder.getRecognizerSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpeechStubSettings speechSettings = speechSettingsBuilder.build(); + } +} +// [END speech_v2_generated_speechstubsettings_getrecognizer_sync] diff --git a/java-speech/versions.txt b/java-speech/versions.txt index 270993a59298..d782df95ee52 100644 --- a/java-speech/versions.txt +++ b/java-speech/versions.txt @@ -8,3 +8,5 @@ grpc-google-cloud-speech-v1p1beta1:0.89.4:0.89.5-SNAPSHOT proto-google-cloud-speech-v1:2.5.4:2.5.5-SNAPSHOT proto-google-cloud-speech-v1beta1:0.89.4:0.89.5-SNAPSHOT proto-google-cloud-speech-v1p1beta1:0.89.4:0.89.5-SNAPSHOT +proto-google-cloud-speech-v2:2.5.4:2.5.5-SNAPSHOT +grpc-google-cloud-speech-v2:2.5.4:2.5.5-SNAPSHOT