From 9f2132301e032a5e408d9550a499512a1a6964d5 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Tue, 27 Aug 2019 15:51:03 -0400 Subject: [PATCH 01/28] ci: Fix reference to script to generate Javadoc index file --- .utility/push-javadoc-to-gh-pages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.utility/push-javadoc-to-gh-pages.sh b/.utility/push-javadoc-to-gh-pages.sh index f326da2e7c5..a6ce2f9e29c 100755 --- a/.utility/push-javadoc-to-gh-pages.sh +++ b/.utility/push-javadoc-to-gh-pages.sh @@ -11,7 +11,7 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" ]; then rm -rf docs/$TRAVIS_BRANCH mkdir -p docs/$TRAVIS_BRANCH cp -rf ../build/docs/all/* docs/$TRAVIS_BRANCH - generate-index-html.sh > index.html + ./generate-index-html.sh > index.html # update the latest/ symlink # on tagged builds, $TRAVIS_TAG is set to the tag, but it's blank on regular builds, unlike $TRAVIS_BRANCH From c44118e6766c0927c12a84f79c78197ae886b253 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Tue, 27 Aug 2019 16:42:26 -0400 Subject: [PATCH 02/28] feat: Regenerate all services other than Assistant v1 --- .../ibm/watson/assistant/v2/Assistant.java | 69 +-- .../assistant/v2/model/CaptureGroup.java | 117 +++- .../v2/model/CreateSessionOptions.java | 6 +- .../v2/model/DeleteSessionOptions.java | 9 +- .../assistant/v2/model/DialogLogMessage.java | 2 +- .../assistant/v2/model/DialogNodeAction.java | 24 +- .../model/DialogNodeOutputOptionsElement.java | 2 +- .../DialogNodeOutputOptionsElementValue.java | 2 +- .../v2/model/DialogNodesVisited.java | 2 +- .../assistant/v2/model/DialogSuggestion.java | 11 +- .../v2/model/DialogSuggestionValue.java | 2 +- .../assistant/v2/model/MessageContext.java | 88 ++- .../v2/model/MessageContextGlobal.java | 63 ++- .../v2/model/MessageContextGlobalSystem.java | 113 ++-- .../v2/model/MessageContextSkill.java | 68 ++- .../v2/model/MessageContextSkills.java | 3 +- .../assistant/v2/model/MessageInput.java | 9 +- .../v2/model/MessageInputOptions.java | 138 +++-- .../assistant/v2/model/MessageOptions.java | 9 +- .../assistant/v2/model/MessageOutput.java | 10 +- .../v2/model/MessageOutputDebug.java | 2 +- .../assistant/v2/model/MessageResponse.java | 2 +- .../assistant/v2/model/RuntimeEntity.java | 244 +++++--- .../assistant/v2/model/RuntimeIntent.java | 103 +++- ...neric.java => RuntimeResponseGeneric.java} | 123 +++-- .../assistant/v2/model/SearchResult.java | 2 +- .../v2/model/SearchResultHighlight.java | 2 +- .../v2/model/SearchResultMetadata.java | 2 +- .../assistant/v2/model/SessionResponse.java | 2 +- .../ibm/watson/assistant/v2/package-info.java | 2 +- .../compare_comply/v1/CompareComply.java | 115 ++-- .../v1/model/AddFeedbackOptions.java | 4 +- .../compare_comply/v1/model/Category.java | 104 +++- .../v1/model/ClassifyElementsOptions.java | 4 +- .../v1/model/CompareDocumentsOptions.java | 7 +- .../v1/model/ConvertToHtmlOptions.java | 36 +- .../v1/model/CreateBatchOptions.java | 22 +- .../v1/model/DeleteFeedbackOptions.java | 4 +- .../v1/model/ExtractTablesOptions.java | 4 +- .../v1/model/FeedbackDataInput.java | 264 ++++++--- .../v1/model/GetBatchOptions.java | 4 +- .../v1/model/GetFeedbackOptions.java | 4 +- .../watson/compare_comply/v1/model/Label.java | 101 +++- .../compare_comply/v1/model/Location.java | 101 +++- .../v1/model/OriginalLabelsIn.java | 136 ++++- .../compare_comply/v1/model/ShortDoc.java | 86 ++- .../compare_comply/v1/model/TypeLabel.java | 104 +++- .../v1/model/UpdateBatchOptions.java | 7 +- .../v1/model/UpdatedLabelsIn.java | 136 ++++- .../ibm/watson/discovery/v1/Discovery.java | 359 ++++++------ .../v1/model/AddDocumentOptions.java | 14 +- .../v1/model/AddTrainingDataOptions.java | 12 +- .../discovery/v1/model/AggregationResult.java | 2 +- .../discovery/v1/model/Calculation.java | 2 +- .../watson/discovery/v1/model/Collection.java | 2 +- .../v1/model/CollectionCrawlStatus.java | 2 +- .../v1/model/CollectionDiskUsage.java | 2 +- .../discovery/v1/model/CollectionUsage.java | 2 +- .../discovery/v1/model/Configuration.java | 282 +++++++--- .../discovery/v1/model/Conversions.java | 206 +++++-- .../v1/model/CreateCollectionOptions.java | 9 +- .../v1/model/CreateConfigurationOptions.java | 27 +- .../v1/model/CreateCredentialsOptions.java | 12 +- .../v1/model/CreateEnvironmentOptions.java | 6 +- .../v1/model/CreateEventOptions.java | 9 +- .../v1/model/CreateEventResponse.java | 2 +- .../v1/model/CreateExpansionsOptions.java | 17 +- .../v1/model/CreateGatewayOptions.java | 6 +- .../v1/model/CreateStopwordListOptions.java | 15 +- .../CreateTokenizationDictionaryOptions.java | 12 +- .../model/CreateTrainingExampleOptions.java | 18 +- .../discovery/v1/model/CredentialDetails.java | 521 +++++++++++------- .../discovery/v1/model/Credentials.java | 129 +++-- .../discovery/v1/model/CredentialsList.java | 2 +- .../model/DeleteAllTrainingDataOptions.java | 9 +- .../v1/model/DeleteCollectionOptions.java | 9 +- .../v1/model/DeleteCollectionResponse.java | 2 +- .../v1/model/DeleteConfigurationOptions.java | 9 +- .../v1/model/DeleteConfigurationResponse.java | 2 +- .../discovery/v1/model/DeleteCredentials.java | 2 +- .../v1/model/DeleteCredentialsOptions.java | 9 +- .../v1/model/DeleteDocumentOptions.java | 12 +- .../v1/model/DeleteDocumentResponse.java | 2 +- .../v1/model/DeleteEnvironmentOptions.java | 6 +- .../v1/model/DeleteEnvironmentResponse.java | 2 +- .../v1/model/DeleteExpansionsOptions.java | 9 +- .../v1/model/DeleteGatewayOptions.java | 9 +- .../v1/model/DeleteStopwordListOptions.java | 9 +- .../DeleteTokenizationDictionaryOptions.java | 9 +- .../v1/model/DeleteTrainingDataOptions.java | 12 +- .../model/DeleteTrainingExampleOptions.java | 15 +- .../v1/model/DeleteUserDataOptions.java | 6 +- .../watson/discovery/v1/model/DiskUsage.java | 2 +- .../discovery/v1/model/DocumentAccepted.java | 2 +- .../discovery/v1/model/DocumentCounts.java | 2 +- .../discovery/v1/model/DocumentSnapshot.java | 11 +- .../discovery/v1/model/DocumentStatus.java | 2 +- .../watson/discovery/v1/model/Enrichment.java | 244 +++++--- .../discovery/v1/model/EnrichmentOptions.java | 2 +- .../discovery/v1/model/Environment.java | 2 +- .../v1/model/EnvironmentDocuments.java | 2 +- .../watson/discovery/v1/model/EventData.java | 227 +++++--- .../watson/discovery/v1/model/Expansion.java | 134 ++++- .../watson/discovery/v1/model/Expansions.java | 92 +++- .../model/FederatedQueryNoticesOptions.java | 58 +- .../v1/model/FederatedQueryOptions.java | 54 +- .../ibm/watson/discovery/v1/model/Field.java | 27 +- .../ibm/watson/discovery/v1/model/Filter.java | 2 +- .../discovery/v1/model/FontSetting.java | 188 +++++-- .../watson/discovery/v1/model/Gateway.java | 2 +- .../discovery/v1/model/GatewayDelete.java | 2 +- .../discovery/v1/model/GatewayList.java | 2 +- .../v1/model/GetCollectionOptions.java | 9 +- .../v1/model/GetConfigurationOptions.java | 9 +- .../v1/model/GetCredentialsOptions.java | 9 +- .../v1/model/GetDocumentStatusOptions.java | 12 +- .../v1/model/GetEnvironmentOptions.java | 6 +- .../discovery/v1/model/GetGatewayOptions.java | 9 +- .../v1/model/GetMetricsEventRateOptions.java | 2 +- .../v1/model/GetMetricsQueryEventOptions.java | 2 +- .../GetMetricsQueryNoResultsOptions.java | 2 +- .../v1/model/GetMetricsQueryOptions.java | 2 +- .../GetMetricsQueryTokenEventOptions.java | 2 +- .../model/GetStopwordListStatusOptions.java | 9 +- ...etTokenizationDictionaryStatusOptions.java | 9 +- .../v1/model/GetTrainingDataOptions.java | 12 +- .../v1/model/GetTrainingExampleOptions.java | 15 +- .../watson/discovery/v1/model/Histogram.java | 2 +- .../discovery/v1/model/HtmlSettings.java | 257 +++++++-- .../discovery/v1/model/IndexCapacity.java | 2 +- .../v1/model/ListCollectionFieldsOptions.java | 9 +- .../model/ListCollectionFieldsResponse.java | 2 +- .../v1/model/ListCollectionsOptions.java | 6 +- .../v1/model/ListCollectionsResponse.java | 2 +- .../v1/model/ListConfigurationsOptions.java | 6 +- .../v1/model/ListConfigurationsResponse.java | 2 +- .../v1/model/ListCredentialsOptions.java | 6 +- .../v1/model/ListEnvironmentsOptions.java | 2 +- .../v1/model/ListEnvironmentsResponse.java | 2 +- .../v1/model/ListExpansionsOptions.java | 9 +- .../discovery/v1/model/ListFieldsOptions.java | 12 +- .../v1/model/ListGatewaysOptions.java | 6 +- .../v1/model/ListTrainingDataOptions.java | 9 +- .../v1/model/ListTrainingExamplesOptions.java | 12 +- .../discovery/v1/model/LogQueryResponse.java | 2 +- .../v1/model/LogQueryResponseResult.java | 2 +- .../LogQueryResponseResultDocuments.java | 2 +- ...LogQueryResponseResultDocumentsResult.java | 2 +- .../discovery/v1/model/MetricAggregation.java | 2 +- .../v1/model/MetricAggregationResult.java | 2 +- .../discovery/v1/model/MetricResponse.java | 2 +- .../v1/model/MetricTokenAggregation.java | 2 +- .../model/MetricTokenAggregationResult.java | 2 +- .../v1/model/MetricTokenResponse.java | 2 +- .../ibm/watson/discovery/v1/model/Nested.java | 2 +- .../v1/model/NluEnrichmentCategories.java | 3 +- .../v1/model/NluEnrichmentConcepts.java | 63 ++- .../v1/model/NluEnrichmentEmotion.java | 6 +- .../v1/model/NluEnrichmentEntities.java | 2 +- .../v1/model/NluEnrichmentFeatures.java | 2 +- .../v1/model/NluEnrichmentKeywords.java | 2 +- .../v1/model/NluEnrichmentRelations.java | 63 ++- .../v1/model/NluEnrichmentSemanticRoles.java | 2 +- .../v1/model/NluEnrichmentSentiment.java | 6 +- .../v1/model/NormalizationOperation.java | 113 ++-- .../ibm/watson/discovery/v1/model/Notice.java | 2 +- .../v1/model/PdfHeadingDetection.java | 77 ++- .../discovery/v1/model/PdfSettings.java | 59 +- .../discovery/v1/model/QueryAggregation.java | 5 +- .../v1/model/QueryEntitiesContext.java | 63 ++- .../v1/model/QueryEntitiesEntity.java | 88 ++- .../v1/model/QueryEntitiesOptions.java | 9 +- .../v1/model/QueryEntitiesResponse.java | 2 +- .../v1/model/QueryEntitiesResponseItem.java | 2 +- .../discovery/v1/model/QueryEvidence.java | 2 +- .../v1/model/QueryEvidenceEntity.java | 2 +- .../discovery/v1/model/QueryFilterType.java | 123 ++++- .../discovery/v1/model/QueryLogOptions.java | 6 +- .../v1/model/QueryNoticesOptions.java | 58 +- .../v1/model/QueryNoticesResponse.java | 2 +- .../v1/model/QueryNoticesResult.java | 6 +- .../discovery/v1/model/QueryOptions.java | 57 +- .../discovery/v1/model/QueryPassages.java | 2 +- .../v1/model/QueryRelationsArgument.java | 2 +- .../v1/model/QueryRelationsEntity.java | 113 ++-- .../v1/model/QueryRelationsFilter.java | 131 +++-- .../v1/model/QueryRelationsOptions.java | 12 +- .../v1/model/QueryRelationsRelationship.java | 2 +- .../v1/model/QueryRelationsResponse.java | 2 +- .../discovery/v1/model/QueryResponse.java | 2 +- .../discovery/v1/model/QueryResult.java | 11 +- .../v1/model/QueryResultMetadata.java | 2 +- .../discovery/v1/model/RetrievalDetails.java | 2 +- .../watson/discovery/v1/model/SduStatus.java | 2 +- .../v1/model/SduStatusCustomFields.java | 2 +- .../discovery/v1/model/SearchStatus.java | 2 +- .../discovery/v1/model/SegmentSettings.java | 148 +++-- .../ibm/watson/discovery/v1/model/Source.java | 138 +++-- .../discovery/v1/model/SourceOptions.java | 274 +++++++-- .../v1/model/SourceOptionsBuckets.java | 99 +++- .../v1/model/SourceOptionsFolder.java | 128 +++-- .../v1/model/SourceOptionsObject.java | 99 +++- .../v1/model/SourceOptionsSiteColl.java | 99 +++- .../v1/model/SourceOptionsWebCrawl.java | 267 ++++++--- .../discovery/v1/model/SourceSchedule.java | 113 ++-- .../discovery/v1/model/SourceStatus.java | 2 +- .../ibm/watson/discovery/v1/model/Term.java | 2 +- ...TestConfigurationInEnvironmentOptions.java | 14 +- .../discovery/v1/model/TestDocument.java | 2 +- .../watson/discovery/v1/model/Timeslice.java | 2 +- .../discovery/v1/model/TokenDictRule.java | 192 +++++-- .../v1/model/TokenDictStatusResponse.java | 2 +- .../watson/discovery/v1/model/TopHits.java | 2 +- .../discovery/v1/model/TopHitsResults.java | 2 +- .../discovery/v1/model/TrainingDataSet.java | 2 +- .../discovery/v1/model/TrainingExample.java | 113 ++-- .../v1/model/TrainingExampleList.java | 2 +- .../discovery/v1/model/TrainingQuery.java | 2 +- .../discovery/v1/model/TrainingStatus.java | 2 +- .../v1/model/UpdateCollectionOptions.java | 9 +- .../v1/model/UpdateConfigurationOptions.java | 30 +- .../v1/model/UpdateCredentialsOptions.java | 15 +- .../v1/model/UpdateDocumentOptions.java | 17 +- .../v1/model/UpdateEnvironmentOptions.java | 6 +- .../model/UpdateTrainingExampleOptions.java | 15 +- .../v1/model/WordHeadingDetection.java | 117 +++- .../discovery/v1/model/WordSettings.java | 59 +- .../watson/discovery/v1/model/WordStyle.java | 106 +++- .../discovery/v1/model/XPathPatterns.java | 81 ++- .../ibm/watson/discovery/v1/package-info.java | 2 +- .../v3/LanguageTranslator.java | 108 ++-- .../v3/model/CreateModelOptions.java | 6 +- .../v3/model/DeleteDocumentOptions.java | 6 +- .../v3/model/DeleteModelOptions.java | 6 +- .../v3/model/DeleteModelResult.java | 2 +- .../v3/model/DocumentList.java | 2 +- .../v3/model/DocumentStatus.java | 2 +- .../v3/model/GetDocumentStatusOptions.java | 6 +- .../v3/model/GetModelOptions.java | 6 +- .../model/GetTranslatedDocumentOptions.java | 15 +- .../v3/model/IdentifiableLanguage.java | 2 +- .../v3/model/IdentifiableLanguages.java | 2 +- .../v3/model/IdentifiedLanguage.java | 2 +- .../v3/model/IdentifiedLanguages.java | 2 +- .../v3/model/IdentifyOptions.java | 6 +- .../v3/model/ListDocumentsOptions.java | 2 +- .../ListIdentifiableLanguagesOptions.java | 2 +- .../v3/model/ListModelsOptions.java | 26 +- .../v3/model/TranslateDocumentOptions.java | 13 +- .../v3/model/TranslateOptions.java | 9 +- .../v3/model/Translation.java | 14 +- .../v3/model/TranslationModel.java | 2 +- .../v3/model/TranslationModels.java | 2 +- .../v3/model/TranslationResult.java | 2 +- .../language_translator/v3/package-info.java | 2 +- .../v1/NaturalLanguageClassifier.java | 68 +-- .../v1/model/Classification.java | 2 +- .../v1/model/ClassificationCollection.java | 2 +- .../v1/model/ClassifiedClass.java | 2 +- .../v1/model/Classifier.java | 2 +- .../v1/model/ClassifierList.java | 2 +- .../v1/model/ClassifyCollectionOptions.java | 12 +- .../v1/model/ClassifyInput.java | 74 ++- .../v1/model/ClassifyOptions.java | 9 +- .../v1/model/CollectionItem.java | 2 +- .../v1/model/CreateClassifierOptions.java | 51 +- .../v1/model/DeleteClassifierOptions.java | 6 +- .../v1/model/GetClassifierOptions.java | 6 +- .../v1/model/ListClassifiersOptions.java | 2 +- .../v1/package-info.java | 2 +- .../v1/NaturalLanguageUnderstanding.java | 76 +-- .../v1/model/AnalysisResults.java | 2 +- .../v1/model/AnalysisResultsMetadata.java | 2 +- .../v1/model/AnalysisResultsUsage.java | 2 +- .../v1/model/AnalyzeOptions.java | 18 +- .../v1/model/Author.java | 2 +- .../v1/model/CategoriesOptions.java | 6 +- .../v1/model/CategoriesRelevantText.java | 2 +- .../v1/model/CategoriesResult.java | 6 +- .../v1/model/CategoriesResultExplanation.java | 2 +- .../v1/model/ConceptsOptions.java | 2 +- .../v1/model/ConceptsResult.java | 2 +- .../v1/model/DeleteModelOptions.java | 6 +- .../v1/model/DeleteModelResults.java | 2 +- .../v1/model/DisambiguationResult.java | 2 +- .../v1/model/DocumentEmotionResults.java | 2 +- .../v1/model/DocumentSentimentResults.java | 2 +- .../v1/model/EmotionOptions.java | 6 +- .../v1/model/EmotionResult.java | 2 +- .../v1/model/EmotionScores.java | 2 +- .../v1/model/EntitiesOptions.java | 10 +- .../v1/model/EntitiesResult.java | 2 +- .../v1/model/EntityMention.java | 2 +- .../v1/model/FeatureSentimentResults.java | 2 +- .../v1/model/Features.java | 10 +- .../v1/model/Feed.java | 2 +- .../v1/model/KeywordsOptions.java | 2 +- .../v1/model/KeywordsResult.java | 2 +- .../v1/model/ListModelsOptions.java | 2 +- .../v1/model/ListModelsResults.java | 2 +- .../v1/model/MetadataOptions.java | 37 +- .../v1/model/Model.java | 2 +- .../v1/model/RelationArgument.java | 2 +- .../v1/model/RelationEntity.java | 2 +- .../v1/model/RelationsOptions.java | 9 +- .../v1/model/RelationsResult.java | 2 +- .../v1/model/SemanticRolesEntity.java | 2 +- .../v1/model/SemanticRolesKeyword.java | 2 +- .../v1/model/SemanticRolesOptions.java | 2 +- .../v1/model/SemanticRolesResult.java | 2 +- .../v1/model/SemanticRolesResultAction.java | 2 +- .../v1/model/SemanticRolesResultObject.java | 2 +- .../v1/model/SemanticRolesResultSubject.java | 2 +- .../v1/model/SemanticRolesVerb.java | 2 +- .../v1/model/SentenceResult.java | 2 +- .../v1/model/SentimentOptions.java | 6 +- .../v1/model/SentimentResult.java | 2 +- .../v1/model/SyntaxOptions.java | 2 +- .../v1/model/SyntaxOptionsTokens.java | 70 ++- .../v1/model/SyntaxResult.java | 2 +- .../v1/model/TargetedEmotionResults.java | 2 +- .../v1/model/TargetedSentimentResults.java | 2 +- .../v1/model/TokenResult.java | 2 +- .../v1/package-info.java | 2 +- .../v3/PersonalityInsights.java | 82 +-- .../v3/model/Behavior.java | 2 +- .../v3/model/ConsumptionPreferences.java | 2 +- .../model/ConsumptionPreferencesCategory.java | 2 +- .../v3/model/Content.java | 9 +- .../v3/model/ContentItem.java | 6 +- .../v3/model/Profile.java | 2 +- .../v3/model/ProfileOptions.java | 66 ++- .../personality_insights/v3/model/Trait.java | 2 +- .../v3/model/Warning.java | 2 +- .../personality_insights/v3/package-info.java | 2 +- .../speech_to_text/v1/SpeechToText.java | 292 +++++----- .../v1/model/AcousticModel.java | 2 +- .../v1/model/AcousticModels.java | 2 +- .../v1/model/AddAudioOptions.java | 114 ++-- .../v1/model/AddCorpusOptions.java | 12 +- .../v1/model/AddGrammarOptions.java | 15 +- .../v1/model/AddWordOptions.java | 12 +- .../v1/model/AddWordsOptions.java | 12 +- .../speech_to_text/v1/model/AudioDetails.java | 2 +- .../speech_to_text/v1/model/AudioListing.java | 2 +- .../speech_to_text/v1/model/AudioMetrics.java | 2 +- .../v1/model/AudioMetricsDetails.java | 2 +- .../v1/model/AudioMetricsHistogramBin.java | 2 +- .../v1/model/AudioResource.java | 2 +- .../v1/model/AudioResources.java | 2 +- .../v1/model/CheckJobOptions.java | 6 +- .../v1/model/CheckJobsOptions.java | 2 +- .../speech_to_text/v1/model/Corpora.java | 2 +- .../speech_to_text/v1/model/Corpus.java | 2 +- .../v1/model/CreateAcousticModelOptions.java | 35 +- .../v1/model/CreateJobOptions.java | 167 +++--- .../v1/model/CreateLanguageModelOptions.java | 58 +- .../speech_to_text/v1/model/CustomWord.java | 131 +++-- .../v1/model/DeleteAcousticModelOptions.java | 6 +- .../v1/model/DeleteAudioOptions.java | 9 +- .../v1/model/DeleteCorpusOptions.java | 9 +- .../v1/model/DeleteGrammarOptions.java | 9 +- .../v1/model/DeleteJobOptions.java | 6 +- .../v1/model/DeleteLanguageModelOptions.java | 6 +- .../v1/model/DeleteUserDataOptions.java | 6 +- .../v1/model/DeleteWordOptions.java | 9 +- .../v1/model/GetAcousticModelOptions.java | 6 +- .../v1/model/GetAudioOptions.java | 9 +- .../v1/model/GetCorpusOptions.java | 9 +- .../v1/model/GetGrammarOptions.java | 9 +- .../v1/model/GetLanguageModelOptions.java | 6 +- .../v1/model/GetModelOptions.java | 26 +- .../v1/model/GetWordOptions.java | 9 +- .../speech_to_text/v1/model/Grammar.java | 2 +- .../speech_to_text/v1/model/Grammars.java | 2 +- .../v1/model/KeywordResult.java | 2 +- .../v1/model/LanguageModel.java | 16 +- .../v1/model/LanguageModels.java | 2 +- .../v1/model/ListAcousticModelsOptions.java | 2 +- .../v1/model/ListAudioOptions.java | 6 +- .../v1/model/ListCorporaOptions.java | 6 +- .../v1/model/ListGrammarsOptions.java | 6 +- .../v1/model/ListLanguageModelsOptions.java | 2 +- .../v1/model/ListModelsOptions.java | 2 +- .../v1/model/ListWordsOptions.java | 6 +- .../v1/model/ProcessedAudio.java | 2 +- .../v1/model/ProcessingMetrics.java | 2 +- .../v1/model/RecognitionJob.java | 2 +- .../v1/model/RecognitionJobs.java | 2 +- .../v1/model/RecognizeOptions.java | 273 ++++----- .../v1/model/RegisterCallbackOptions.java | 6 +- .../v1/model/RegisterStatus.java | 2 +- .../v1/model/ResetAcousticModelOptions.java | 6 +- .../v1/model/ResetLanguageModelOptions.java | 6 +- .../v1/model/SpeakerLabelsResult.java | 12 +- .../speech_to_text/v1/model/SpeechModel.java | 2 +- .../speech_to_text/v1/model/SpeechModels.java | 2 +- .../model/SpeechRecognitionAlternative.java | 10 +- .../v1/model/SpeechRecognitionResult.java | 12 +- .../v1/model/SpeechRecognitionResults.java | 2 +- .../v1/model/SupportedFeatures.java | 2 +- .../v1/model/TrainAcousticModelOptions.java | 6 +- .../v1/model/TrainLanguageModelOptions.java | 6 +- .../v1/model/TrainingResponse.java | 2 +- .../v1/model/TrainingWarning.java | 2 +- .../v1/model/UnregisterCallbackOptions.java | 6 +- .../v1/model/UpgradeAcousticModelOptions.java | 6 +- .../v1/model/UpgradeLanguageModelOptions.java | 6 +- .../watson/speech_to_text/v1/model/Word.java | 2 +- .../v1/model/WordAlternativeResult.java | 2 +- .../v1/model/WordAlternativeResults.java | 2 +- .../speech_to_text/v1/model/WordError.java | 2 +- .../watson/speech_to_text/v1/model/Words.java | 2 +- .../speech_to_text/v1/package-info.java | 2 +- .../text_to_speech/v1/TextToSpeech.java | 144 ++--- .../v1/model/AddWordOptions.java | 20 +- .../v1/model/AddWordsOptions.java | 18 +- .../v1/model/CreateVoiceModelOptions.java | 6 +- .../v1/model/DeleteUserDataOptions.java | 6 +- .../v1/model/DeleteVoiceModelOptions.java | 10 +- .../v1/model/DeleteWordOptions.java | 13 +- .../v1/model/GetPronunciationOptions.java | 50 +- .../v1/model/GetVoiceModelOptions.java | 10 +- .../v1/model/GetVoiceOptions.java | 50 +- .../v1/model/GetWordOptions.java | 13 +- .../v1/model/ListVoiceModelsOptions.java | 10 +- .../v1/model/ListVoicesOptions.java | 2 +- .../v1/model/ListWordsOptions.java | 10 +- .../v1/model/Pronunciation.java | 2 +- .../v1/model/SupportedFeatures.java | 2 +- .../v1/model/SynthesizeOptions.java | 211 ++++--- .../text_to_speech/v1/model/Translation.java | 99 +++- .../v1/model/UpdateVoiceModelOptions.java | 13 +- .../watson/text_to_speech/v1/model/Voice.java | 2 +- .../text_to_speech/v1/model/VoiceModel.java | 10 +- .../text_to_speech/v1/model/VoiceModels.java | 6 +- .../text_to_speech/v1/model/Voices.java | 2 +- .../watson/text_to_speech/v1/model/Word.java | 128 +++-- .../watson/text_to_speech/v1/model/Words.java | 92 +++- .../text_to_speech/v1/package-info.java | 2 +- .../watson/tone_analyzer/v3/ToneAnalyzer.java | 73 +-- .../v3/model/DocumentAnalysis.java | 2 +- .../v3/model/SentenceAnalysis.java | 2 +- .../tone_analyzer/v3/model/ToneAnalysis.java | 2 +- .../tone_analyzer/v3/model/ToneCategory.java | 2 +- .../v3/model/ToneChatOptions.java | 9 +- .../tone_analyzer/v3/model/ToneChatScore.java | 2 +- .../tone_analyzer/v3/model/ToneInput.java | 6 +- .../tone_analyzer/v3/model/ToneOptions.java | 70 +-- .../tone_analyzer/v3/model/ToneScore.java | 2 +- .../tone_analyzer/v3/model/Utterance.java | 6 +- .../v3/model/UtteranceAnalyses.java | 2 +- .../v3/model/UtteranceAnalysis.java | 2 +- .../watson/tone_analyzer/v3/package-info.java | 2 +- .../v3/VisualRecognition.java | 126 +++-- .../visual_recognition/v3/model/Class.java | 12 +- .../v3/model/ClassResult.java | 12 +- .../v3/model/ClassifiedImage.java | 2 +- .../v3/model/ClassifiedImages.java | 2 +- .../v3/model/Classifier.java | 2 +- .../v3/model/ClassifierResult.java | 2 +- .../v3/model/Classifiers.java | 2 +- .../v3/model/ClassifyOptions.java | 11 +- .../v3/model/CreateClassifierOptions.java | 18 +- .../v3/model/DeleteClassifierOptions.java | 6 +- .../v3/model/DeleteUserDataOptions.java | 6 +- .../v3/model/DetectFacesOptions.java | 5 +- .../v3/model/DetectedFaces.java | 2 +- .../v3/model/ErrorInfo.java | 2 +- .../visual_recognition/v3/model/Face.java | 2 +- .../visual_recognition/v3/model/FaceAge.java | 2 +- .../v3/model/FaceGender.java | 2 +- .../v3/model/FaceLocation.java | 2 +- .../v3/model/GetClassifierOptions.java | 6 +- .../v3/model/GetCoreMlModelOptions.java | 6 +- .../v3/model/ImageWithFaces.java | 2 +- .../v3/model/ListClassifiersOptions.java | 2 +- .../v3/model/UpdateClassifierOptions.java | 15 +- .../v3/model/WarningInfo.java | 2 +- .../visual_recognition/v3/package-info.java | 2 +- 480 files changed, 8403 insertions(+), 4514 deletions(-) rename assistant/src/main/java/com/ibm/watson/assistant/v2/model/{DialogRuntimeResponseGeneric.java => RuntimeResponseGeneric.java} (76%) diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java index 0bcd951d326..018cd912cf3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,11 +16,9 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.assistant.v2.model.CreateSessionOptions; import com.ibm.watson.assistant.v2.model.DeleteSessionOptions; import com.ibm.watson.assistant.v2.model.MessageOptions; @@ -35,7 +33,7 @@ * dialog editor to create conversation flows between your apps and your users. * * @version v2 - * @see Assistant + * @see Assistant */ public class Assistant extends BaseService { @@ -45,54 +43,19 @@ public class Assistant extends BaseService { private String versionDate; /** - * Instantiates a new `Assistant`. + * Constructs a new `Assistant` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public Assistant(String versionDate) { - super(SERVICE_NAME); + public Assistant(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `Assistant` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public Assistant(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `Assistant` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -106,7 +69,8 @@ public Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) { * @return a {@link ServiceCall} with a response type of {@link SessionResponse} */ public ServiceCall createSession(CreateSessionOptions createSessionOptions) { - Validator.notNull(createSessionOptions, "createSessionOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createSessionOptions, + "createSessionOptions cannot be null"); String[] pathSegments = { "v2/assistants", "sessions" }; String[] pathParameters = { createSessionOptions.assistantId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -132,7 +96,8 @@ public ServiceCall createSession(CreateSessionOptions createSes * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteSession(DeleteSessionOptions deleteSessionOptions) { - Validator.notNull(deleteSessionOptions, "deleteSessionOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteSessionOptions, + "deleteSessionOptions cannot be null"); String[] pathSegments = { "v2/assistants", "sessions" }; String[] pathParameters = { deleteSessionOptions.assistantId(), deleteSessionOptions.sessionId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -158,7 +123,8 @@ public ServiceCall deleteSession(DeleteSessionOptions deleteSessionOptions * @return a {@link ServiceCall} with a response type of {@link MessageResponse} */ public ServiceCall message(MessageOptions messageOptions) { - Validator.notNull(messageOptions, "messageOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(messageOptions, + "messageOptions cannot be null"); String[] pathSegments = { "v2/assistants", "sessions", "message" }; String[] pathParameters = { messageOptions.assistantId(), messageOptions.sessionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -171,10 +137,11 @@ public ServiceCall message(MessageOptions messageOptions) { builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (messageOptions.input() != null) { - contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input())); + contentJson.add("input", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions.input())); } if (messageOptions.context() != null) { - contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context())); + contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions + .context())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CaptureGroup.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CaptureGroup.java index b8d2e94bf96..b905b557cfd 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CaptureGroup.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CaptureGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v2.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,6 +25,98 @@ public class CaptureGroup extends GenericModel { private String group; private List location; + /** + * Builder. + */ + public static class Builder { + private String group; + private List location; + + private Builder(CaptureGroup captureGroup) { + this.group = captureGroup.group; + this.location = captureGroup.location; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param group the group + */ + public Builder(String group) { + this.group = group; + } + + /** + * Builds a CaptureGroup. + * + * @return the captureGroup + */ + public CaptureGroup build() { + return new CaptureGroup(this); + } + + /** + * Adds an location to location. + * + * @param location the new location + * @return the CaptureGroup builder + */ + public Builder addLocation(Long location) { + com.ibm.cloud.sdk.core.util.Validator.notNull(location, + "location cannot be null"); + if (this.location == null) { + this.location = new ArrayList(); + } + this.location.add(location); + return this; + } + + /** + * Set the group. + * + * @param group the group + * @return the CaptureGroup builder + */ + public Builder group(String group) { + this.group = group; + return this; + } + + /** + * Set the location. + * Existing location will be replaced. + * + * @param location the location + * @return the CaptureGroup builder + */ + public Builder location(List location) { + this.location = location; + return this; + } + } + + private CaptureGroup(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.group, + "group cannot be null"); + group = builder.group; + location = builder.location; + } + + /** + * New builder. + * + * @return a CaptureGroup builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the group. * @@ -31,7 +124,7 @@ public class CaptureGroup extends GenericModel { * * @return the group */ - public String getGroup() { + public String group() { return group; } @@ -42,25 +135,7 @@ public String getGroup() { * * @return the location */ - public List getLocation() { + public List location() { return location; } - - /** - * Sets the group. - * - * @param group the new group - */ - public void setGroup(final String group) { - this.group = group; - } - - /** - * Sets the location. - * - * @param location the new location - */ - public void setLocation(final List location) { - this.location = location; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CreateSessionOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CreateSessionOptions.java index 55dd2d10049..a861e8d23d4 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CreateSessionOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/CreateSessionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v2.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createSession options. @@ -69,7 +68,8 @@ public Builder assistantId(String assistantId) { } private CreateSessionOptions(Builder builder) { - Validator.notEmpty(builder.assistantId, "assistantId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assistantId, + "assistantId cannot be empty"); assistantId = builder.assistantId; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DeleteSessionOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DeleteSessionOptions.java index 39acf4b6aad..ce6fa1980b4 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DeleteSessionOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DeleteSessionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v2.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteSession options. @@ -85,8 +84,10 @@ public Builder sessionId(String sessionId) { } private DeleteSessionOptions(Builder builder) { - Validator.notEmpty(builder.assistantId, "assistantId cannot be empty"); - Validator.notEmpty(builder.sessionId, "sessionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assistantId, + "assistantId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.sessionId, + "sessionId cannot be empty"); assistantId = builder.assistantId; sessionId = builder.sessionId; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogLogMessage.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogLogMessage.java index f496207ec91..ddfa81101d7 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogLogMessage.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogLogMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java index 7ef51e2e3c1..832e64af670 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,11 +12,12 @@ */ package com.ibm.watson.assistant.v2.model; +import java.util.List; +import java.util.Map; + import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Map; - /** * DialogNodeAction. */ @@ -25,7 +26,7 @@ public class DialogNodeAction extends GenericModel { /** * The type of action to invoke. */ - public interface ActionType { + public interface Type { /** client. */ String CLIENT = "client"; /** server. */ @@ -37,9 +38,8 @@ public interface ActionType { } private String name; - @SerializedName("type") - private String actionType; - private Map parameters; + private String type; + private Map parameters; @SerializedName("result_variable") private String resultVariable; private String credentials; @@ -56,14 +56,14 @@ public String getName() { } /** - * Gets the actionType. + * Gets the type. * * The type of action to invoke. * - * @return the actionType + * @return the type */ - public String getActionType() { - return actionType; + public String getType() { + return type; } /** @@ -73,7 +73,7 @@ public String getActionType() { * * @return the parameters */ - public Map getParameters() { + public Map getParameters() { return parameters; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElement.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElement.java index f1bd28d6d62..9333aafbc9f 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElement.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElementValue.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElementValue.java index 0ca6ade2372..8735e3f5694 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElementValue.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeOutputOptionsElementValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodesVisited.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodesVisited.java index 78af2ca8e0c..4082675f0fe 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodesVisited.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodesVisited.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java index b8bb3f1e032..6e55e57d0e6 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,10 +12,11 @@ */ package com.ibm.watson.assistant.v2.model; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - +import java.util.List; import java.util.Map; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + /** * DialogSuggestion. */ @@ -23,7 +24,7 @@ public class DialogSuggestion extends GenericModel { private String label; private DialogSuggestionValue value; - private Map output; + private Map output; /** * Gets the label. @@ -57,7 +58,7 @@ public DialogSuggestionValue getValue() { * * @return the output */ - public Map getOutput() { + public Map getOutput() { return output; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestionValue.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestionValue.java index 13f8cae05cf..3616b1caed3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestionValue.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestionValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContext.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContext.java index e241e1480b7..1f5eb028992 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContext.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,6 +22,70 @@ public class MessageContext extends GenericModel { private MessageContextGlobal global; private MessageContextSkills skills; + /** + * Builder. + */ + public static class Builder { + private MessageContextGlobal global; + private MessageContextSkills skills; + + private Builder(MessageContext messageContext) { + this.global = messageContext.global; + this.skills = messageContext.skills; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MessageContext. + * + * @return the messageContext + */ + public MessageContext build() { + return new MessageContext(this); + } + + /** + * Set the global. + * + * @param global the global + * @return the MessageContext builder + */ + public Builder global(MessageContextGlobal global) { + this.global = global; + return this; + } + + /** + * Set the skills. + * + * @param skills the skills + * @return the MessageContext builder + */ + public Builder skills(MessageContextSkills skills) { + this.skills = skills; + return this; + } + } + + private MessageContext(Builder builder) { + global = builder.global; + skills = builder.skills; + } + + /** + * New builder. + * + * @return a MessageContext builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the global. * @@ -29,7 +93,7 @@ public class MessageContext extends GenericModel { * * @return the global */ - public MessageContextGlobal getGlobal() { + public MessageContextGlobal global() { return global; } @@ -43,25 +107,7 @@ public MessageContextGlobal getGlobal() { * * @return the skills */ - public MessageContextSkills getSkills() { + public MessageContextSkills skills() { return skills; } - - /** - * Sets the global. - * - * @param global the new global - */ - public void setGlobal(final MessageContextGlobal global) { - this.global = global; - } - - /** - * Sets the skills. - * - * @param skills the new skills - */ - public void setSkills(final MessageContextSkills skills) { - this.skills = skills; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobal.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobal.java index 5d579105b8c..8c0fca7f783 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobal.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobal.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,22 +22,63 @@ public class MessageContextGlobal extends GenericModel { private MessageContextGlobalSystem system; /** - * Gets the system. - * - * Built-in system properties that apply to all skills used by the assistant. + * Builder. + */ + public static class Builder { + private MessageContextGlobalSystem system; + + private Builder(MessageContextGlobal messageContextGlobal) { + this.system = messageContextGlobal.system; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MessageContextGlobal. + * + * @return the messageContextGlobal + */ + public MessageContextGlobal build() { + return new MessageContextGlobal(this); + } + + /** + * Set the system. + * + * @param system the system + * @return the MessageContextGlobal builder + */ + public Builder system(MessageContextGlobalSystem system) { + this.system = system; + return this; + } + } + + private MessageContextGlobal(Builder builder) { + system = builder.system; + } + + /** + * New builder. * - * @return the system + * @return a MessageContextGlobal builder */ - public MessageContextGlobalSystem getSystem() { - return system; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the system. + * Gets the system. + * + * Built-in system properties that apply to all skills used by the assistant. * - * @param system the new system + * @return the system */ - public void setSystem(final MessageContextGlobalSystem system) { - this.system = system; + public MessageContextGlobalSystem system() { + return system; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobalSystem.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobalSystem.java index 0eb64895d79..caa7c0bfc70 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobalSystem.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextGlobalSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -26,6 +26,84 @@ public class MessageContextGlobalSystem extends GenericModel { @SerializedName("turn_count") private Long turnCount; + /** + * Builder. + */ + public static class Builder { + private String timezone; + private String userId; + private Long turnCount; + + private Builder(MessageContextGlobalSystem messageContextGlobalSystem) { + this.timezone = messageContextGlobalSystem.timezone; + this.userId = messageContextGlobalSystem.userId; + this.turnCount = messageContextGlobalSystem.turnCount; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MessageContextGlobalSystem. + * + * @return the messageContextGlobalSystem + */ + public MessageContextGlobalSystem build() { + return new MessageContextGlobalSystem(this); + } + + /** + * Set the timezone. + * + * @param timezone the timezone + * @return the MessageContextGlobalSystem builder + */ + public Builder timezone(String timezone) { + this.timezone = timezone; + return this; + } + + /** + * Set the userId. + * + * @param userId the userId + * @return the MessageContextGlobalSystem builder + */ + public Builder userId(String userId) { + this.userId = userId; + return this; + } + + /** + * Set the turnCount. + * + * @param turnCount the turnCount + * @return the MessageContextGlobalSystem builder + */ + public Builder turnCount(long turnCount) { + this.turnCount = turnCount; + return this; + } + } + + private MessageContextGlobalSystem(Builder builder) { + timezone = builder.timezone; + userId = builder.userId; + turnCount = builder.turnCount; + } + + /** + * New builder. + * + * @return a MessageContextGlobalSystem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the timezone. * @@ -33,7 +111,7 @@ public class MessageContextGlobalSystem extends GenericModel { * * @return the timezone */ - public String getTimezone() { + public String timezone() { return timezone; } @@ -47,7 +125,7 @@ public String getTimezone() { * * @return the userId */ - public String getUserId() { + public String userId() { return userId; } @@ -60,34 +138,7 @@ public String getUserId() { * * @return the turnCount */ - public Long getTurnCount() { + public Long turnCount() { return turnCount; } - - /** - * Sets the timezone. - * - * @param timezone the new timezone - */ - public void setTimezone(final String timezone) { - this.timezone = timezone; - } - - /** - * Sets the userId. - * - * @param userId the new userId - */ - public void setUserId(final String userId) { - this.userId = userId; - } - - /** - * Sets the turnCount. - * - * @param turnCount the new turnCount - */ - public void setTurnCount(final long turnCount) { - this.turnCount = turnCount; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java index 25a1051ce4d..615ae5b0afd 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,11 +12,12 @@ */ package com.ibm.watson.assistant.v2.model; +import java.util.List; +import java.util.Map; + import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Map; - /** * Contains information specific to a particular skill used by the Assistant. */ @@ -26,22 +27,63 @@ public class MessageContextSkill extends GenericModel { private Map userDefined; /** - * Gets the userDefined. - * - * Arbitrary variables that can be read and written by a particular skill. + * Builder. + */ + public static class Builder { + private Map userDefined; + + private Builder(MessageContextSkill messageContextSkill) { + this.userDefined = messageContextSkill.userDefined; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MessageContextSkill. + * + * @return the messageContextSkill + */ + public MessageContextSkill build() { + return new MessageContextSkill(this); + } + + /** + * Set the userDefined. + * + * @param userDefined the userDefined + * @return the MessageContextSkill builder + */ + public Builder userDefined(Map userDefined) { + this.userDefined = userDefined; + return this; + } + } + + private MessageContextSkill(Builder builder) { + userDefined = builder.userDefined; + } + + /** + * New builder. * - * @return the userDefined + * @return a MessageContextSkill builder */ - public Map getUserDefined() { - return userDefined; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the userDefined. + * Gets the userDefined. + * + * Arbitrary variables that can be read and written by a particular skill. * - * @param userDefined the new userDefined + * @return the userDefined */ - public void setUserDefined(final Map userDefined) { - this.userDefined = userDefined; + public Map userDefined() { + return userDefined; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java index 19207ccebca..15786f3798c 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v2.model; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInput.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInput.java index fe10e89c426..64bc91c914e 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInput.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInput.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * An input object that includes the input text. @@ -83,7 +82,8 @@ public MessageInput build() { * @return the MessageInput builder */ public Builder addIntent(RuntimeIntent intent) { - Validator.notNull(intent, "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(intent, + "intent cannot be null"); if (this.intents == null) { this.intents = new ArrayList(); } @@ -98,7 +98,8 @@ public Builder addIntent(RuntimeIntent intent) { * @return the MessageInput builder */ public Builder addEntity(RuntimeEntity entity) { - Validator.notNull(entity, "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(entity, + "entity cannot be null"); if (this.entities == null) { this.entities = new ArrayList(); } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInputOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInputOptions.java index a7548a151de..60bb9011cb6 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInputOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageInputOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -27,6 +27,98 @@ public class MessageInputOptions extends GenericModel { @SerializedName("return_context") private Boolean returnContext; + /** + * Builder. + */ + public static class Builder { + private Boolean debug; + private Boolean restart; + private Boolean alternateIntents; + private Boolean returnContext; + + private Builder(MessageInputOptions messageInputOptions) { + this.debug = messageInputOptions.debug; + this.restart = messageInputOptions.restart; + this.alternateIntents = messageInputOptions.alternateIntents; + this.returnContext = messageInputOptions.returnContext; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MessageInputOptions. + * + * @return the messageInputOptions + */ + public MessageInputOptions build() { + return new MessageInputOptions(this); + } + + /** + * Set the debug. + * + * @param debug the debug + * @return the MessageInputOptions builder + */ + public Builder debug(Boolean debug) { + this.debug = debug; + return this; + } + + /** + * Set the restart. + * + * @param restart the restart + * @return the MessageInputOptions builder + */ + public Builder restart(Boolean restart) { + this.restart = restart; + return this; + } + + /** + * Set the alternateIntents. + * + * @param alternateIntents the alternateIntents + * @return the MessageInputOptions builder + */ + public Builder alternateIntents(Boolean alternateIntents) { + this.alternateIntents = alternateIntents; + return this; + } + + /** + * Set the returnContext. + * + * @param returnContext the returnContext + * @return the MessageInputOptions builder + */ + public Builder returnContext(Boolean returnContext) { + this.returnContext = returnContext; + return this; + } + } + + private MessageInputOptions(Builder builder) { + debug = builder.debug; + restart = builder.restart; + alternateIntents = builder.alternateIntents; + returnContext = builder.returnContext; + } + + /** + * New builder. + * + * @return a MessageInputOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the debug. * @@ -35,7 +127,7 @@ public class MessageInputOptions extends GenericModel { * * @return the debug */ - public Boolean isDebug() { + public Boolean debug() { return debug; } @@ -47,7 +139,7 @@ public Boolean isDebug() { * * @return the restart */ - public Boolean isRestart() { + public Boolean restart() { return restart; } @@ -58,7 +150,7 @@ public Boolean isRestart() { * * @return the alternateIntents */ - public Boolean isAlternateIntents() { + public Boolean alternateIntents() { return alternateIntents; } @@ -70,43 +162,7 @@ public Boolean isAlternateIntents() { * * @return the returnContext */ - public Boolean isReturnContext() { + public Boolean returnContext() { return returnContext; } - - /** - * Sets the debug. - * - * @param debug the new debug - */ - public void setDebug(final Boolean debug) { - this.debug = debug; - } - - /** - * Sets the restart. - * - * @param restart the new restart - */ - public void setRestart(final Boolean restart) { - this.restart = restart; - } - - /** - * Sets the alternateIntents. - * - * @param alternateIntents the new alternateIntents - */ - public void setAlternateIntents(final Boolean alternateIntents) { - this.alternateIntents = alternateIntents; - } - - /** - * Sets the returnContext. - * - * @param returnContext the new returnContext - */ - public void setReturnContext(final Boolean returnContext) { - this.returnContext = returnContext; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java index df00004a4e6..b0cb0a62b9d 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v2.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The message options. @@ -113,8 +112,10 @@ public Builder context(MessageContext context) { } private MessageOptions(Builder builder) { - Validator.notEmpty(builder.assistantId, "assistantId cannot be empty"); - Validator.notEmpty(builder.sessionId, "sessionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assistantId, + "assistantId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.sessionId, + "sessionId cannot be empty"); assistantId = builder.assistantId; sessionId = builder.sessionId; input = builder.input; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutput.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutput.java index 358409ef9a7..1a4a227bdfb 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutput.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutput.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -23,13 +23,13 @@ */ public class MessageOutput extends GenericModel { - private List generic; + private List generic; private List intents; private List entities; private List actions; private MessageOutputDebug debug; @SerializedName("user_defined") - private Map userDefined; + private Map userDefined; /** * Gets the generic. @@ -39,7 +39,7 @@ public class MessageOutput extends GenericModel { * * @return the generic */ - public List getGeneric() { + public List getGeneric() { return generic; } @@ -95,7 +95,7 @@ public MessageOutputDebug getDebug() { * * @return the userDefined */ - public Map getUserDefined() { + public Map getUserDefined() { return userDefined; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutputDebug.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutputDebug.java index 9a1d431dff3..0c20a85631a 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutputDebug.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOutputDebug.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java index ff2b705aac0..d89fa00efc6 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeEntity.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeEntity.java index fce367beae0..063beec7026 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeEntity.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v2.model; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -26,9 +27,182 @@ public class RuntimeEntity extends GenericModel { private List location; private String value; private Double confidence; - private Map metadata; + private Map metadata; private List groups; + /** + * Builder. + */ + public static class Builder { + private String entity; + private List location; + private String value; + private Double confidence; + private Map metadata; + private List groups; + + private Builder(RuntimeEntity runtimeEntity) { + this.entity = runtimeEntity.entity; + this.location = runtimeEntity.location; + this.value = runtimeEntity.value; + this.confidence = runtimeEntity.confidence; + this.metadata = runtimeEntity.metadata; + this.groups = runtimeEntity.groups; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param entity the entity + * @param location the location + * @param value the value + */ + public Builder(String entity, List location, String value) { + this.entity = entity; + this.location = location; + this.value = value; + } + + /** + * Builds a RuntimeEntity. + * + * @return the runtimeEntity + */ + public RuntimeEntity build() { + return new RuntimeEntity(this); + } + + /** + * Adds an location to location. + * + * @param location the new location + * @return the RuntimeEntity builder + */ + public Builder addLocation(Long location) { + com.ibm.cloud.sdk.core.util.Validator.notNull(location, + "location cannot be null"); + if (this.location == null) { + this.location = new ArrayList(); + } + this.location.add(location); + return this; + } + + /** + * Adds an groups to groups. + * + * @param groups the new groups + * @return the RuntimeEntity builder + */ + public Builder addGroups(CaptureGroup groups) { + com.ibm.cloud.sdk.core.util.Validator.notNull(groups, + "groups cannot be null"); + if (this.groups == null) { + this.groups = new ArrayList(); + } + this.groups.add(groups); + return this; + } + + /** + * Set the entity. + * + * @param entity the entity + * @return the RuntimeEntity builder + */ + public Builder entity(String entity) { + this.entity = entity; + return this; + } + + /** + * Set the location. + * Existing location will be replaced. + * + * @param location the location + * @return the RuntimeEntity builder + */ + public Builder location(List location) { + this.location = location; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuntimeEntity builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the confidence. + * + * @param confidence the confidence + * @return the RuntimeEntity builder + */ + public Builder confidence(Double confidence) { + this.confidence = confidence; + return this; + } + + /** + * Set the metadata. + * + * @param metadata the metadata + * @return the RuntimeEntity builder + */ + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Set the groups. + * Existing groups will be replaced. + * + * @param groups the groups + * @return the RuntimeEntity builder + */ + public Builder groups(List groups) { + this.groups = groups; + return this; + } + } + + private RuntimeEntity(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.entity, + "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.location, + "location cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + entity = builder.entity; + location = builder.location; + value = builder.value; + confidence = builder.confidence; + metadata = builder.metadata; + groups = builder.groups; + } + + /** + * New builder. + * + * @return a RuntimeEntity builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the entity. * @@ -36,7 +210,7 @@ public class RuntimeEntity extends GenericModel { * * @return the entity */ - public String getEntity() { + public String entity() { return entity; } @@ -48,7 +222,7 @@ public String getEntity() { * * @return the location */ - public List getLocation() { + public List location() { return location; } @@ -59,7 +233,7 @@ public List getLocation() { * * @return the value */ - public String getValue() { + public String value() { return value; } @@ -70,7 +244,7 @@ public String getValue() { * * @return the confidence */ - public Double getConfidence() { + public Double confidence() { return confidence; } @@ -81,7 +255,7 @@ public Double getConfidence() { * * @return the metadata */ - public Map getMetadata() { + public Map metadata() { return metadata; } @@ -92,61 +266,7 @@ public Map getMetadata() { * * @return the groups */ - public List getGroups() { + public List groups() { return groups; } - - /** - * Sets the entity. - * - * @param entity the new entity - */ - public void setEntity(final String entity) { - this.entity = entity; - } - - /** - * Sets the location. - * - * @param location the new location - */ - public void setLocation(final List location) { - this.location = location; - } - - /** - * Sets the value. - * - * @param value the new value - */ - public void setValue(final String value) { - this.value = value; - } - - /** - * Sets the confidence. - * - * @param confidence the new confidence - */ - public void setConfidence(final Double confidence) { - this.confidence = confidence; - } - - /** - * Sets the metadata. - * - * @param metadata the new metadata - */ - public void setMetadata(final Map metadata) { - this.metadata = metadata; - } - - /** - * Sets the groups. - * - * @param groups the new groups - */ - public void setGroups(final List groups) { - this.groups = groups; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeIntent.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeIntent.java index 79962b43436..1b9f99e41f2 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeIntent.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeIntent.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,6 +22,85 @@ public class RuntimeIntent extends GenericModel { private String intent; private Double confidence; + /** + * Builder. + */ + public static class Builder { + private String intent; + private Double confidence; + + private Builder(RuntimeIntent runtimeIntent) { + this.intent = runtimeIntent.intent; + this.confidence = runtimeIntent.confidence; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param intent the intent + * @param confidence the confidence + */ + public Builder(String intent, Double confidence) { + this.intent = intent; + this.confidence = confidence; + } + + /** + * Builds a RuntimeIntent. + * + * @return the runtimeIntent + */ + public RuntimeIntent build() { + return new RuntimeIntent(this); + } + + /** + * Set the intent. + * + * @param intent the intent + * @return the RuntimeIntent builder + */ + public Builder intent(String intent) { + this.intent = intent; + return this; + } + + /** + * Set the confidence. + * + * @param confidence the confidence + * @return the RuntimeIntent builder + */ + public Builder confidence(Double confidence) { + this.confidence = confidence; + return this; + } + } + + private RuntimeIntent(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.intent, + "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.confidence, + "confidence cannot be null"); + intent = builder.intent; + confidence = builder.confidence; + } + + /** + * New builder. + * + * @return a RuntimeIntent builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the intent. * @@ -29,7 +108,7 @@ public class RuntimeIntent extends GenericModel { * * @return the intent */ - public String getIntent() { + public String intent() { return intent; } @@ -40,25 +119,7 @@ public String getIntent() { * * @return the confidence */ - public Double getConfidence() { + public Double confidence() { return confidence; } - - /** - * Sets the intent. - * - * @param intent the new intent - */ - public void setIntent(final String intent) { - this.intent = intent; - } - - /** - * Sets the confidence. - * - * @param confidence the new confidence - */ - public void setConfidence(final Double confidence) { - this.confidence = confidence; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogRuntimeResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java similarity index 76% rename from assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogRuntimeResponseGeneric.java rename to assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java index dd93b6fe32a..14df4d368a3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogRuntimeResponseGeneric.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,12 +17,11 @@ import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** - * DialogRuntimeResponseGeneric. + * RuntimeResponseGeneric. */ -public class DialogRuntimeResponseGeneric extends GenericModel { +public class RuntimeResponseGeneric extends GenericModel { /** * The type of response returned by the dialog node. The specified response type must be supported by the client @@ -94,21 +93,21 @@ public static class Builder { private String header; private List results; - private Builder(DialogRuntimeResponseGeneric dialogRuntimeResponseGeneric) { - this.responseType = dialogRuntimeResponseGeneric.responseType; - this.text = dialogRuntimeResponseGeneric.text; - this.time = dialogRuntimeResponseGeneric.time; - this.typing = dialogRuntimeResponseGeneric.typing; - this.source = dialogRuntimeResponseGeneric.source; - this.title = dialogRuntimeResponseGeneric.title; - this.description = dialogRuntimeResponseGeneric.description; - this.preference = dialogRuntimeResponseGeneric.preference; - this.options = dialogRuntimeResponseGeneric.options; - this.messageToHumanAgent = dialogRuntimeResponseGeneric.messageToHumanAgent; - this.topic = dialogRuntimeResponseGeneric.topic; - this.suggestions = dialogRuntimeResponseGeneric.suggestions; - this.header = dialogRuntimeResponseGeneric.header; - this.results = dialogRuntimeResponseGeneric.results; + private Builder(RuntimeResponseGeneric runtimeResponseGeneric) { + this.responseType = runtimeResponseGeneric.responseType; + this.text = runtimeResponseGeneric.text; + this.time = runtimeResponseGeneric.time; + this.typing = runtimeResponseGeneric.typing; + this.source = runtimeResponseGeneric.source; + this.title = runtimeResponseGeneric.title; + this.description = runtimeResponseGeneric.description; + this.preference = runtimeResponseGeneric.preference; + this.options = runtimeResponseGeneric.options; + this.messageToHumanAgent = runtimeResponseGeneric.messageToHumanAgent; + this.topic = runtimeResponseGeneric.topic; + this.suggestions = runtimeResponseGeneric.suggestions; + this.header = runtimeResponseGeneric.header; + this.results = runtimeResponseGeneric.results; } /** @@ -127,22 +126,23 @@ public Builder(String responseType) { } /** - * Builds a DialogRuntimeResponseGeneric. + * Builds a RuntimeResponseGeneric. * - * @return the dialogRuntimeResponseGeneric + * @return the runtimeResponseGeneric */ - public DialogRuntimeResponseGeneric build() { - return new DialogRuntimeResponseGeneric(this); + public RuntimeResponseGeneric build() { + return new RuntimeResponseGeneric(this); } /** * Adds an options to options. * * @param options the new options - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder addOptions(DialogNodeOutputOptionsElement options) { - Validator.notNull(options, "options cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(options, + "options cannot be null"); if (this.options == null) { this.options = new ArrayList(); } @@ -154,10 +154,11 @@ public Builder addOptions(DialogNodeOutputOptionsElement options) { * Adds an suggestions to suggestions. * * @param suggestions the new suggestions - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder addSuggestions(DialogSuggestion suggestions) { - Validator.notNull(suggestions, "suggestions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(suggestions, + "suggestions cannot be null"); if (this.suggestions == null) { this.suggestions = new ArrayList(); } @@ -169,10 +170,11 @@ public Builder addSuggestions(DialogSuggestion suggestions) { * Adds an results to results. * * @param results the new results - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder addResults(SearchResult results) { - Validator.notNull(results, "results cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(results, + "results cannot be null"); if (this.results == null) { this.results = new ArrayList(); } @@ -184,7 +186,7 @@ public Builder addResults(SearchResult results) { * Set the responseType. * * @param responseType the responseType - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder responseType(String responseType) { this.responseType = responseType; @@ -195,7 +197,7 @@ public Builder responseType(String responseType) { * Set the text. * * @param text the text - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder text(String text) { this.text = text; @@ -206,7 +208,7 @@ public Builder text(String text) { * Set the time. * * @param time the time - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder time(long time) { this.time = time; @@ -217,7 +219,7 @@ public Builder time(long time) { * Set the typing. * * @param typing the typing - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder typing(Boolean typing) { this.typing = typing; @@ -228,7 +230,7 @@ public Builder typing(Boolean typing) { * Set the source. * * @param source the source - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder source(String source) { this.source = source; @@ -239,7 +241,7 @@ public Builder source(String source) { * Set the title. * * @param title the title - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder title(String title) { this.title = title; @@ -250,7 +252,7 @@ public Builder title(String title) { * Set the description. * * @param description the description - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder description(String description) { this.description = description; @@ -261,7 +263,7 @@ public Builder description(String description) { * Set the preference. * * @param preference the preference - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder preference(String preference) { this.preference = preference; @@ -273,7 +275,7 @@ public Builder preference(String preference) { * Existing options will be replaced. * * @param options the options - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder options(List options) { this.options = options; @@ -284,7 +286,7 @@ public Builder options(List options) { * Set the messageToHumanAgent. * * @param messageToHumanAgent the messageToHumanAgent - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder messageToHumanAgent(String messageToHumanAgent) { this.messageToHumanAgent = messageToHumanAgent; @@ -295,7 +297,7 @@ public Builder messageToHumanAgent(String messageToHumanAgent) { * Set the topic. * * @param topic the topic - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder topic(String topic) { this.topic = topic; @@ -307,7 +309,7 @@ public Builder topic(String topic) { * Existing suggestions will be replaced. * * @param suggestions the suggestions - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder suggestions(List suggestions) { this.suggestions = suggestions; @@ -318,7 +320,7 @@ public Builder suggestions(List suggestions) { * Set the header. * * @param header the header - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder header(String header) { this.header = header; @@ -330,7 +332,7 @@ public Builder header(String header) { * Existing results will be replaced. * * @param results the results - * @return the DialogRuntimeResponseGeneric builder + * @return the RuntimeResponseGeneric builder */ public Builder results(List results) { this.results = results; @@ -338,8 +340,9 @@ public Builder results(List results) { } } - private DialogRuntimeResponseGeneric(Builder builder) { - Validator.notNull(builder.responseType, "responseType cannot be null"); + private RuntimeResponseGeneric(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.responseType, + "responseType cannot be null"); responseType = builder.responseType; text = builder.text; time = builder.time; @@ -359,7 +362,7 @@ private DialogRuntimeResponseGeneric(Builder builder) { /** * New builder. * - * @return a DialogRuntimeResponseGeneric builder + * @return a RuntimeResponseGeneric builder */ public Builder newBuilder() { return new Builder(this); @@ -376,7 +379,7 @@ public Builder newBuilder() { * * @return the responseType */ - public String getResponseType() { + public String responseType() { return responseType; } @@ -387,7 +390,7 @@ public String getResponseType() { * * @return the text */ - public String getText() { + public String text() { return text; } @@ -398,7 +401,7 @@ public String getText() { * * @return the time */ - public Long getTime() { + public Long time() { return time; } @@ -409,7 +412,7 @@ public Long getTime() { * * @return the typing */ - public Boolean isTyping() { + public Boolean typing() { return typing; } @@ -420,7 +423,7 @@ public Boolean isTyping() { * * @return the source */ - public String getSource() { + public String source() { return source; } @@ -431,7 +434,7 @@ public String getSource() { * * @return the title */ - public String getTitle() { + public String title() { return title; } @@ -442,7 +445,7 @@ public String getTitle() { * * @return the description */ - public String getDescription() { + public String description() { return description; } @@ -453,7 +456,7 @@ public String getDescription() { * * @return the preference */ - public String getPreference() { + public String preference() { return preference; } @@ -464,7 +467,7 @@ public String getPreference() { * * @return the options */ - public List getOptions() { + public List options() { return options; } @@ -475,7 +478,7 @@ public List getOptions() { * * @return the messageToHumanAgent */ - public String getMessageToHumanAgent() { + public String messageToHumanAgent() { return messageToHumanAgent; } @@ -486,7 +489,7 @@ public String getMessageToHumanAgent() { * * @return the topic */ - public String getTopic() { + public String topic() { return topic; } @@ -500,7 +503,7 @@ public String getTopic() { * * @return the suggestions */ - public List getSuggestions() { + public List suggestions() { return suggestions; } @@ -511,7 +514,7 @@ public List getSuggestions() { * * @return the header */ - public String getHeader() { + public String header() { return header; } @@ -522,7 +525,7 @@ public String getHeader() { * * @return the results */ - public List getResults() { + public List results() { return results; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java index b2ce5658d29..f066faec166 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultHighlight.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultHighlight.java index 830d18ef361..7cdbf6fdef2 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultHighlight.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultHighlight.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultMetadata.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultMetadata.java index ab57dd0c0a3..ebf8818327c 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultMetadata.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResultMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SessionResponse.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SessionResponse.java index 41e9370fe4d..212a0ac691e 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SessionResponse.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SessionResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/package-info.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/package-info.java index b6001e4f396..80ceb741a14 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/package-info.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java index f713a971d0b..e0cb2554fc6 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java @@ -16,12 +16,10 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.compare_comply.v1.model.AddFeedbackOptions; import com.ibm.watson.compare_comply.v1.model.BatchStatus; @@ -48,14 +46,13 @@ import java.util.Map; import java.util.Map.Entry; import okhttp3.MultipartBody; -import okhttp3.RequestBody; /** * IBM Watson™ Compare and Comply analyzes governing documents to provide details about critical aspects of the * documents. * * @version v1 - * @see Compare Comply + * @see Compare Comply */ public class CompareComply extends BaseService { @@ -65,54 +62,19 @@ public class CompareComply extends BaseService { private String versionDate; /** - * Instantiates a new `CompareComply`. + * Constructs a new `CompareComply` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use CompareComply(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public CompareComply(String versionDate) { - super(SERVICE_NAME); + public CompareComply(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `CompareComply` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use CompareComply(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public CompareComply(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `CompareComply` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public CompareComply(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -125,7 +87,8 @@ public CompareComply(String versionDate, AuthenticatorConfig authenticatorConfig * @return a {@link ServiceCall} with a response type of {@link HTMLReturn} */ public ServiceCall convertToHtml(ConvertToHtmlOptions convertToHtmlOptions) { - Validator.notNull(convertToHtmlOptions, "convertToHtmlOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(convertToHtmlOptions, + "convertToHtmlOptions cannot be null"); String[] pathSegments = { "v1/html_conversion" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -139,9 +102,9 @@ public ServiceCall convertToHtml(ConvertToHtmlOptions convertToHtmlO } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody fileBody = RequestUtils.inputStreamBody(convertToHtmlOptions.file(), convertToHtmlOptions + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(convertToHtmlOptions.file(), convertToHtmlOptions .fileContentType()); - multipartBuilder.addFormDataPart("file", convertToHtmlOptions.filename(), fileBody); + multipartBuilder.addFormDataPart("file", "filename", fileBody); builder.body(multipartBuilder.build()); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { @@ -158,7 +121,8 @@ public ServiceCall convertToHtml(ConvertToHtmlOptions convertToHtmlO * @return a {@link ServiceCall} with a response type of {@link ClassifyReturn} */ public ServiceCall classifyElements(ClassifyElementsOptions classifyElementsOptions) { - Validator.notNull(classifyElementsOptions, "classifyElementsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(classifyElementsOptions, + "classifyElementsOptions cannot be null"); String[] pathSegments = { "v1/element_classification" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -172,7 +136,7 @@ public ServiceCall classifyElements(ClassifyElementsOptions clas } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody fileBody = RequestUtils.inputStreamBody(classifyElementsOptions.file(), classifyElementsOptions + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(classifyElementsOptions.file(), classifyElementsOptions .fileContentType()); multipartBuilder.addFormDataPart("file", "filename", fileBody); builder.body(multipartBuilder.build()); @@ -191,7 +155,8 @@ public ServiceCall classifyElements(ClassifyElementsOptions clas * @return a {@link ServiceCall} with a response type of {@link TableReturn} */ public ServiceCall extractTables(ExtractTablesOptions extractTablesOptions) { - Validator.notNull(extractTablesOptions, "extractTablesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(extractTablesOptions, + "extractTablesOptions cannot be null"); String[] pathSegments = { "v1/tables" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -205,7 +170,7 @@ public ServiceCall extractTables(ExtractTablesOptions extractTables } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody fileBody = RequestUtils.inputStreamBody(extractTablesOptions.file(), extractTablesOptions + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(extractTablesOptions.file(), extractTablesOptions .fileContentType()); multipartBuilder.addFormDataPart("file", "filename", fileBody); builder.body(multipartBuilder.build()); @@ -224,7 +189,8 @@ public ServiceCall extractTables(ExtractTablesOptions extractTables * @return a {@link ServiceCall} with a response type of {@link CompareReturn} */ public ServiceCall compareDocuments(CompareDocumentsOptions compareDocumentsOptions) { - Validator.notNull(compareDocumentsOptions, "compareDocumentsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(compareDocumentsOptions, + "compareDocumentsOptions cannot be null"); String[] pathSegments = { "v1/comparison" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -244,11 +210,11 @@ public ServiceCall compareDocuments(CompareDocumentsOptions compa } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody file1Body = RequestUtils.inputStreamBody(compareDocumentsOptions.file1(), compareDocumentsOptions - .file1ContentType()); + okhttp3.RequestBody file1Body = RequestUtils.inputStreamBody(compareDocumentsOptions.file1(), + compareDocumentsOptions.file1ContentType()); multipartBuilder.addFormDataPart("file_1", "filename", file1Body); - RequestBody file2Body = RequestUtils.inputStreamBody(compareDocumentsOptions.file2(), compareDocumentsOptions - .file2ContentType()); + okhttp3.RequestBody file2Body = RequestUtils.inputStreamBody(compareDocumentsOptions.file2(), + compareDocumentsOptions.file2ContentType()); multipartBuilder.addFormDataPart("file_2", "filename", file2Body); builder.body(multipartBuilder.build()); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -268,7 +234,8 @@ public ServiceCall compareDocuments(CompareDocumentsOptions compa * @return a {@link ServiceCall} with a response type of {@link FeedbackReturn} */ public ServiceCall addFeedback(AddFeedbackOptions addFeedbackOptions) { - Validator.notNull(addFeedbackOptions, "addFeedbackOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addFeedbackOptions, + "addFeedbackOptions cannot be null"); String[] pathSegments = { "v1/feedback" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -278,7 +245,8 @@ public ServiceCall addFeedback(AddFeedbackOptions addFeedbackOpt } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("feedback_data", GsonSingleton.getGson().toJsonTree(addFeedbackOptions.feedbackData())); + contentJson.add("feedback_data", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(addFeedbackOptions + .feedbackData())); if (addFeedbackOptions.userId() != null) { contentJson.addProperty("user_id", addFeedbackOptions.userId()); } @@ -385,7 +353,8 @@ public ServiceCall listFeedback() { * @return a {@link ServiceCall} with a response type of {@link GetFeedback} */ public ServiceCall getFeedback(GetFeedbackOptions getFeedbackOptions) { - Validator.notNull(getFeedbackOptions, "getFeedbackOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getFeedbackOptions, + "getFeedbackOptions cannot be null"); String[] pathSegments = { "v1/feedback" }; String[] pathParameters = { getFeedbackOptions.feedbackId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -414,7 +383,8 @@ public ServiceCall getFeedback(GetFeedbackOptions getFeedbackOption * @return a {@link ServiceCall} with a response type of {@link FeedbackDeleted} */ public ServiceCall deleteFeedback(DeleteFeedbackOptions deleteFeedbackOptions) { - Validator.notNull(deleteFeedbackOptions, "deleteFeedbackOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteFeedbackOptions, + "deleteFeedbackOptions cannot be null"); String[] pathSegments = { "v1/feedback" }; String[] pathParameters = { deleteFeedbackOptions.feedbackId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -440,9 +410,7 @@ public ServiceCall deleteFeedback(DeleteFeedbackOptions deleteF * Run Compare and Comply methods over a collection of input documents. * * **Important:** Batch processing requires the use of the [IBM Cloud Object Storage - * service] - * (https://cloud.ibm.com/docs/services/cloud-object-storage - * ?topic=cloud-object-storage-about#about-ibm-cloud-object-storage). + * service](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage). * The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using batch * processing](https://cloud.ibm.com/docs/services/compare-comply?topic=compare-comply-batching#before-you-batch). * @@ -450,7 +418,8 @@ public ServiceCall deleteFeedback(DeleteFeedbackOptions deleteF * @return a {@link ServiceCall} with a response type of {@link BatchStatus} */ public ServiceCall createBatch(CreateBatchOptions createBatchOptions) { - Validator.notNull(createBatchOptions, "createBatchOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createBatchOptions, + "createBatchOptions cannot be null"); String[] pathSegments = { "v1/batches" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -465,13 +434,13 @@ public ServiceCall createBatch(CreateBatchOptions createBatchOption } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody inputCredentialsFileBody = RequestUtils.inputStreamBody(createBatchOptions.inputCredentialsFile(), - "application/json"); + okhttp3.RequestBody inputCredentialsFileBody = RequestUtils.inputStreamBody(createBatchOptions + .inputCredentialsFile(), "application/json"); multipartBuilder.addFormDataPart("input_credentials_file", "filename", inputCredentialsFileBody); multipartBuilder.addFormDataPart("input_bucket_location", createBatchOptions.inputBucketLocation()); multipartBuilder.addFormDataPart("input_bucket_name", createBatchOptions.inputBucketName()); - RequestBody outputCredentialsFileBody = RequestUtils.inputStreamBody(createBatchOptions.outputCredentialsFile(), - "application/json"); + okhttp3.RequestBody outputCredentialsFileBody = RequestUtils.inputStreamBody(createBatchOptions + .outputCredentialsFile(), "application/json"); multipartBuilder.addFormDataPart("output_credentials_file", "filename", outputCredentialsFileBody); multipartBuilder.addFormDataPart("output_bucket_location", createBatchOptions.outputBucketLocation()); multipartBuilder.addFormDataPart("output_bucket_name", createBatchOptions.outputBucketName()); @@ -527,7 +496,8 @@ public ServiceCall listBatches() { * @return a {@link ServiceCall} with a response type of {@link BatchStatus} */ public ServiceCall getBatch(GetBatchOptions getBatchOptions) { - Validator.notNull(getBatchOptions, "getBatchOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getBatchOptions, + "getBatchOptions cannot be null"); String[] pathSegments = { "v1/batches" }; String[] pathParameters = { getBatchOptions.batchId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -554,7 +524,8 @@ public ServiceCall getBatch(GetBatchOptions getBatchOptions) { * @return a {@link ServiceCall} with a response type of {@link BatchStatus} */ public ServiceCall updateBatch(UpdateBatchOptions updateBatchOptions) { - Validator.notNull(updateBatchOptions, "updateBatchOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateBatchOptions, + "updateBatchOptions cannot be null"); String[] pathSegments = { "v1/batches" }; String[] pathParameters = { updateBatchOptions.batchId() }; RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/AddFeedbackOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/AddFeedbackOptions.java index ea00970455a..2b7f8137da5 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/AddFeedbackOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/AddFeedbackOptions.java @@ -13,7 +13,6 @@ package com.ibm.watson.compare_comply.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addFeedback options. @@ -97,7 +96,8 @@ public Builder comment(String comment) { } private AddFeedbackOptions(Builder builder) { - Validator.notNull(builder.feedbackData, "feedbackData cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.feedbackData, + "feedbackData cannot be null"); feedbackData = builder.feedbackData; userId = builder.userId; comment = builder.comment; diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Category.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Category.java index 32d71152a35..8df0445c5f7 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Category.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Category.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.compare_comply.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -82,6 +83,87 @@ public interface Label { @SerializedName("provenance_ids") private List provenanceIds; + /** + * Builder. + */ + public static class Builder { + private String label; + private List provenanceIds; + + private Builder(Category category) { + this.label = category.label; + this.provenanceIds = category.provenanceIds; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a Category. + * + * @return the category + */ + public Category build() { + return new Category(this); + } + + /** + * Adds an provenanceIds to provenanceIds. + * + * @param provenanceIds the new provenanceIds + * @return the Category builder + */ + public Builder addProvenanceIds(String provenanceIds) { + com.ibm.cloud.sdk.core.util.Validator.notNull(provenanceIds, + "provenanceIds cannot be null"); + if (this.provenanceIds == null) { + this.provenanceIds = new ArrayList(); + } + this.provenanceIds.add(provenanceIds); + return this; + } + + /** + * Set the label. + * + * @param label the label + * @return the Category builder + */ + public Builder label(String label) { + this.label = label; + return this; + } + + /** + * Set the provenanceIds. + * Existing provenanceIds will be replaced. + * + * @param provenanceIds the provenanceIds + * @return the Category builder + */ + public Builder provenanceIds(List provenanceIds) { + this.provenanceIds = provenanceIds; + return this; + } + } + + private Category(Builder builder) { + label = builder.label; + provenanceIds = builder.provenanceIds; + } + + /** + * New builder. + * + * @return a Category builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the label. * @@ -89,7 +171,7 @@ public interface Label { * * @return the label */ - public String getLabel() { + public String label() { return label; } @@ -100,25 +182,7 @@ public String getLabel() { * * @return the provenanceIds */ - public List getProvenanceIds() { + public List provenanceIds() { return provenanceIds; } - - /** - * Sets the label. - * - * @param label the new label - */ - public void setLabel(final String label) { - this.label = label; - } - - /** - * Sets the provenanceIds. - * - * @param provenanceIds the new provenanceIds - */ - public void setProvenanceIds(final List provenanceIds) { - this.provenanceIds = provenanceIds; - } } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ClassifyElementsOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ClassifyElementsOptions.java index 317388f0ba4..5f827a0fc21 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ClassifyElementsOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ClassifyElementsOptions.java @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The classifyElements options. @@ -127,7 +126,8 @@ public Builder file(File file) throws FileNotFoundException { } private ClassifyElementsOptions(Builder builder) { - Validator.notNull(builder.file, "file cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.file, + "file cannot be null"); file = builder.file; fileContentType = builder.fileContentType; model = builder.model; diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CompareDocumentsOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CompareDocumentsOptions.java index 4c5fba693ba..83cdd467356 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CompareDocumentsOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CompareDocumentsOptions.java @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The compareDocuments options. @@ -198,8 +197,10 @@ public Builder file2(File file2) throws FileNotFoundException { } private CompareDocumentsOptions(Builder builder) { - Validator.notNull(builder.file1, "file1 cannot be null"); - Validator.notNull(builder.file2, "file2 cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.file1, + "file1 cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.file2, + "file2 cannot be null"); file1 = builder.file1; file2 = builder.file2; file1ContentType = builder.file1ContentType; diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ConvertToHtmlOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ConvertToHtmlOptions.java index 9f4b3a96dfe..05553875c3a 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ConvertToHtmlOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ConvertToHtmlOptions.java @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The convertToHtml options. @@ -38,7 +37,6 @@ public interface Model { } private InputStream file; - private String filename; private String fileContentType; private String model; @@ -47,13 +45,11 @@ public interface Model { */ public static class Builder { private InputStream file; - private String filename; private String fileContentType; private String model; private Builder(ConvertToHtmlOptions convertToHtmlOptions) { this.file = convertToHtmlOptions.file; - this.filename = convertToHtmlOptions.filename; this.fileContentType = convertToHtmlOptions.fileContentType; this.model = convertToHtmlOptions.model; } @@ -68,11 +64,9 @@ public Builder() { * Instantiates a new builder with required properties. * * @param file the file - * @param filename the filename */ - public Builder(InputStream file, String filename) { + public Builder(InputStream file) { this.file = file; - this.filename = filename; } /** @@ -95,17 +89,6 @@ public Builder file(InputStream file) { return this; } - /** - * Set the filename. - * - * @param filename the filename - * @return the ConvertToHtmlOptions builder - */ - public Builder filename(String filename) { - this.filename = filename; - return this; - } - /** * Set the fileContentType. * @@ -138,16 +121,14 @@ public Builder model(String model) { */ public Builder file(File file) throws FileNotFoundException { this.file = new FileInputStream(file); - this.filename = file.getName(); return this; } } private ConvertToHtmlOptions(Builder builder) { - Validator.notNull(builder.file, "file cannot be null"); - Validator.notNull(builder.filename, "filename cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.file, + "file cannot be null"); file = builder.file; - filename = builder.filename; fileContentType = builder.fileContentType; model = builder.model; } @@ -172,17 +153,6 @@ public InputStream file() { return file; } - /** - * Gets the filename. - * - * The filename for file. - * - * @return the filename - */ - public String filename() { - return filename; - } - /** * Gets the fileContentType. * diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CreateBatchOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CreateBatchOptions.java index 35779c31275..ef8e4e102e2 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CreateBatchOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/CreateBatchOptions.java @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createBatch options. @@ -236,13 +235,20 @@ public Builder outputCredentialsFile(File outputCredentialsFile) throws FileNotF } private CreateBatchOptions(Builder builder) { - Validator.notNull(builder.function, "function cannot be null"); - Validator.notNull(builder.inputCredentialsFile, "inputCredentialsFile cannot be null"); - Validator.notNull(builder.inputBucketLocation, "inputBucketLocation cannot be null"); - Validator.notNull(builder.inputBucketName, "inputBucketName cannot be null"); - Validator.notNull(builder.outputCredentialsFile, "outputCredentialsFile cannot be null"); - Validator.notNull(builder.outputBucketLocation, "outputBucketLocation cannot be null"); - Validator.notNull(builder.outputBucketName, "outputBucketName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.function, + "function cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.inputCredentialsFile, + "inputCredentialsFile cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.inputBucketLocation, + "inputBucketLocation cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.inputBucketName, + "inputBucketName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.outputCredentialsFile, + "outputCredentialsFile cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.outputBucketLocation, + "outputBucketLocation cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.outputBucketName, + "outputBucketName cannot be null"); function = builder.function; inputCredentialsFile = builder.inputCredentialsFile; inputBucketLocation = builder.inputBucketLocation; diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/DeleteFeedbackOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/DeleteFeedbackOptions.java index 97b19f5294a..8c201b27cf1 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/DeleteFeedbackOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/DeleteFeedbackOptions.java @@ -13,7 +13,6 @@ package com.ibm.watson.compare_comply.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteFeedback options. @@ -95,7 +94,8 @@ public Builder model(String model) { } private DeleteFeedbackOptions(Builder builder) { - Validator.notEmpty(builder.feedbackId, "feedbackId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.feedbackId, + "feedbackId cannot be empty"); feedbackId = builder.feedbackId; model = builder.model; } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ExtractTablesOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ExtractTablesOptions.java index 3fd7f3d0d7d..51082a429ed 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ExtractTablesOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ExtractTablesOptions.java @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The extractTables options. @@ -127,7 +126,8 @@ public Builder file(File file) throws FileNotFoundException { } private ExtractTablesOptions(Builder builder) { - Validator.notNull(builder.file, "file cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.file, + "file cannot be null"); file = builder.file; fileContentType = builder.fileContentType; model = builder.model; diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/FeedbackDataInput.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/FeedbackDataInput.java index 09f618fbc94..cc0d6c65bef 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/FeedbackDataInput.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/FeedbackDataInput.java @@ -34,6 +34,182 @@ public class FeedbackDataInput extends GenericModel { @SerializedName("updated_labels") private UpdatedLabelsIn updatedLabels; + /** + * Builder. + */ + public static class Builder { + private String feedbackType; + private ShortDoc document; + private String modelId; + private String modelVersion; + private Location location; + private String text; + private OriginalLabelsIn originalLabels; + private UpdatedLabelsIn updatedLabels; + + private Builder(FeedbackDataInput feedbackDataInput) { + this.feedbackType = feedbackDataInput.feedbackType; + this.document = feedbackDataInput.document; + this.modelId = feedbackDataInput.modelId; + this.modelVersion = feedbackDataInput.modelVersion; + this.location = feedbackDataInput.location; + this.text = feedbackDataInput.text; + this.originalLabels = feedbackDataInput.originalLabels; + this.updatedLabels = feedbackDataInput.updatedLabels; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param feedbackType the feedbackType + * @param location the location + * @param text the text + * @param originalLabels the originalLabels + * @param updatedLabels the updatedLabels + */ + public Builder(String feedbackType, Location location, String text, OriginalLabelsIn originalLabels, + UpdatedLabelsIn updatedLabels) { + this.feedbackType = feedbackType; + this.location = location; + this.text = text; + this.originalLabels = originalLabels; + this.updatedLabels = updatedLabels; + } + + /** + * Builds a FeedbackDataInput. + * + * @return the feedbackDataInput + */ + public FeedbackDataInput build() { + return new FeedbackDataInput(this); + } + + /** + * Set the feedbackType. + * + * @param feedbackType the feedbackType + * @return the FeedbackDataInput builder + */ + public Builder feedbackType(String feedbackType) { + this.feedbackType = feedbackType; + return this; + } + + /** + * Set the document. + * + * @param document the document + * @return the FeedbackDataInput builder + */ + public Builder document(ShortDoc document) { + this.document = document; + return this; + } + + /** + * Set the modelId. + * + * @param modelId the modelId + * @return the FeedbackDataInput builder + */ + public Builder modelId(String modelId) { + this.modelId = modelId; + return this; + } + + /** + * Set the modelVersion. + * + * @param modelVersion the modelVersion + * @return the FeedbackDataInput builder + */ + public Builder modelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * Set the location. + * + * @param location the location + * @return the FeedbackDataInput builder + */ + public Builder location(Location location) { + this.location = location; + return this; + } + + /** + * Set the text. + * + * @param text the text + * @return the FeedbackDataInput builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + + /** + * Set the originalLabels. + * + * @param originalLabels the originalLabels + * @return the FeedbackDataInput builder + */ + public Builder originalLabels(OriginalLabelsIn originalLabels) { + this.originalLabels = originalLabels; + return this; + } + + /** + * Set the updatedLabels. + * + * @param updatedLabels the updatedLabels + * @return the FeedbackDataInput builder + */ + public Builder updatedLabels(UpdatedLabelsIn updatedLabels) { + this.updatedLabels = updatedLabels; + return this; + } + } + + private FeedbackDataInput(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.feedbackType, + "feedbackType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.location, + "location cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.originalLabels, + "originalLabels cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.updatedLabels, + "updatedLabels cannot be null"); + feedbackType = builder.feedbackType; + document = builder.document; + modelId = builder.modelId; + modelVersion = builder.modelVersion; + location = builder.location; + text = builder.text; + originalLabels = builder.originalLabels; + updatedLabels = builder.updatedLabels; + } + + /** + * New builder. + * + * @return a FeedbackDataInput builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the feedbackType. * @@ -41,7 +217,7 @@ public class FeedbackDataInput extends GenericModel { * * @return the feedbackType */ - public String getFeedbackType() { + public String feedbackType() { return feedbackType; } @@ -52,7 +228,7 @@ public String getFeedbackType() { * * @return the document */ - public ShortDoc getDocument() { + public ShortDoc document() { return document; } @@ -63,7 +239,7 @@ public ShortDoc getDocument() { * * @return the modelId */ - public String getModelId() { + public String modelId() { return modelId; } @@ -74,7 +250,7 @@ public String getModelId() { * * @return the modelVersion */ - public String getModelVersion() { + public String modelVersion() { return modelVersion; } @@ -86,7 +262,7 @@ public String getModelVersion() { * * @return the location */ - public Location getLocation() { + public Location location() { return location; } @@ -97,7 +273,7 @@ public Location getLocation() { * * @return the text */ - public String getText() { + public String text() { return text; } @@ -108,7 +284,7 @@ public String getText() { * * @return the originalLabels */ - public OriginalLabelsIn getOriginalLabels() { + public OriginalLabelsIn originalLabels() { return originalLabels; } @@ -119,79 +295,7 @@ public OriginalLabelsIn getOriginalLabels() { * * @return the updatedLabels */ - public UpdatedLabelsIn getUpdatedLabels() { + public UpdatedLabelsIn updatedLabels() { return updatedLabels; } - - /** - * Sets the feedbackType. - * - * @param feedbackType the new feedbackType - */ - public void setFeedbackType(final String feedbackType) { - this.feedbackType = feedbackType; - } - - /** - * Sets the document. - * - * @param document the new document - */ - public void setDocument(final ShortDoc document) { - this.document = document; - } - - /** - * Sets the modelId. - * - * @param modelId the new modelId - */ - public void setModelId(final String modelId) { - this.modelId = modelId; - } - - /** - * Sets the modelVersion. - * - * @param modelVersion the new modelVersion - */ - public void setModelVersion(final String modelVersion) { - this.modelVersion = modelVersion; - } - - /** - * Sets the location. - * - * @param location the new location - */ - public void setLocation(final Location location) { - this.location = location; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(final String text) { - this.text = text; - } - - /** - * Sets the originalLabels. - * - * @param originalLabels the new originalLabels - */ - public void setOriginalLabels(final OriginalLabelsIn originalLabels) { - this.originalLabels = originalLabels; - } - - /** - * Sets the updatedLabels. - * - * @param updatedLabels the new updatedLabels - */ - public void setUpdatedLabels(final UpdatedLabelsIn updatedLabels) { - this.updatedLabels = updatedLabels; - } } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetBatchOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetBatchOptions.java index e0aacccbf4f..624951702e0 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetBatchOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetBatchOptions.java @@ -13,7 +13,6 @@ package com.ibm.watson.compare_comply.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getBatch options. @@ -69,7 +68,8 @@ public Builder batchId(String batchId) { } private GetBatchOptions(Builder builder) { - Validator.notEmpty(builder.batchId, "batchId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.batchId, + "batchId cannot be empty"); batchId = builder.batchId; } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetFeedbackOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetFeedbackOptions.java index 118d992ef76..bd04dd2ba4b 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetFeedbackOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/GetFeedbackOptions.java @@ -13,7 +13,6 @@ package com.ibm.watson.compare_comply.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getFeedback options. @@ -95,7 +94,8 @@ public Builder model(String model) { } private GetFeedbackOptions(Builder builder) { - Validator.notEmpty(builder.feedbackId, "feedbackId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.feedbackId, + "feedbackId cannot be empty"); feedbackId = builder.feedbackId; model = builder.model; } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Label.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Label.java index 28303447b1a..aebda243048 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Label.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Label.java @@ -23,6 +23,85 @@ public class Label extends GenericModel { private String nature; private String party; + /** + * Builder. + */ + public static class Builder { + private String nature; + private String party; + + private Builder(Label label) { + this.nature = label.nature; + this.party = label.party; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param nature the nature + * @param party the party + */ + public Builder(String nature, String party) { + this.nature = nature; + this.party = party; + } + + /** + * Builds a Label. + * + * @return the label + */ + public Label build() { + return new Label(this); + } + + /** + * Set the nature. + * + * @param nature the nature + * @return the Label builder + */ + public Builder nature(String nature) { + this.nature = nature; + return this; + } + + /** + * Set the party. + * + * @param party the party + * @return the Label builder + */ + public Builder party(String party) { + this.party = party; + return this; + } + } + + private Label(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.nature, + "nature cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.party, + "party cannot be null"); + nature = builder.nature; + party = builder.party; + } + + /** + * New builder. + * + * @return a Label builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the nature. * @@ -30,7 +109,7 @@ public class Label extends GenericModel { * * @return the nature */ - public String getNature() { + public String nature() { return nature; } @@ -41,25 +120,7 @@ public String getNature() { * * @return the party */ - public String getParty() { + public String party() { return party; } - - /** - * Sets the nature. - * - * @param nature the new nature - */ - public void setNature(final String nature) { - this.nature = nature; - } - - /** - * Sets the party. - * - * @param party the new party - */ - public void setParty(final String party) { - this.party = party; - } } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Location.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Location.java index ede58433505..e168754823b 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Location.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/Location.java @@ -23,6 +23,85 @@ public class Location extends GenericModel { private Long begin; private Long end; + /** + * Builder. + */ + public static class Builder { + private Long begin; + private Long end; + + private Builder(Location location) { + this.begin = location.begin; + this.end = location.end; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param begin the begin + * @param end the end + */ + public Builder(Long begin, Long end) { + this.begin = begin; + this.end = end; + } + + /** + * Builds a Location. + * + * @return the location + */ + public Location build() { + return new Location(this); + } + + /** + * Set the begin. + * + * @param begin the begin + * @return the Location builder + */ + public Builder begin(long begin) { + this.begin = begin; + return this; + } + + /** + * Set the end. + * + * @param end the end + * @return the Location builder + */ + public Builder end(long end) { + this.end = end; + return this; + } + } + + private Location(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.begin, + "begin cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.end, + "end cannot be null"); + begin = builder.begin; + end = builder.end; + } + + /** + * New builder. + * + * @return a Location builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the begin. * @@ -30,7 +109,7 @@ public class Location extends GenericModel { * * @return the begin */ - public Long getBegin() { + public Long begin() { return begin; } @@ -41,25 +120,7 @@ public Long getBegin() { * * @return the end */ - public Long getEnd() { + public Long end() { return end; } - - /** - * Sets the begin. - * - * @param begin the new begin - */ - public void setBegin(final long begin) { - this.begin = begin; - } - - /** - * Sets the end. - * - * @param end the new end - */ - public void setEnd(final long end) { - this.end = end; - } } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/OriginalLabelsIn.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/OriginalLabelsIn.java index 2139b0cc6ad..3f0097ba1d4 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/OriginalLabelsIn.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/OriginalLabelsIn.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.compare_comply.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,6 +25,119 @@ public class OriginalLabelsIn extends GenericModel { private List types; private List categories; + /** + * Builder. + */ + public static class Builder { + private List types; + private List categories; + + private Builder(OriginalLabelsIn originalLabelsIn) { + this.types = originalLabelsIn.types; + this.categories = originalLabelsIn.categories; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param types the types + * @param categories the categories + */ + public Builder(List types, List categories) { + this.types = types; + this.categories = categories; + } + + /** + * Builds a OriginalLabelsIn. + * + * @return the originalLabelsIn + */ + public OriginalLabelsIn build() { + return new OriginalLabelsIn(this); + } + + /** + * Adds an types to types. + * + * @param types the new types + * @return the OriginalLabelsIn builder + */ + public Builder addTypes(TypeLabel types) { + com.ibm.cloud.sdk.core.util.Validator.notNull(types, + "types cannot be null"); + if (this.types == null) { + this.types = new ArrayList(); + } + this.types.add(types); + return this; + } + + /** + * Adds an categories to categories. + * + * @param categories the new categories + * @return the OriginalLabelsIn builder + */ + public Builder addCategories(Category categories) { + com.ibm.cloud.sdk.core.util.Validator.notNull(categories, + "categories cannot be null"); + if (this.categories == null) { + this.categories = new ArrayList(); + } + this.categories.add(categories); + return this; + } + + /** + * Set the types. + * Existing types will be replaced. + * + * @param types the types + * @return the OriginalLabelsIn builder + */ + public Builder types(List types) { + this.types = types; + return this; + } + + /** + * Set the categories. + * Existing categories will be replaced. + * + * @param categories the categories + * @return the OriginalLabelsIn builder + */ + public Builder categories(List categories) { + this.categories = categories; + return this; + } + } + + private OriginalLabelsIn(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.types, + "types cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.categories, + "categories cannot be null"); + types = builder.types; + categories = builder.categories; + } + + /** + * New builder. + * + * @return a OriginalLabelsIn builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the types. * @@ -31,7 +145,7 @@ public class OriginalLabelsIn extends GenericModel { * * @return the types */ - public List getTypes() { + public List types() { return types; } @@ -42,25 +156,7 @@ public List getTypes() { * * @return the categories */ - public List getCategories() { + public List categories() { return categories; } - - /** - * Sets the types. - * - * @param types the new types - */ - public void setTypes(final List types) { - this.types = types; - } - - /** - * Sets the categories. - * - * @param categories the new categories - */ - public void setCategories(final List categories) { - this.categories = categories; - } } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ShortDoc.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ShortDoc.java index 266b3a09d82..5ca7695cc68 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ShortDoc.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/ShortDoc.java @@ -22,6 +22,70 @@ public class ShortDoc extends GenericModel { private String title; private String hash; + /** + * Builder. + */ + public static class Builder { + private String title; + private String hash; + + private Builder(ShortDoc shortDoc) { + this.title = shortDoc.title; + this.hash = shortDoc.hash; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ShortDoc. + * + * @return the shortDoc + */ + public ShortDoc build() { + return new ShortDoc(this); + } + + /** + * Set the title. + * + * @param title the title + * @return the ShortDoc builder + */ + public Builder title(String title) { + this.title = title; + return this; + } + + /** + * Set the hash. + * + * @param hash the hash + * @return the ShortDoc builder + */ + public Builder hash(String hash) { + this.hash = hash; + return this; + } + } + + private ShortDoc(Builder builder) { + title = builder.title; + hash = builder.hash; + } + + /** + * New builder. + * + * @return a ShortDoc builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the title. * @@ -29,7 +93,7 @@ public class ShortDoc extends GenericModel { * * @return the title */ - public String getTitle() { + public String title() { return title; } @@ -40,25 +104,7 @@ public String getTitle() { * * @return the hash */ - public String getHash() { + public String hash() { return hash; } - - /** - * Sets the title. - * - * @param title the new title - */ - public void setTitle(final String title) { - this.title = title; - } - - /** - * Sets the hash. - * - * @param hash the new hash - */ - public void setHash(final String hash) { - this.hash = hash; - } } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/TypeLabel.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/TypeLabel.java index 0fc561ffb98..18bec98fc36 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/TypeLabel.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/TypeLabel.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.compare_comply.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -26,6 +27,87 @@ public class TypeLabel extends GenericModel { @SerializedName("provenance_ids") private List provenanceIds; + /** + * Builder. + */ + public static class Builder { + private Label label; + private List provenanceIds; + + private Builder(TypeLabel typeLabel) { + this.label = typeLabel.label; + this.provenanceIds = typeLabel.provenanceIds; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a TypeLabel. + * + * @return the typeLabel + */ + public TypeLabel build() { + return new TypeLabel(this); + } + + /** + * Adds an provenanceIds to provenanceIds. + * + * @param provenanceIds the new provenanceIds + * @return the TypeLabel builder + */ + public Builder addProvenanceIds(String provenanceIds) { + com.ibm.cloud.sdk.core.util.Validator.notNull(provenanceIds, + "provenanceIds cannot be null"); + if (this.provenanceIds == null) { + this.provenanceIds = new ArrayList(); + } + this.provenanceIds.add(provenanceIds); + return this; + } + + /** + * Set the label. + * + * @param label the label + * @return the TypeLabel builder + */ + public Builder label(Label label) { + this.label = label; + return this; + } + + /** + * Set the provenanceIds. + * Existing provenanceIds will be replaced. + * + * @param provenanceIds the provenanceIds + * @return the TypeLabel builder + */ + public Builder provenanceIds(List provenanceIds) { + this.provenanceIds = provenanceIds; + return this; + } + } + + private TypeLabel(Builder builder) { + label = builder.label; + provenanceIds = builder.provenanceIds; + } + + /** + * New builder. + * + * @return a TypeLabel builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the label. * @@ -34,7 +116,7 @@ public class TypeLabel extends GenericModel { * * @return the label */ - public Label getLabel() { + public Label label() { return label; } @@ -45,25 +127,7 @@ public Label getLabel() { * * @return the provenanceIds */ - public List getProvenanceIds() { + public List provenanceIds() { return provenanceIds; } - - /** - * Sets the label. - * - * @param label the new label - */ - public void setLabel(final Label label) { - this.label = label; - } - - /** - * Sets the provenanceIds. - * - * @param provenanceIds the new provenanceIds - */ - public void setProvenanceIds(final List provenanceIds) { - this.provenanceIds = provenanceIds; - } } diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdateBatchOptions.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdateBatchOptions.java index be92c227d27..a2f30f00b2a 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdateBatchOptions.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdateBatchOptions.java @@ -13,7 +13,6 @@ package com.ibm.watson.compare_comply.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateBatch options. @@ -121,8 +120,10 @@ public Builder model(String model) { } private UpdateBatchOptions(Builder builder) { - Validator.notEmpty(builder.batchId, "batchId cannot be empty"); - Validator.notNull(builder.action, "action cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.batchId, + "batchId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.action, + "action cannot be null"); batchId = builder.batchId; action = builder.action; model = builder.model; diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdatedLabelsIn.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdatedLabelsIn.java index e3a6687fbc8..7e53acf7c7e 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdatedLabelsIn.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/UpdatedLabelsIn.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.compare_comply.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,6 +25,119 @@ public class UpdatedLabelsIn extends GenericModel { private List types; private List categories; + /** + * Builder. + */ + public static class Builder { + private List types; + private List categories; + + private Builder(UpdatedLabelsIn updatedLabelsIn) { + this.types = updatedLabelsIn.types; + this.categories = updatedLabelsIn.categories; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param types the types + * @param categories the categories + */ + public Builder(List types, List categories) { + this.types = types; + this.categories = categories; + } + + /** + * Builds a UpdatedLabelsIn. + * + * @return the updatedLabelsIn + */ + public UpdatedLabelsIn build() { + return new UpdatedLabelsIn(this); + } + + /** + * Adds an types to types. + * + * @param types the new types + * @return the UpdatedLabelsIn builder + */ + public Builder addTypes(TypeLabel types) { + com.ibm.cloud.sdk.core.util.Validator.notNull(types, + "types cannot be null"); + if (this.types == null) { + this.types = new ArrayList(); + } + this.types.add(types); + return this; + } + + /** + * Adds an categories to categories. + * + * @param categories the new categories + * @return the UpdatedLabelsIn builder + */ + public Builder addCategories(Category categories) { + com.ibm.cloud.sdk.core.util.Validator.notNull(categories, + "categories cannot be null"); + if (this.categories == null) { + this.categories = new ArrayList(); + } + this.categories.add(categories); + return this; + } + + /** + * Set the types. + * Existing types will be replaced. + * + * @param types the types + * @return the UpdatedLabelsIn builder + */ + public Builder types(List types) { + this.types = types; + return this; + } + + /** + * Set the categories. + * Existing categories will be replaced. + * + * @param categories the categories + * @return the UpdatedLabelsIn builder + */ + public Builder categories(List categories) { + this.categories = categories; + return this; + } + } + + private UpdatedLabelsIn(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.types, + "types cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.categories, + "categories cannot be null"); + types = builder.types; + categories = builder.categories; + } + + /** + * New builder. + * + * @return a UpdatedLabelsIn builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the types. * @@ -31,7 +145,7 @@ public class UpdatedLabelsIn extends GenericModel { * * @return the types */ - public List getTypes() { + public List types() { return types; } @@ -42,25 +156,7 @@ public List getTypes() { * * @return the categories */ - public List getCategories() { + public List categories() { return categories; } - - /** - * Sets the types. - * - * @param types the new types - */ - public void setTypes(final List types) { - this.types = types; - } - - /** - * Sets the categories. - * - * @param categories the new categories - */ - public void setCategories(final List categories) { - this.categories = categories; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java index 63755717096..f80dba529b2 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,12 +16,10 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.discovery.v1.model.AddDocumentOptions; import com.ibm.watson.discovery.v1.model.AddTrainingDataOptions; @@ -124,7 +122,6 @@ import java.util.Map; import java.util.Map.Entry; import okhttp3.MultipartBody; -import okhttp3.RequestBody; /** * IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to @@ -133,7 +130,7 @@ * filtering of results. * * @version v1 - * @see Discovery + * @see Discovery */ public class Discovery extends BaseService { @@ -143,54 +140,19 @@ public class Discovery extends BaseService { private String versionDate; /** - * Instantiates a new `Discovery`. + * Constructs a new `Discovery` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use Discovery(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public Discovery(String versionDate) { - super(SERVICE_NAME); + public Discovery(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `Discovery` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use Discovery(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public Discovery(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `Discovery` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public Discovery(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -206,7 +168,8 @@ public Discovery(String versionDate, AuthenticatorConfig authenticatorConfig) { * @return a {@link ServiceCall} with a response type of {@link Environment} */ public ServiceCall createEnvironment(CreateEnvironmentOptions createEnvironmentOptions) { - Validator.notNull(createEnvironmentOptions, "createEnvironmentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createEnvironmentOptions, + "createEnvironmentOptions cannot be null"); String[] pathSegments = { "v1/environments" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -276,7 +239,8 @@ public ServiceCall listEnvironments() { * @return a {@link ServiceCall} with a response type of {@link Environment} */ public ServiceCall getEnvironment(GetEnvironmentOptions getEnvironmentOptions) { - Validator.notNull(getEnvironmentOptions, "getEnvironmentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getEnvironmentOptions, + "getEnvironmentOptions cannot be null"); String[] pathSegments = { "v1/environments" }; String[] pathParameters = { getEnvironmentOptions.environmentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -303,7 +267,8 @@ public ServiceCall getEnvironment(GetEnvironmentOptions getEnvironm * @return a {@link ServiceCall} with a response type of {@link Environment} */ public ServiceCall updateEnvironment(UpdateEnvironmentOptions updateEnvironmentOptions) { - Validator.notNull(updateEnvironmentOptions, "updateEnvironmentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateEnvironmentOptions, + "updateEnvironmentOptions cannot be null"); String[] pathSegments = { "v1/environments" }; String[] pathParameters = { updateEnvironmentOptions.environmentId() }; RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -338,7 +303,8 @@ public ServiceCall updateEnvironment(UpdateEnvironmentOptions updat * @return a {@link ServiceCall} with a response type of {@link DeleteEnvironmentResponse} */ public ServiceCall deleteEnvironment(DeleteEnvironmentOptions deleteEnvironmentOptions) { - Validator.notNull(deleteEnvironmentOptions, "deleteEnvironmentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteEnvironmentOptions, + "deleteEnvironmentOptions cannot be null"); String[] pathSegments = { "v1/environments" }; String[] pathParameters = { deleteEnvironmentOptions.environmentId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -364,7 +330,8 @@ public ServiceCall deleteEnvironment(DeleteEnvironmen * @return a {@link ServiceCall} with a response type of {@link ListCollectionFieldsResponse} */ public ServiceCall listFields(ListFieldsOptions listFieldsOptions) { - Validator.notNull(listFieldsOptions, "listFieldsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listFieldsOptions, + "listFieldsOptions cannot be null"); String[] pathSegments = { "v1/environments", "fields" }; String[] pathParameters = { listFieldsOptions.environmentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -399,7 +366,8 @@ public ServiceCall listFields(ListFieldsOptions li * @return a {@link ServiceCall} with a response type of {@link Configuration} */ public ServiceCall createConfiguration(CreateConfigurationOptions createConfigurationOptions) { - Validator.notNull(createConfigurationOptions, "createConfigurationOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createConfigurationOptions, + "createConfigurationOptions cannot be null"); String[] pathSegments = { "v1/environments", "configurations" }; String[] pathParameters = { createConfigurationOptions.environmentId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -416,17 +384,20 @@ public ServiceCall createConfiguration(CreateConfigurationOptions contentJson.addProperty("description", createConfigurationOptions.description()); } if (createConfigurationOptions.conversions() != null) { - contentJson.add("conversions", GsonSingleton.getGson().toJsonTree(createConfigurationOptions.conversions())); + contentJson.add("conversions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createConfigurationOptions.conversions())); } if (createConfigurationOptions.enrichments() != null) { - contentJson.add("enrichments", GsonSingleton.getGson().toJsonTree(createConfigurationOptions.enrichments())); + contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createConfigurationOptions.enrichments())); } if (createConfigurationOptions.normalizations() != null) { - contentJson.add("normalizations", GsonSingleton.getGson().toJsonTree(createConfigurationOptions - .normalizations())); + contentJson.add("normalizations", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createConfigurationOptions.normalizations())); } if (createConfigurationOptions.source() != null) { - contentJson.add("source", GsonSingleton.getGson().toJsonTree(createConfigurationOptions.source())); + contentJson.add("source", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createConfigurationOptions.source())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -445,7 +416,8 @@ public ServiceCall createConfiguration(CreateConfigurationOptions */ public ServiceCall listConfigurations( ListConfigurationsOptions listConfigurationsOptions) { - Validator.notNull(listConfigurationsOptions, "listConfigurationsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listConfigurationsOptions, + "listConfigurationsOptions cannot be null"); String[] pathSegments = { "v1/environments", "configurations" }; String[] pathParameters = { listConfigurationsOptions.environmentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -472,7 +444,8 @@ public ServiceCall listConfigurations( * @return a {@link ServiceCall} with a response type of {@link Configuration} */ public ServiceCall getConfiguration(GetConfigurationOptions getConfigurationOptions) { - Validator.notNull(getConfigurationOptions, "getConfigurationOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getConfigurationOptions, + "getConfigurationOptions cannot be null"); String[] pathSegments = { "v1/environments", "configurations" }; String[] pathParameters = { getConfigurationOptions.environmentId(), getConfigurationOptions.configurationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -504,7 +477,8 @@ public ServiceCall getConfiguration(GetConfigurationOptions getCo * @return a {@link ServiceCall} with a response type of {@link Configuration} */ public ServiceCall updateConfiguration(UpdateConfigurationOptions updateConfigurationOptions) { - Validator.notNull(updateConfigurationOptions, "updateConfigurationOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateConfigurationOptions, + "updateConfigurationOptions cannot be null"); String[] pathSegments = { "v1/environments", "configurations" }; String[] pathParameters = { updateConfigurationOptions.environmentId(), updateConfigurationOptions .configurationId() }; @@ -522,17 +496,20 @@ public ServiceCall updateConfiguration(UpdateConfigurationOptions contentJson.addProperty("description", updateConfigurationOptions.description()); } if (updateConfigurationOptions.conversions() != null) { - contentJson.add("conversions", GsonSingleton.getGson().toJsonTree(updateConfigurationOptions.conversions())); + contentJson.add("conversions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateConfigurationOptions.conversions())); } if (updateConfigurationOptions.enrichments() != null) { - contentJson.add("enrichments", GsonSingleton.getGson().toJsonTree(updateConfigurationOptions.enrichments())); + contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateConfigurationOptions.enrichments())); } if (updateConfigurationOptions.normalizations() != null) { - contentJson.add("normalizations", GsonSingleton.getGson().toJsonTree(updateConfigurationOptions - .normalizations())); + contentJson.add("normalizations", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateConfigurationOptions.normalizations())); } if (updateConfigurationOptions.source() != null) { - contentJson.add("source", GsonSingleton.getGson().toJsonTree(updateConfigurationOptions.source())); + contentJson.add("source", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateConfigurationOptions.source())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -554,7 +531,8 @@ public ServiceCall updateConfiguration(UpdateConfigurationOptions */ public ServiceCall deleteConfiguration( DeleteConfigurationOptions deleteConfigurationOptions) { - Validator.notNull(deleteConfigurationOptions, "deleteConfigurationOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteConfigurationOptions, + "deleteConfigurationOptions cannot be null"); String[] pathSegments = { "v1/environments", "configurations" }; String[] pathParameters = { deleteConfigurationOptions.environmentId(), deleteConfigurationOptions .configurationId() }; @@ -586,8 +564,9 @@ public ServiceCall deleteConfiguration( */ public ServiceCall testConfigurationInEnvironment( TestConfigurationInEnvironmentOptions testConfigurationInEnvironmentOptions) { - Validator.notNull(testConfigurationInEnvironmentOptions, "testConfigurationInEnvironmentOptions cannot be null"); - Validator.isTrue((testConfigurationInEnvironmentOptions.configuration() != null) + com.ibm.cloud.sdk.core.util.Validator.notNull(testConfigurationInEnvironmentOptions, + "testConfigurationInEnvironmentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((testConfigurationInEnvironmentOptions.configuration() != null) || (testConfigurationInEnvironmentOptions.file() != null) || (testConfigurationInEnvironmentOptions .metadata() != null), "At least one of configuration, file, or metadata must be supplied."); String[] pathSegments = { "v1/environments", "preview" }; @@ -612,7 +591,7 @@ public ServiceCall testConfigurationInEnvironment( multipartBuilder.addFormDataPart("configuration", testConfigurationInEnvironmentOptions.configuration()); } if (testConfigurationInEnvironmentOptions.file() != null) { - RequestBody fileBody = RequestUtils.inputStreamBody(testConfigurationInEnvironmentOptions.file(), + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(testConfigurationInEnvironmentOptions.file(), testConfigurationInEnvironmentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", testConfigurationInEnvironmentOptions.filename(), fileBody); } @@ -633,7 +612,8 @@ public ServiceCall testConfigurationInEnvironment( * @return a {@link ServiceCall} with a response type of {@link Collection} */ public ServiceCall createCollection(CreateCollectionOptions createCollectionOptions) { - Validator.notNull(createCollectionOptions, "createCollectionOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createCollectionOptions, + "createCollectionOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections" }; String[] pathParameters = { createCollectionOptions.environmentId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -671,7 +651,8 @@ public ServiceCall createCollection(CreateCollectionOptions createCo * @return a {@link ServiceCall} with a response type of {@link ListCollectionsResponse} */ public ServiceCall listCollections(ListCollectionsOptions listCollectionsOptions) { - Validator.notNull(listCollectionsOptions, "listCollectionsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listCollectionsOptions, + "listCollectionsOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections" }; String[] pathParameters = { listCollectionsOptions.environmentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -698,7 +679,8 @@ public ServiceCall listCollections(ListCollectionsOptio * @return a {@link ServiceCall} with a response type of {@link Collection} */ public ServiceCall getCollection(GetCollectionOptions getCollectionOptions) { - Validator.notNull(getCollectionOptions, "getCollectionOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getCollectionOptions, + "getCollectionOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections" }; String[] pathParameters = { getCollectionOptions.environmentId(), getCollectionOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -722,7 +704,8 @@ public ServiceCall getCollection(GetCollectionOptions getCollectionO * @return a {@link ServiceCall} with a response type of {@link Collection} */ public ServiceCall updateCollection(UpdateCollectionOptions updateCollectionOptions) { - Validator.notNull(updateCollectionOptions, "updateCollectionOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateCollectionOptions, + "updateCollectionOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections" }; String[] pathParameters = { updateCollectionOptions.environmentId(), updateCollectionOptions.collectionId() }; RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -757,7 +740,8 @@ public ServiceCall updateCollection(UpdateCollectionOptions updateCo * @return a {@link ServiceCall} with a response type of {@link DeleteCollectionResponse} */ public ServiceCall deleteCollection(DeleteCollectionOptions deleteCollectionOptions) { - Validator.notNull(deleteCollectionOptions, "deleteCollectionOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCollectionOptions, + "deleteCollectionOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections" }; String[] pathParameters = { deleteCollectionOptions.environmentId(), deleteCollectionOptions.collectionId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -784,7 +768,8 @@ public ServiceCall deleteCollection(DeleteCollectionOp */ public ServiceCall listCollectionFields( ListCollectionFieldsOptions listCollectionFieldsOptions) { - Validator.notNull(listCollectionFieldsOptions, "listCollectionFieldsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listCollectionFieldsOptions, + "listCollectionFieldsOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "fields" }; String[] pathParameters = { listCollectionFieldsOptions.environmentId(), listCollectionFieldsOptions .collectionId() }; @@ -812,7 +797,8 @@ public ServiceCall listCollectionFields( * @return a {@link ServiceCall} with a response type of {@link Expansions} */ public ServiceCall listExpansions(ListExpansionsOptions listExpansionsOptions) { - Validator.notNull(listExpansionsOptions, "listExpansionsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listExpansionsOptions, + "listExpansionsOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "expansions" }; String[] pathParameters = { listExpansionsOptions.environmentId(), listExpansionsOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -833,14 +819,14 @@ public ServiceCall listExpansions(ListExpansionsOptions listExpansio * Create or update expansion list. * * Create or replace the Expansion list for this collection. The maximum number of expanded terms per collection is - * `500`. - * The current expansion list is replaced with the uploaded content. + * `500`. The current expansion list is replaced with the uploaded content. * * @param createExpansionsOptions the {@link CreateExpansionsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Expansions} */ public ServiceCall createExpansions(CreateExpansionsOptions createExpansionsOptions) { - Validator.notNull(createExpansionsOptions, "createExpansionsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createExpansionsOptions, + "createExpansionsOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "expansions" }; String[] pathParameters = { createExpansionsOptions.environmentId(), createExpansionsOptions.collectionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -852,7 +838,8 @@ public ServiceCall createExpansions(CreateExpansionsOptions createEx } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("expansions", GsonSingleton.getGson().toJsonTree(createExpansionsOptions.expansions())); + contentJson.add("expansions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createExpansionsOptions + .expansions())); builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { @@ -870,7 +857,8 @@ public ServiceCall createExpansions(CreateExpansionsOptions createEx * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteExpansions(DeleteExpansionsOptions deleteExpansionsOptions) { - Validator.notNull(deleteExpansionsOptions, "deleteExpansionsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteExpansionsOptions, + "deleteExpansionsOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "expansions" }; String[] pathParameters = { deleteExpansionsOptions.environmentId(), deleteExpansionsOptions.collectionId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -895,7 +883,8 @@ public ServiceCall deleteExpansions(DeleteExpansionsOptions deleteExpansio */ public ServiceCall getTokenizationDictionaryStatus( GetTokenizationDictionaryStatusOptions getTokenizationDictionaryStatusOptions) { - Validator.notNull(getTokenizationDictionaryStatusOptions, "getTokenizationDictionaryStatusOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getTokenizationDictionaryStatusOptions, + "getTokenizationDictionaryStatusOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "word_lists/tokenization_dictionary" }; String[] pathParameters = { getTokenizationDictionaryStatusOptions.environmentId(), getTokenizationDictionaryStatusOptions.collectionId() }; @@ -924,7 +913,8 @@ public ServiceCall getTokenizationDictionaryStatus( */ public ServiceCall createTokenizationDictionary( CreateTokenizationDictionaryOptions createTokenizationDictionaryOptions) { - Validator.notNull(createTokenizationDictionaryOptions, "createTokenizationDictionaryOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createTokenizationDictionaryOptions, + "createTokenizationDictionaryOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "word_lists/tokenization_dictionary" }; String[] pathParameters = { createTokenizationDictionaryOptions.environmentId(), createTokenizationDictionaryOptions .collectionId() }; @@ -938,8 +928,8 @@ public ServiceCall createTokenizationDictionary( builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (createTokenizationDictionaryOptions.tokenizationRules() != null) { - contentJson.add("tokenization_rules", GsonSingleton.getGson().toJsonTree(createTokenizationDictionaryOptions - .tokenizationRules())); + contentJson.add("tokenization_rules", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createTokenizationDictionaryOptions.tokenizationRules())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -959,7 +949,8 @@ public ServiceCall createTokenizationDictionary( */ public ServiceCall deleteTokenizationDictionary( DeleteTokenizationDictionaryOptions deleteTokenizationDictionaryOptions) { - Validator.notNull(deleteTokenizationDictionaryOptions, "deleteTokenizationDictionaryOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteTokenizationDictionaryOptions, + "deleteTokenizationDictionaryOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "word_lists/tokenization_dictionary" }; String[] pathParameters = { deleteTokenizationDictionaryOptions.environmentId(), deleteTokenizationDictionaryOptions .collectionId() }; @@ -984,7 +975,8 @@ public ServiceCall deleteTokenizationDictionary( */ public ServiceCall getStopwordListStatus( GetStopwordListStatusOptions getStopwordListStatusOptions) { - Validator.notNull(getStopwordListStatusOptions, "getStopwordListStatusOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getStopwordListStatusOptions, + "getStopwordListStatusOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "word_lists/stopwords" }; String[] pathParameters = { getStopwordListStatusOptions.environmentId(), getStopwordListStatusOptions .collectionId() }; @@ -1011,7 +1003,8 @@ public ServiceCall getStopwordListStatus( * @return a {@link ServiceCall} with a response type of {@link TokenDictStatusResponse} */ public ServiceCall createStopwordList(CreateStopwordListOptions createStopwordListOptions) { - Validator.notNull(createStopwordListOptions, "createStopwordListOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createStopwordListOptions, + "createStopwordListOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "word_lists/stopwords" }; String[] pathParameters = { createStopwordListOptions.environmentId(), createStopwordListOptions.collectionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1024,7 +1017,7 @@ public ServiceCall createStopwordList(CreateStopwordLis builder.header("Accept", "application/json"); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody stopwordFileBody = RequestUtils.inputStreamBody(createStopwordListOptions.stopwordFile(), + okhttp3.RequestBody stopwordFileBody = RequestUtils.inputStreamBody(createStopwordListOptions.stopwordFile(), "application/octet-stream"); multipartBuilder.addFormDataPart("stopword_file", createStopwordListOptions.stopwordFilename(), stopwordFileBody); builder.body(multipartBuilder.build()); @@ -1044,7 +1037,8 @@ public ServiceCall createStopwordList(CreateStopwordLis * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteStopwordList(DeleteStopwordListOptions deleteStopwordListOptions) { - Validator.notNull(deleteStopwordListOptions, "deleteStopwordListOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteStopwordListOptions, + "deleteStopwordListOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "word_lists/stopwords" }; String[] pathParameters = { deleteStopwordListOptions.environmentId(), deleteStopwordListOptions.collectionId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1088,9 +1082,10 @@ public ServiceCall deleteStopwordList(DeleteStopwordListOptions deleteStop * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall addDocument(AddDocumentOptions addDocumentOptions) { - Validator.notNull(addDocumentOptions, "addDocumentOptions cannot be null"); - Validator.isTrue((addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); + com.ibm.cloud.sdk.core.util.Validator.notNull(addDocumentOptions, + "addDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((addDocumentOptions.file() != null) || (addDocumentOptions + .metadata() != null), "At least one of file or metadata must be supplied."); String[] pathSegments = { "v1/environments", "collections", "documents" }; String[] pathParameters = { addDocumentOptions.environmentId(), addDocumentOptions.collectionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1104,7 +1099,7 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (addDocumentOptions.file() != null) { - RequestBody fileBody = RequestUtils.inputStreamBody(addDocumentOptions.file(), addDocumentOptions + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(addDocumentOptions.file(), addDocumentOptions .fileContentType()); multipartBuilder.addFormDataPart("file", addDocumentOptions.filename(), fileBody); } @@ -1129,7 +1124,8 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO * @return a {@link ServiceCall} with a response type of {@link DocumentStatus} */ public ServiceCall getDocumentStatus(GetDocumentStatusOptions getDocumentStatusOptions) { - Validator.notNull(getDocumentStatusOptions, "getDocumentStatusOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getDocumentStatusOptions, + "getDocumentStatusOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "documents" }; String[] pathParameters = { getDocumentStatusOptions.environmentId(), getDocumentStatusOptions.collectionId(), getDocumentStatusOptions.documentId() }; @@ -1160,9 +1156,10 @@ public ServiceCall getDocumentStatus(GetDocumentStatusOptions ge * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall updateDocument(UpdateDocumentOptions updateDocumentOptions) { - Validator.notNull(updateDocumentOptions, "updateDocumentOptions cannot be null"); - Validator.isTrue((updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateDocumentOptions, + "updateDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((updateDocumentOptions.file() != null) || (updateDocumentOptions + .metadata() != null), "At least one of file or metadata must be supplied."); String[] pathSegments = { "v1/environments", "collections", "documents" }; String[] pathParameters = { updateDocumentOptions.environmentId(), updateDocumentOptions.collectionId(), updateDocumentOptions.documentId() }; @@ -1177,7 +1174,7 @@ public ServiceCall updateDocument(UpdateDocumentOptions update MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (updateDocumentOptions.file() != null) { - RequestBody fileBody = RequestUtils.inputStreamBody(updateDocumentOptions.file(), updateDocumentOptions + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(updateDocumentOptions.file(), updateDocumentOptions .fileContentType()); multipartBuilder.addFormDataPart("file", updateDocumentOptions.filename(), fileBody); } @@ -1201,7 +1198,8 @@ public ServiceCall updateDocument(UpdateDocumentOptions update * @return a {@link ServiceCall} with a response type of {@link DeleteDocumentResponse} */ public ServiceCall deleteDocument(DeleteDocumentOptions deleteDocumentOptions) { - Validator.notNull(deleteDocumentOptions, "deleteDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteDocumentOptions, + "deleteDocumentOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "documents" }; String[] pathParameters = { deleteDocumentOptions.environmentId(), deleteDocumentOptions.collectionId(), deleteDocumentOptions.documentId() }; @@ -1229,7 +1227,8 @@ public ServiceCall deleteDocument(DeleteDocumentOptions * @return a {@link ServiceCall} with a response type of {@link QueryResponse} */ public ServiceCall query(QueryOptions queryOptions) { - Validator.notNull(queryOptions, "queryOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, + "queryOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "query" }; String[] pathParameters = { queryOptions.environmentId(), queryOptions.collectionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1240,8 +1239,8 @@ public ServiceCall query(QueryOptions queryOptions) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (queryOptions.loggingOptOut() != null) { - builder.header("X-Watson-Logging-Opt-Out", queryOptions.loggingOptOut()); + if (queryOptions.xWatsonLoggingOptOut() != null) { + builder.header("X-Watson-Logging-Opt-Out", queryOptions.xWatsonLoggingOptOut()); } final JsonObject contentJson = new JsonObject(); if (queryOptions.filter() != null) { @@ -1262,8 +1261,8 @@ public ServiceCall query(QueryOptions queryOptions) { if (queryOptions.count() != null) { contentJson.addProperty("count", queryOptions.count()); } - if (queryOptions.returnFields() != null) { - contentJson.addProperty("return", queryOptions.returnFields()); + if (queryOptions.xreturn() != null) { + contentJson.addProperty("return", queryOptions.xreturn()); } if (queryOptions.offset() != null) { contentJson.addProperty("offset", queryOptions.offset()); @@ -1323,7 +1322,8 @@ public ServiceCall query(QueryOptions queryOptions) { * @return a {@link ServiceCall} with a response type of {@link QueryNoticesResponse} */ public ServiceCall queryNotices(QueryNoticesOptions queryNoticesOptions) { - Validator.notNull(queryNoticesOptions, "queryNoticesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryNoticesOptions, + "queryNoticesOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "notices" }; String[] pathParameters = { queryNoticesOptions.environmentId(), queryNoticesOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1352,8 +1352,8 @@ public ServiceCall queryNotices(QueryNoticesOptions queryN if (queryNoticesOptions.count() != null) { builder.query("count", String.valueOf(queryNoticesOptions.count())); } - if (queryNoticesOptions.returnFields() != null) { - builder.query("return", RequestUtils.join(queryNoticesOptions.returnFields(), ",")); + if (queryNoticesOptions.xreturn() != null) { + builder.query("return", RequestUtils.join(queryNoticesOptions.xreturn(), ",")); } if (queryNoticesOptions.offset() != null) { builder.query("offset", String.valueOf(queryNoticesOptions.offset())); @@ -1402,7 +1402,8 @@ public ServiceCall queryNotices(QueryNoticesOptions queryN * @return a {@link ServiceCall} with a response type of {@link QueryResponse} */ public ServiceCall federatedQuery(FederatedQueryOptions federatedQueryOptions) { - Validator.notNull(federatedQueryOptions, "federatedQueryOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(federatedQueryOptions, + "federatedQueryOptions cannot be null"); String[] pathSegments = { "v1/environments", "query" }; String[] pathParameters = { federatedQueryOptions.environmentId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1413,8 +1414,8 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (federatedQueryOptions.loggingOptOut() != null) { - builder.header("X-Watson-Logging-Opt-Out", federatedQueryOptions.loggingOptOut()); + if (federatedQueryOptions.xWatsonLoggingOptOut() != null) { + builder.header("X-Watson-Logging-Opt-Out", federatedQueryOptions.xWatsonLoggingOptOut()); } final JsonObject contentJson = new JsonObject(); if (federatedQueryOptions.filter() != null) { @@ -1435,8 +1436,8 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated if (federatedQueryOptions.count() != null) { contentJson.addProperty("count", federatedQueryOptions.count()); } - if (federatedQueryOptions.returnFields() != null) { - contentJson.addProperty("return", federatedQueryOptions.returnFields()); + if (federatedQueryOptions.xreturn() != null) { + contentJson.addProperty("return", federatedQueryOptions.xreturn()); } if (federatedQueryOptions.offset() != null) { contentJson.addProperty("offset", federatedQueryOptions.offset()); @@ -1497,7 +1498,8 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated */ public ServiceCall federatedQueryNotices( FederatedQueryNoticesOptions federatedQueryNoticesOptions) { - Validator.notNull(federatedQueryNoticesOptions, "federatedQueryNoticesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(federatedQueryNoticesOptions, + "federatedQueryNoticesOptions cannot be null"); String[] pathSegments = { "v1/environments", "notices" }; String[] pathParameters = { federatedQueryNoticesOptions.environmentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1524,8 +1526,8 @@ public ServiceCall federatedQueryNotices( if (federatedQueryNoticesOptions.count() != null) { builder.query("count", String.valueOf(federatedQueryNoticesOptions.count())); } - if (federatedQueryNoticesOptions.returnFields() != null) { - builder.query("return", RequestUtils.join(federatedQueryNoticesOptions.returnFields(), ",")); + if (federatedQueryNoticesOptions.xreturn() != null) { + builder.query("return", RequestUtils.join(federatedQueryNoticesOptions.xreturn(), ",")); } if (federatedQueryNoticesOptions.offset() != null) { builder.query("offset", String.valueOf(federatedQueryNoticesOptions.offset())); @@ -1564,7 +1566,8 @@ public ServiceCall federatedQueryNotices( * @return a {@link ServiceCall} with a response type of {@link QueryEntitiesResponse} */ public ServiceCall queryEntities(QueryEntitiesOptions queryEntitiesOptions) { - Validator.notNull(queryEntitiesOptions, "queryEntitiesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryEntitiesOptions, + "queryEntitiesOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "query_entities" }; String[] pathParameters = { queryEntitiesOptions.environmentId(), queryEntitiesOptions.collectionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1580,10 +1583,12 @@ public ServiceCall queryEntities(QueryEntitiesOptions que contentJson.addProperty("feature", queryEntitiesOptions.feature()); } if (queryEntitiesOptions.entity() != null) { - contentJson.add("entity", GsonSingleton.getGson().toJsonTree(queryEntitiesOptions.entity())); + contentJson.add("entity", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryEntitiesOptions + .entity())); } if (queryEntitiesOptions.context() != null) { - contentJson.add("context", GsonSingleton.getGson().toJsonTree(queryEntitiesOptions.context())); + contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryEntitiesOptions + .context())); } if (queryEntitiesOptions.count() != null) { contentJson.addProperty("count", queryEntitiesOptions.count()); @@ -1608,7 +1613,8 @@ public ServiceCall queryEntities(QueryEntitiesOptions que * @return a {@link ServiceCall} with a response type of {@link QueryRelationsResponse} */ public ServiceCall queryRelations(QueryRelationsOptions queryRelationsOptions) { - Validator.notNull(queryRelationsOptions, "queryRelationsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryRelationsOptions, + "queryRelationsOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "query_relations" }; String[] pathParameters = { queryRelationsOptions.environmentId(), queryRelationsOptions.collectionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1621,16 +1627,19 @@ public ServiceCall queryRelations(QueryRelationsOptions builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (queryRelationsOptions.entities() != null) { - contentJson.add("entities", GsonSingleton.getGson().toJsonTree(queryRelationsOptions.entities())); + contentJson.add("entities", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryRelationsOptions + .entities())); } if (queryRelationsOptions.context() != null) { - contentJson.add("context", GsonSingleton.getGson().toJsonTree(queryRelationsOptions.context())); + contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryRelationsOptions + .context())); } if (queryRelationsOptions.sort() != null) { contentJson.addProperty("sort", queryRelationsOptions.sort()); } if (queryRelationsOptions.filter() != null) { - contentJson.add("filter", GsonSingleton.getGson().toJsonTree(queryRelationsOptions.filter())); + contentJson.add("filter", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryRelationsOptions + .filter())); } if (queryRelationsOptions.count() != null) { contentJson.addProperty("count", queryRelationsOptions.count()); @@ -1654,7 +1663,8 @@ public ServiceCall queryRelations(QueryRelationsOptions * @return a {@link ServiceCall} with a response type of {@link TrainingDataSet} */ public ServiceCall listTrainingData(ListTrainingDataOptions listTrainingDataOptions) { - Validator.notNull(listTrainingDataOptions, "listTrainingDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listTrainingDataOptions, + "listTrainingDataOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data" }; String[] pathParameters = { listTrainingDataOptions.environmentId(), listTrainingDataOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1680,7 +1690,8 @@ public ServiceCall listTrainingData(ListTrainingDataOptions lis * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ public ServiceCall addTrainingData(AddTrainingDataOptions addTrainingDataOptions) { - Validator.notNull(addTrainingDataOptions, "addTrainingDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addTrainingDataOptions, + "addTrainingDataOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data" }; String[] pathParameters = { addTrainingDataOptions.environmentId(), addTrainingDataOptions.collectionId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1699,7 +1710,8 @@ public ServiceCall addTrainingData(AddTrainingDataOptions addTrai contentJson.addProperty("filter", addTrainingDataOptions.filter()); } if (addTrainingDataOptions.examples() != null) { - contentJson.add("examples", GsonSingleton.getGson().toJsonTree(addTrainingDataOptions.examples())); + contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(addTrainingDataOptions + .examples())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -1717,7 +1729,8 @@ public ServiceCall addTrainingData(AddTrainingDataOptions addTrai * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteAllTrainingData(DeleteAllTrainingDataOptions deleteAllTrainingDataOptions) { - Validator.notNull(deleteAllTrainingDataOptions, "deleteAllTrainingDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAllTrainingDataOptions, + "deleteAllTrainingDataOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data" }; String[] pathParameters = { deleteAllTrainingDataOptions.environmentId(), deleteAllTrainingDataOptions .collectionId() }; @@ -1741,7 +1754,8 @@ public ServiceCall deleteAllTrainingData(DeleteAllTrainingDataOptions dele * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ public ServiceCall getTrainingData(GetTrainingDataOptions getTrainingDataOptions) { - Validator.notNull(getTrainingDataOptions, "getTrainingDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getTrainingDataOptions, + "getTrainingDataOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data" }; String[] pathParameters = { getTrainingDataOptions.environmentId(), getTrainingDataOptions.collectionId(), getTrainingDataOptions.queryId() }; @@ -1768,7 +1782,8 @@ public ServiceCall getTrainingData(GetTrainingDataOptions getTrai * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteTrainingData(DeleteTrainingDataOptions deleteTrainingDataOptions) { - Validator.notNull(deleteTrainingDataOptions, "deleteTrainingDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteTrainingDataOptions, + "deleteTrainingDataOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data" }; String[] pathParameters = { deleteTrainingDataOptions.environmentId(), deleteTrainingDataOptions.collectionId(), deleteTrainingDataOptions.queryId() }; @@ -1793,7 +1808,8 @@ public ServiceCall deleteTrainingData(DeleteTrainingDataOptions deleteTrai */ public ServiceCall listTrainingExamples( ListTrainingExamplesOptions listTrainingExamplesOptions) { - Validator.notNull(listTrainingExamplesOptions, "listTrainingExamplesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listTrainingExamplesOptions, + "listTrainingExamplesOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" }; String[] pathParameters = { listTrainingExamplesOptions.environmentId(), listTrainingExamplesOptions.collectionId(), listTrainingExamplesOptions.queryId() }; @@ -1820,7 +1836,8 @@ public ServiceCall listTrainingExamples( * @return a {@link ServiceCall} with a response type of {@link TrainingExample} */ public ServiceCall createTrainingExample(CreateTrainingExampleOptions createTrainingExampleOptions) { - Validator.notNull(createTrainingExampleOptions, "createTrainingExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createTrainingExampleOptions, + "createTrainingExampleOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" }; String[] pathParameters = { createTrainingExampleOptions.environmentId(), createTrainingExampleOptions .collectionId(), createTrainingExampleOptions.queryId() }; @@ -1858,7 +1875,8 @@ public ServiceCall createTrainingExample(CreateTrainingExampleO * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteTrainingExample(DeleteTrainingExampleOptions deleteTrainingExampleOptions) { - Validator.notNull(deleteTrainingExampleOptions, "deleteTrainingExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteTrainingExampleOptions, + "deleteTrainingExampleOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" }; String[] pathParameters = { deleteTrainingExampleOptions.environmentId(), deleteTrainingExampleOptions .collectionId(), deleteTrainingExampleOptions.queryId(), deleteTrainingExampleOptions.exampleId() }; @@ -1882,7 +1900,8 @@ public ServiceCall deleteTrainingExample(DeleteTrainingExampleOptions dele * @return a {@link ServiceCall} with a response type of {@link TrainingExample} */ public ServiceCall updateTrainingExample(UpdateTrainingExampleOptions updateTrainingExampleOptions) { - Validator.notNull(updateTrainingExampleOptions, "updateTrainingExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateTrainingExampleOptions, + "updateTrainingExampleOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" }; String[] pathParameters = { updateTrainingExampleOptions.environmentId(), updateTrainingExampleOptions .collectionId(), updateTrainingExampleOptions.queryId(), updateTrainingExampleOptions.exampleId() }; @@ -1917,7 +1936,8 @@ public ServiceCall updateTrainingExample(UpdateTrainingExampleO * @return a {@link ServiceCall} with a response type of {@link TrainingExample} */ public ServiceCall getTrainingExample(GetTrainingExampleOptions getTrainingExampleOptions) { - Validator.notNull(getTrainingExampleOptions, "getTrainingExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getTrainingExampleOptions, + "getTrainingExampleOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" }; String[] pathParameters = { getTrainingExampleOptions.environmentId(), getTrainingExampleOptions.collectionId(), getTrainingExampleOptions.queryId(), getTrainingExampleOptions.exampleId() }; @@ -1949,7 +1969,8 @@ public ServiceCall getTrainingExample(GetTrainingExampleOptions * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - Validator.notNull(deleteUserDataOptions, "deleteUserDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, + "deleteUserDataOptions cannot be null"); String[] pathSegments = { "v1/user_data" }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -1966,13 +1987,14 @@ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOpti * Create event. * * The **Events** API can be used to create log entries that are associated with specific queries. For example, you - * can record which documents in the results set were \"clicked\" by a user and when that click occured. + * can record which documents in the results set were "clicked" by a user and when that click occured. * * @param createEventOptions the {@link CreateEventOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link CreateEventResponse} */ public ServiceCall createEvent(CreateEventOptions createEventOptions) { - Validator.notNull(createEventOptions, "createEventOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createEventOptions, + "createEventOptions cannot be null"); String[] pathSegments = { "v1/events" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -1983,7 +2005,7 @@ public ServiceCall createEvent(CreateEventOptions createEve builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); contentJson.addProperty("type", createEventOptions.type()); - contentJson.add("data", GsonSingleton.getGson().toJsonTree(createEventOptions.data())); + contentJson.add("data", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createEventOptions.data())); builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { @@ -2092,8 +2114,8 @@ public ServiceCall getMetricsQuery() { /** * Number of queries with an event over time. * - * Total number of queries using the **natural_language_query** parameter that have a corresponding \"click\" event - * over a specified time window. This metric requires having integrated event tracking in your application using the + * Total number of queries using the **natural_language_query** parameter that have a corresponding "click" event over + * a specified time window. This metric requires having integrated event tracking in your application using the * **Events** API. * * @param getMetricsQueryEventOptions the {@link GetMetricsQueryEventOptions} containing the options for the call @@ -2128,8 +2150,8 @@ public ServiceCall getMetricsQueryEvent(GetMetricsQueryEventOpti /** * Number of queries with an event over time. * - * Total number of queries using the **natural_language_query** parameter that have a corresponding \"click\" event - * over a specified time window. This metric requires having integrated event tracking in your application using the + * Total number of queries using the **natural_language_query** parameter that have a corresponding "click" event over + * a specified time window. This metric requires having integrated event tracking in your application using the * **Events** API. * * @return a {@link ServiceCall} with a response type of {@link MetricResponse} @@ -2190,7 +2212,7 @@ public ServiceCall getMetricsQueryNoResults() { /** * Percentage of queries with an associated event. * - * The percentage of queries using the **natural_language_query** parameter that have a corresponding \"click\" event + * The percentage of queries using the **natural_language_query** parameter that have a corresponding "click" event * over a specified time window. This metric requires having integrated event tracking in your application using the * **Events** API. * @@ -2226,7 +2248,7 @@ public ServiceCall getMetricsEventRate(GetMetricsEventRateOption /** * Percentage of queries with an associated event. * - * The percentage of queries using the **natural_language_query** parameter that have a corresponding \"click\" event + * The percentage of queries using the **natural_language_query** parameter that have a corresponding "click" event * over a specified time window. This metric requires having integrated event tracking in your application using the * **Events** API. * @@ -2239,9 +2261,9 @@ public ServiceCall getMetricsEventRate() { /** * Most frequent query tokens with an event. * - * The most frequent query tokens parsed from the **natural_language_query** parameter and their corresponding - * \"click\" event rate within the recording period (queries and events are stored for 30 days). A query token is an - * individual word or unigram within the query string. + * The most frequent query tokens parsed from the **natural_language_query** parameter and their corresponding "click" + * event rate within the recording period (queries and events are stored for 30 days). A query token is an individual + * word or unigram within the query string. * * @param getMetricsQueryTokenEventOptions the {@link GetMetricsQueryTokenEventOptions} containing the options for the * call @@ -2271,9 +2293,9 @@ public ServiceCall getMetricsQueryTokenEvent( /** * Most frequent query tokens with an event. * - * The most frequent query tokens parsed from the **natural_language_query** parameter and their corresponding - * \"click\" event rate within the recording period (queries and events are stored for 30 days). A query token is an - * individual word or unigram within the query string. + * The most frequent query tokens parsed from the **natural_language_query** parameter and their corresponding "click" + * event rate within the recording period (queries and events are stored for 30 days). A query token is an individual + * word or unigram within the query string. * * @return a {@link ServiceCall} with a response type of {@link MetricTokenResponse} */ @@ -2292,7 +2314,8 @@ public ServiceCall getMetricsQueryTokenEvent() { * @return a {@link ServiceCall} with a response type of {@link CredentialsList} */ public ServiceCall listCredentials(ListCredentialsOptions listCredentialsOptions) { - Validator.notNull(listCredentialsOptions, "listCredentialsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listCredentialsOptions, + "listCredentialsOptions cannot be null"); String[] pathSegments = { "v1/environments", "credentials" }; String[] pathParameters = { listCredentialsOptions.environmentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2321,7 +2344,8 @@ public ServiceCall listCredentials(ListCredentialsOptions listC * @return a {@link ServiceCall} with a response type of {@link Credentials} */ public ServiceCall createCredentials(CreateCredentialsOptions createCredentialsOptions) { - Validator.notNull(createCredentialsOptions, "createCredentialsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createCredentialsOptions, + "createCredentialsOptions cannot be null"); String[] pathSegments = { "v1/environments", "credentials" }; String[] pathParameters = { createCredentialsOptions.environmentId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2337,8 +2361,8 @@ public ServiceCall createCredentials(CreateCredentialsOptions creat contentJson.addProperty("source_type", createCredentialsOptions.sourceType()); } if (createCredentialsOptions.credentialDetails() != null) { - contentJson.add("credential_details", GsonSingleton.getGson().toJsonTree(createCredentialsOptions - .credentialDetails())); + contentJson.add("credential_details", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createCredentialsOptions.credentialDetails())); } if (createCredentialsOptions.status() != null) { contentJson.addProperty("status", createCredentialsOptions.status()); @@ -2362,7 +2386,8 @@ public ServiceCall createCredentials(CreateCredentialsOptions creat * @return a {@link ServiceCall} with a response type of {@link Credentials} */ public ServiceCall getCredentials(GetCredentialsOptions getCredentialsOptions) { - Validator.notNull(getCredentialsOptions, "getCredentialsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getCredentialsOptions, + "getCredentialsOptions cannot be null"); String[] pathSegments = { "v1/environments", "credentials" }; String[] pathParameters = { getCredentialsOptions.environmentId(), getCredentialsOptions.credentialId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2390,7 +2415,8 @@ public ServiceCall getCredentials(GetCredentialsOptions getCredenti * @return a {@link ServiceCall} with a response type of {@link Credentials} */ public ServiceCall updateCredentials(UpdateCredentialsOptions updateCredentialsOptions) { - Validator.notNull(updateCredentialsOptions, "updateCredentialsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateCredentialsOptions, + "updateCredentialsOptions cannot be null"); String[] pathSegments = { "v1/environments", "credentials" }; String[] pathParameters = { updateCredentialsOptions.environmentId(), updateCredentialsOptions.credentialId() }; RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2406,8 +2432,8 @@ public ServiceCall updateCredentials(UpdateCredentialsOptions updat contentJson.addProperty("source_type", updateCredentialsOptions.sourceType()); } if (updateCredentialsOptions.credentialDetails() != null) { - contentJson.add("credential_details", GsonSingleton.getGson().toJsonTree(updateCredentialsOptions - .credentialDetails())); + contentJson.add("credential_details", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateCredentialsOptions.credentialDetails())); } if (updateCredentialsOptions.status() != null) { contentJson.addProperty("status", updateCredentialsOptions.status()); @@ -2428,7 +2454,8 @@ public ServiceCall updateCredentials(UpdateCredentialsOptions updat * @return a {@link ServiceCall} with a response type of {@link DeleteCredentials} */ public ServiceCall deleteCredentials(DeleteCredentialsOptions deleteCredentialsOptions) { - Validator.notNull(deleteCredentialsOptions, "deleteCredentialsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCredentialsOptions, + "deleteCredentialsOptions cannot be null"); String[] pathSegments = { "v1/environments", "credentials" }; String[] pathParameters = { deleteCredentialsOptions.environmentId(), deleteCredentialsOptions.credentialId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2454,7 +2481,8 @@ public ServiceCall deleteCredentials(DeleteCredentialsOptions * @return a {@link ServiceCall} with a response type of {@link GatewayList} */ public ServiceCall listGateways(ListGatewaysOptions listGatewaysOptions) { - Validator.notNull(listGatewaysOptions, "listGatewaysOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listGatewaysOptions, + "listGatewaysOptions cannot be null"); String[] pathSegments = { "v1/environments", "gateways" }; String[] pathParameters = { listGatewaysOptions.environmentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2480,7 +2508,8 @@ public ServiceCall listGateways(ListGatewaysOptions listGatewaysOpt * @return a {@link ServiceCall} with a response type of {@link Gateway} */ public ServiceCall createGateway(CreateGatewayOptions createGatewayOptions) { - Validator.notNull(createGatewayOptions, "createGatewayOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createGatewayOptions, + "createGatewayOptions cannot be null"); String[] pathSegments = { "v1/environments", "gateways" }; String[] pathParameters = { createGatewayOptions.environmentId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2511,7 +2540,8 @@ public ServiceCall createGateway(CreateGatewayOptions createGatewayOpti * @return a {@link ServiceCall} with a response type of {@link Gateway} */ public ServiceCall getGateway(GetGatewayOptions getGatewayOptions) { - Validator.notNull(getGatewayOptions, "getGatewayOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getGatewayOptions, + "getGatewayOptions cannot be null"); String[] pathSegments = { "v1/environments", "gateways" }; String[] pathParameters = { getGatewayOptions.environmentId(), getGatewayOptions.gatewayId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2537,7 +2567,8 @@ public ServiceCall getGateway(GetGatewayOptions getGatewayOptions) { * @return a {@link ServiceCall} with a response type of {@link GatewayDelete} */ public ServiceCall deleteGateway(DeleteGatewayOptions deleteGatewayOptions) { - Validator.notNull(deleteGatewayOptions, "deleteGatewayOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteGatewayOptions, + "deleteGatewayOptions cannot be null"); String[] pathSegments = { "v1/environments", "gateways" }; String[] pathParameters = { deleteGatewayOptions.environmentId(), deleteGatewayOptions.gatewayId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddDocumentOptions.java index fbe01da538c..5b9fdeafb9c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddDocumentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddDocumentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addDocument options. @@ -160,9 +159,11 @@ public Builder file(File file) throws FileNotFoundException { } private AddDocumentOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.isTrue((builder.file == null) || (builder.filename != null), + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((builder.file == null) || (builder.filename != null), "filename cannot be null if file is not null."); environmentId = builder.environmentId; collectionId = builder.collectionId; @@ -241,8 +242,7 @@ public String fileContentType() { /** * Gets the metadata. * - * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. - * Example: ``` { + * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` { * "Creator": "Johnny Appleseed", * "Subject": "Apples" * } ```. diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptions.java index 95a2a0b944a..2ad619ffd1e 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addTrainingData options. @@ -80,7 +79,8 @@ public AddTrainingDataOptions build() { * @return the AddTrainingDataOptions builder */ public Builder addExamples(TrainingExample examples) { - Validator.notNull(examples, "examples cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(examples, + "examples cannot be null"); if (this.examples == null) { this.examples = new ArrayList(); } @@ -146,8 +146,10 @@ public Builder examples(List examples) { } private AddTrainingDataOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; naturalLanguageQuery = builder.naturalLanguageQuery; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AggregationResult.java index f36a608faa8..36edb71b3a9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AggregationResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AggregationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Calculation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Calculation.java index 9fdca5ba984..dc01cebf9ca 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Calculation.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Calculation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Collection.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Collection.java index 54e64eacf70..7fadf3a2b78 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Collection.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Collection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatus.java index 7a7a3386165..6d244678eff 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatus.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsage.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsage.java index 5d665509f08..0be82536186 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsage.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionUsage.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionUsage.java index d187fe61d92..54987f7538b 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionUsage.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionUsage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Configuration.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Configuration.java index bd4522055e6..25a5fd5245c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Configuration.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -34,6 +35,213 @@ public class Configuration extends GenericModel { private List normalizations; private Source source; + /** + * Builder. + */ + public static class Builder { + private String configurationId; + private String name; + private Date created; + private Date updated; + private String description; + private Conversions conversions; + private List enrichments; + private List normalizations; + private Source source; + + private Builder(Configuration configuration) { + this.configurationId = configuration.configurationId; + this.name = configuration.name; + this.created = configuration.created; + this.updated = configuration.updated; + this.description = configuration.description; + this.conversions = configuration.conversions; + this.enrichments = configuration.enrichments; + this.normalizations = configuration.normalizations; + this.source = configuration.source; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + */ + public Builder(String name) { + this.name = name; + } + + /** + * Builds a Configuration. + * + * @return the configuration + */ + public Configuration build() { + return new Configuration(this); + } + + /** + * Adds an enrichment to enrichments. + * + * @param enrichment the new enrichment + * @return the Configuration builder + */ + public Builder addEnrichment(Enrichment enrichment) { + com.ibm.cloud.sdk.core.util.Validator.notNull(enrichment, + "enrichment cannot be null"); + if (this.enrichments == null) { + this.enrichments = new ArrayList(); + } + this.enrichments.add(enrichment); + return this; + } + + /** + * Adds an normalization to normalizations. + * + * @param normalization the new normalization + * @return the Configuration builder + */ + public Builder addNormalization(NormalizationOperation normalization) { + com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, + "normalization cannot be null"); + if (this.normalizations == null) { + this.normalizations = new ArrayList(); + } + this.normalizations.add(normalization); + return this; + } + + /** + * Set the configurationId. + * + * @param configurationId the configurationId + * @return the Configuration builder + */ + public Builder configurationId(String configurationId) { + this.configurationId = configurationId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the Configuration builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the created. + * + * @param created the created + * @return the Configuration builder + */ + public Builder created(Date created) { + this.created = created; + return this; + } + + /** + * Set the updated. + * + * @param updated the updated + * @return the Configuration builder + */ + public Builder updated(Date updated) { + this.updated = updated; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the Configuration builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the conversions. + * + * @param conversions the conversions + * @return the Configuration builder + */ + public Builder conversions(Conversions conversions) { + this.conversions = conversions; + return this; + } + + /** + * Set the enrichments. + * Existing enrichments will be replaced. + * + * @param enrichments the enrichments + * @return the Configuration builder + */ + public Builder enrichments(List enrichments) { + this.enrichments = enrichments; + return this; + } + + /** + * Set the normalizations. + * Existing normalizations will be replaced. + * + * @param normalizations the normalizations + * @return the Configuration builder + */ + public Builder normalizations(List normalizations) { + this.normalizations = normalizations; + return this; + } + + /** + * Set the source. + * + * @param source the source + * @return the Configuration builder + */ + public Builder source(Source source) { + this.source = source; + return this; + } + } + + private Configuration(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + configurationId = builder.configurationId; + name = builder.name; + created = builder.created; + updated = builder.updated; + description = builder.description; + conversions = builder.conversions; + enrichments = builder.enrichments; + normalizations = builder.normalizations; + source = builder.source; + } + + /** + * New builder. + * + * @return a Configuration builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the configurationId. * @@ -41,7 +249,7 @@ public class Configuration extends GenericModel { * * @return the configurationId */ - public String getConfigurationId() { + public String configurationId() { return configurationId; } @@ -52,7 +260,7 @@ public String getConfigurationId() { * * @return the name */ - public String getName() { + public String name() { return name; } @@ -63,7 +271,7 @@ public String getName() { * * @return the created */ - public Date getCreated() { + public Date created() { return created; } @@ -74,7 +282,7 @@ public Date getCreated() { * * @return the updated */ - public Date getUpdated() { + public Date updated() { return updated; } @@ -85,7 +293,7 @@ public Date getUpdated() { * * @return the description */ - public String getDescription() { + public String description() { return description; } @@ -96,7 +304,7 @@ public String getDescription() { * * @return the conversions */ - public Conversions getConversions() { + public Conversions conversions() { return conversions; } @@ -107,7 +315,7 @@ public Conversions getConversions() { * * @return the enrichments */ - public List getEnrichments() { + public List enrichments() { return enrichments; } @@ -119,7 +327,7 @@ public List getEnrichments() { * * @return the normalizations */ - public List getNormalizations() { + public List normalizations() { return normalizations; } @@ -130,61 +338,7 @@ public List getNormalizations() { * * @return the source */ - public Source getSource() { + public Source source() { return source; } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(final String name) { - this.name = name; - } - - /** - * Sets the description. - * - * @param description the new description - */ - public void setDescription(final String description) { - this.description = description; - } - - /** - * Sets the conversions. - * - * @param conversions the new conversions - */ - public void setConversions(final Conversions conversions) { - this.conversions = conversions; - } - - /** - * Sets the enrichments. - * - * @param enrichments the new enrichments - */ - public void setEnrichments(final List enrichments) { - this.enrichments = enrichments; - } - - /** - * Sets the normalizations. - * - * @param normalizations the new normalizations - */ - public void setNormalizations(final List normalizations) { - this.normalizations = normalizations; - } - - /** - * Sets the source. - * - * @param source the new source - */ - public void setSource(final Source source) { - this.source = source; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Conversions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Conversions.java index 4c79dc766f9..5537cf6b5a1 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Conversions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Conversions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -31,6 +32,143 @@ public class Conversions extends GenericModel { @SerializedName("image_text_recognition") private Boolean imageTextRecognition; + /** + * Builder. + */ + public static class Builder { + private PdfSettings pdf; + private WordSettings word; + private HtmlSettings html; + private SegmentSettings segment; + private List jsonNormalizations; + private Boolean imageTextRecognition; + + private Builder(Conversions conversions) { + this.pdf = conversions.pdf; + this.word = conversions.word; + this.html = conversions.html; + this.segment = conversions.segment; + this.jsonNormalizations = conversions.jsonNormalizations; + this.imageTextRecognition = conversions.imageTextRecognition; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a Conversions. + * + * @return the conversions + */ + public Conversions build() { + return new Conversions(this); + } + + /** + * Adds an normalization to jsonNormalizations. + * + * @param normalization the new normalization + * @return the Conversions builder + */ + public Builder addNormalization(NormalizationOperation normalization) { + com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, + "normalization cannot be null"); + if (this.jsonNormalizations == null) { + this.jsonNormalizations = new ArrayList(); + } + this.jsonNormalizations.add(normalization); + return this; + } + + /** + * Set the pdf. + * + * @param pdf the pdf + * @return the Conversions builder + */ + public Builder pdf(PdfSettings pdf) { + this.pdf = pdf; + return this; + } + + /** + * Set the word. + * + * @param word the word + * @return the Conversions builder + */ + public Builder word(WordSettings word) { + this.word = word; + return this; + } + + /** + * Set the html. + * + * @param html the html + * @return the Conversions builder + */ + public Builder html(HtmlSettings html) { + this.html = html; + return this; + } + + /** + * Set the segment. + * + * @param segment the segment + * @return the Conversions builder + */ + public Builder segment(SegmentSettings segment) { + this.segment = segment; + return this; + } + + /** + * Set the jsonNormalizations. + * Existing jsonNormalizations will be replaced. + * + * @param jsonNormalizations the jsonNormalizations + * @return the Conversions builder + */ + public Builder jsonNormalizations(List jsonNormalizations) { + this.jsonNormalizations = jsonNormalizations; + return this; + } + + /** + * Set the imageTextRecognition. + * + * @param imageTextRecognition the imageTextRecognition + * @return the Conversions builder + */ + public Builder imageTextRecognition(Boolean imageTextRecognition) { + this.imageTextRecognition = imageTextRecognition; + return this; + } + } + + private Conversions(Builder builder) { + pdf = builder.pdf; + word = builder.word; + html = builder.html; + segment = builder.segment; + jsonNormalizations = builder.jsonNormalizations; + imageTextRecognition = builder.imageTextRecognition; + } + + /** + * New builder. + * + * @return a Conversions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the pdf. * @@ -38,7 +176,7 @@ public class Conversions extends GenericModel { * * @return the pdf */ - public PdfSettings getPdf() { + public PdfSettings pdf() { return pdf; } @@ -49,7 +187,7 @@ public PdfSettings getPdf() { * * @return the word */ - public WordSettings getWord() { + public WordSettings word() { return word; } @@ -60,7 +198,7 @@ public WordSettings getWord() { * * @return the html */ - public HtmlSettings getHtml() { + public HtmlSettings html() { return html; } @@ -71,7 +209,7 @@ public HtmlSettings getHtml() { * * @return the segment */ - public SegmentSettings getSegment() { + public SegmentSettings segment() { return segment; } @@ -83,7 +221,7 @@ public SegmentSettings getSegment() { * * @return the jsonNormalizations */ - public List getJsonNormalizations() { + public List jsonNormalizations() { return jsonNormalizations; } @@ -97,61 +235,7 @@ public List getJsonNormalizations() { * * @return the imageTextRecognition */ - public Boolean isImageTextRecognition() { + public Boolean imageTextRecognition() { return imageTextRecognition; } - - /** - * Sets the pdf. - * - * @param pdf the new pdf - */ - public void setPdf(final PdfSettings pdf) { - this.pdf = pdf; - } - - /** - * Sets the word. - * - * @param word the new word - */ - public void setWord(final WordSettings word) { - this.word = word; - } - - /** - * Sets the html. - * - * @param html the new html - */ - public void setHtml(final HtmlSettings html) { - this.html = html; - } - - /** - * Sets the segment. - * - * @param segment the new segment - */ - public void setSegment(final SegmentSettings segment) { - this.segment = segment; - } - - /** - * Sets the jsonNormalizations. - * - * @param jsonNormalizations the new jsonNormalizations - */ - public void setJsonNormalizations(final List jsonNormalizations) { - this.jsonNormalizations = jsonNormalizations; - } - - /** - * Sets the imageTextRecognition. - * - * @param imageTextRecognition the new imageTextRecognition - */ - public void setImageTextRecognition(final Boolean imageTextRecognition) { - this.imageTextRecognition = imageTextRecognition; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptions.java index bf45226d096..4cf9dfa0f38 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createCollection options. @@ -155,8 +154,10 @@ public Builder language(String language) { } private CreateCollectionOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notNull(builder.name, "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); environmentId = builder.environmentId; name = builder.name; description = builder.description; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptions.java index 6683b985c79..81a1b6c3dbb 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createConfiguration options. @@ -86,7 +85,8 @@ public CreateConfigurationOptions build() { * @return the CreateConfigurationOptions builder */ public Builder addEnrichment(Enrichment enrichment) { - Validator.notNull(enrichment, "enrichment cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(enrichment, + "enrichment cannot be null"); if (this.enrichments == null) { this.enrichments = new ArrayList(); } @@ -101,7 +101,8 @@ public Builder addEnrichment(Enrichment enrichment) { * @return the CreateConfigurationOptions builder */ public Builder addNormalization(NormalizationOperation normalization) { - Validator.notNull(normalization, "normalization cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, + "normalization cannot be null"); if (this.normalizations == null) { this.normalizations = new ArrayList(); } @@ -195,19 +196,21 @@ public Builder source(Source source) { * @return the CreateConfigurationOptions builder */ public Builder configuration(Configuration configuration) { - this.name = configuration.getName(); - this.description = configuration.getDescription(); - this.conversions = configuration.getConversions(); - this.enrichments = configuration.getEnrichments(); - this.normalizations = configuration.getNormalizations(); - this.source = configuration.getSource(); + this.name = configuration.name(); + this.description = configuration.description(); + this.conversions = configuration.conversions(); + this.enrichments = configuration.enrichments(); + this.normalizations = configuration.normalizations(); + this.source = configuration.source(); return this; } } private CreateConfigurationOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notNull(builder.name, "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); environmentId = builder.environmentId; name = builder.name; description = builder.description; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java index adae6c9df39..dbffd64e4fa 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createCredentials options. @@ -149,15 +148,16 @@ public Builder status(String status) { * @return the CreateCredentialsOptions builder */ public Builder credentials(Credentials credentials) { - this.sourceType = credentials.getSourceType(); - this.credentialDetails = credentials.getCredentialDetails(); - this.status = credentials.getStatus(); + this.sourceType = credentials.sourceType(); + this.credentialDetails = credentials.credentialDetails(); + this.status = credentials.status(); return this; } } private CreateCredentialsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; sourceType = builder.sourceType; credentialDetails = builder.credentialDetails; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptions.java index a9a6fb93426..df8b961ff9d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createEnvironment options. @@ -124,7 +123,8 @@ public Builder size(String size) { } private CreateEnvironmentOptions(Builder builder) { - Validator.notNull(builder.name, "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); name = builder.name; description = builder.description; size = builder.size; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventOptions.java index 1dedeba00c1..df38ec419b6 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createEvent options. @@ -93,8 +92,10 @@ public Builder data(EventData data) { } private CreateEventOptions(Builder builder) { - Validator.notNull(builder.type, "type cannot be null"); - Validator.notNull(builder.data, "data cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.data, + "data cannot be null"); type = builder.type; data = builder.data; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventResponse.java index 46abed6ba1f..d3650bb409f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptions.java index fd8e200752c..b8e80f70145 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createExpansions options. @@ -76,7 +75,8 @@ public CreateExpansionsOptions build() { * @return the CreateExpansionsOptions builder */ public Builder addExpansions(Expansion expansions) { - Validator.notNull(expansions, "expansions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(expansions, + "expansions cannot be null"); if (this.expansions == null) { this.expansions = new ArrayList(); } @@ -125,15 +125,18 @@ public Builder expansions(List expansions) { * @return the CreateExpansionsOptions builder */ public Builder expansions(Expansions expansions) { - this.expansions = expansions.getExpansions(); + this.expansions = expansions.expansions(); return this; } } private CreateExpansionsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notNull(builder.expansions, "expansions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.expansions, + "expansions cannot be null"); environmentId = builder.environmentId; collectionId = builder.collectionId; expansions = builder.expansions; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptions.java index a7fa046869e..6ed609f58d7 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createGateway options. @@ -83,7 +82,8 @@ public Builder name(String name) { } private CreateGatewayOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; name = builder.name; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptions.java index cef90e8ccef..27088bfab8f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createStopwordList options. @@ -136,10 +135,14 @@ public Builder stopwordFile(File stopwordFile) throws FileNotFoundException { } private CreateStopwordListOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notNull(builder.stopwordFile, "stopwordFile cannot be null"); - Validator.notNull(builder.stopwordFilename, "stopwordFilename cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.stopwordFile, + "stopwordFile cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.stopwordFilename, + "stopwordFilename cannot be null"); environmentId = builder.environmentId; collectionId = builder.collectionId; stopwordFile = builder.stopwordFile; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptions.java index f956fca788a..3c1158ddaf2 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createTokenizationDictionary options. @@ -74,7 +73,8 @@ public CreateTokenizationDictionaryOptions build() { * @return the CreateTokenizationDictionaryOptions builder */ public Builder addTokenizationRules(TokenDictRule tokenizationRules) { - Validator.notNull(tokenizationRules, "tokenizationRules cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(tokenizationRules, + "tokenizationRules cannot be null"); if (this.tokenizationRules == null) { this.tokenizationRules = new ArrayList(); } @@ -118,8 +118,10 @@ public Builder tokenizationRules(List tokenizationRules) { } private CreateTokenizationDictionaryOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; tokenizationRules = builder.tokenizationRules; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptions.java index 7da185c8093..a026f325706 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createTrainingExample options. @@ -148,17 +147,20 @@ public Builder relevance(long relevance) { * @return the CreateTrainingExampleOptions builder */ public Builder trainingExample(TrainingExample trainingExample) { - this.documentId = trainingExample.getDocumentId(); - this.crossReference = trainingExample.getCrossReference(); - this.relevance = trainingExample.getRelevance(); + this.documentId = trainingExample.documentId(); + this.crossReference = trainingExample.crossReference(); + this.relevance = trainingExample.relevance(); return this; } } private CreateTrainingExampleOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.queryId, "queryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, + "queryId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; queryId = builder.queryId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java index accac4ab3b8..5a058847054 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -91,6 +91,308 @@ public interface SourceVersion { @SerializedName("secret_access_key") private String secretAccessKey; + /** + * Builder. + */ + public static class Builder { + private String credentialType; + private String clientId; + private String enterpriseId; + private String url; + private String username; + private String organizationUrl; + private String siteCollectionPath; + private String clientSecret; + private String publicKeyId; + private String privateKey; + private String passphrase; + private String password; + private String gatewayId; + private String sourceVersion; + private String webApplicationUrl; + private String domain; + private String endpoint; + private String accessKeyId; + private String secretAccessKey; + + private Builder(CredentialDetails credentialDetails) { + this.credentialType = credentialDetails.credentialType; + this.clientId = credentialDetails.clientId; + this.enterpriseId = credentialDetails.enterpriseId; + this.url = credentialDetails.url; + this.username = credentialDetails.username; + this.organizationUrl = credentialDetails.organizationUrl; + this.siteCollectionPath = credentialDetails.siteCollectionPath; + this.clientSecret = credentialDetails.clientSecret; + this.publicKeyId = credentialDetails.publicKeyId; + this.privateKey = credentialDetails.privateKey; + this.passphrase = credentialDetails.passphrase; + this.password = credentialDetails.password; + this.gatewayId = credentialDetails.gatewayId; + this.sourceVersion = credentialDetails.sourceVersion; + this.webApplicationUrl = credentialDetails.webApplicationUrl; + this.domain = credentialDetails.domain; + this.endpoint = credentialDetails.endpoint; + this.accessKeyId = credentialDetails.accessKeyId; + this.secretAccessKey = credentialDetails.secretAccessKey; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CredentialDetails. + * + * @return the credentialDetails + */ + public CredentialDetails build() { + return new CredentialDetails(this); + } + + /** + * Set the credentialType. + * + * @param credentialType the credentialType + * @return the CredentialDetails builder + */ + public Builder credentialType(String credentialType) { + this.credentialType = credentialType; + return this; + } + + /** + * Set the clientId. + * + * @param clientId the clientId + * @return the CredentialDetails builder + */ + public Builder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Set the enterpriseId. + * + * @param enterpriseId the enterpriseId + * @return the CredentialDetails builder + */ + public Builder enterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + return this; + } + + /** + * Set the url. + * + * @param url the url + * @return the CredentialDetails builder + */ + public Builder url(String url) { + this.url = url; + return this; + } + + /** + * Set the username. + * + * @param username the username + * @return the CredentialDetails builder + */ + public Builder username(String username) { + this.username = username; + return this; + } + + /** + * Set the organizationUrl. + * + * @param organizationUrl the organizationUrl + * @return the CredentialDetails builder + */ + public Builder organizationUrl(String organizationUrl) { + this.organizationUrl = organizationUrl; + return this; + } + + /** + * Set the siteCollectionPath. + * + * @param siteCollectionPath the siteCollectionPath + * @return the CredentialDetails builder + */ + public Builder siteCollectionPath(String siteCollectionPath) { + this.siteCollectionPath = siteCollectionPath; + return this; + } + + /** + * Set the clientSecret. + * + * @param clientSecret the clientSecret + * @return the CredentialDetails builder + */ + public Builder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Set the publicKeyId. + * + * @param publicKeyId the publicKeyId + * @return the CredentialDetails builder + */ + public Builder publicKeyId(String publicKeyId) { + this.publicKeyId = publicKeyId; + return this; + } + + /** + * Set the privateKey. + * + * @param privateKey the privateKey + * @return the CredentialDetails builder + */ + public Builder privateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Set the passphrase. + * + * @param passphrase the passphrase + * @return the CredentialDetails builder + */ + public Builder passphrase(String passphrase) { + this.passphrase = passphrase; + return this; + } + + /** + * Set the password. + * + * @param password the password + * @return the CredentialDetails builder + */ + public Builder password(String password) { + this.password = password; + return this; + } + + /** + * Set the gatewayId. + * + * @param gatewayId the gatewayId + * @return the CredentialDetails builder + */ + public Builder gatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + /** + * Set the sourceVersion. + * + * @param sourceVersion the sourceVersion + * @return the CredentialDetails builder + */ + public Builder sourceVersion(String sourceVersion) { + this.sourceVersion = sourceVersion; + return this; + } + + /** + * Set the webApplicationUrl. + * + * @param webApplicationUrl the webApplicationUrl + * @return the CredentialDetails builder + */ + public Builder webApplicationUrl(String webApplicationUrl) { + this.webApplicationUrl = webApplicationUrl; + return this; + } + + /** + * Set the domain. + * + * @param domain the domain + * @return the CredentialDetails builder + */ + public Builder domain(String domain) { + this.domain = domain; + return this; + } + + /** + * Set the endpoint. + * + * @param endpoint the endpoint + * @return the CredentialDetails builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the accessKeyId. + * + * @param accessKeyId the accessKeyId + * @return the CredentialDetails builder + */ + public Builder accessKeyId(String accessKeyId) { + this.accessKeyId = accessKeyId; + return this; + } + + /** + * Set the secretAccessKey. + * + * @param secretAccessKey the secretAccessKey + * @return the CredentialDetails builder + */ + public Builder secretAccessKey(String secretAccessKey) { + this.secretAccessKey = secretAccessKey; + return this; + } + } + + private CredentialDetails(Builder builder) { + credentialType = builder.credentialType; + clientId = builder.clientId; + enterpriseId = builder.enterpriseId; + url = builder.url; + username = builder.username; + organizationUrl = builder.organizationUrl; + siteCollectionPath = builder.siteCollectionPath; + clientSecret = builder.clientSecret; + publicKeyId = builder.publicKeyId; + privateKey = builder.privateKey; + passphrase = builder.passphrase; + password = builder.password; + gatewayId = builder.gatewayId; + sourceVersion = builder.sourceVersion; + webApplicationUrl = builder.webApplicationUrl; + domain = builder.domain; + endpoint = builder.endpoint; + accessKeyId = builder.accessKeyId; + secretAccessKey = builder.secretAccessKey; + } + + /** + * New builder. + * + * @return a CredentialDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the credentialType. * @@ -106,7 +408,7 @@ public interface SourceVersion { * * @return the credentialType */ - public String getCredentialType() { + public String credentialType() { return credentialType; } @@ -118,7 +420,7 @@ public String getCredentialType() { * * @return the clientId */ - public String getClientId() { + public String clientId() { return clientId; } @@ -130,7 +432,7 @@ public String getClientId() { * * @return the enterpriseId */ - public String getEnterpriseId() { + public String enterpriseId() { return enterpriseId; } @@ -142,7 +444,7 @@ public String getEnterpriseId() { * * @return the url */ - public String getUrl() { + public String url() { return url; } @@ -154,7 +456,7 @@ public String getUrl() { * * @return the username */ - public String getUsername() { + public String username() { return username; } @@ -166,7 +468,7 @@ public String getUsername() { * * @return the organizationUrl */ - public String getOrganizationUrl() { + public String organizationUrl() { return organizationUrl; } @@ -178,7 +480,7 @@ public String getOrganizationUrl() { * * @return the siteCollectionPath */ - public String getSiteCollectionPath() { + public String siteCollectionPath() { return siteCollectionPath; } @@ -191,7 +493,7 @@ public String getSiteCollectionPath() { * * @return the clientSecret */ - public String getClientSecret() { + public String clientSecret() { return clientSecret; } @@ -204,7 +506,7 @@ public String getClientSecret() { * * @return the publicKeyId */ - public String getPublicKeyId() { + public String publicKeyId() { return publicKeyId; } @@ -217,7 +519,7 @@ public String getPublicKeyId() { * * @return the privateKey */ - public String getPrivateKey() { + public String privateKey() { return privateKey; } @@ -230,7 +532,7 @@ public String getPrivateKey() { * * @return the passphrase */ - public String getPassphrase() { + public String passphrase() { return passphrase; } @@ -246,7 +548,7 @@ public String getPassphrase() { * * @return the password */ - public String getPassword() { + public String password() { return password; } @@ -259,7 +561,7 @@ public String getPassword() { * * @return the gatewayId */ - public String getGatewayId() { + public String gatewayId() { return gatewayId; } @@ -270,7 +572,7 @@ public String getGatewayId() { * * @return the sourceVersion */ - public String getSourceVersion() { + public String sourceVersion() { return sourceVersion; } @@ -282,7 +584,7 @@ public String getSourceVersion() { * * @return the webApplicationUrl */ - public String getWebApplicationUrl() { + public String webApplicationUrl() { return webApplicationUrl; } @@ -294,7 +596,7 @@ public String getWebApplicationUrl() { * * @return the domain */ - public String getDomain() { + public String domain() { return domain; } @@ -306,7 +608,7 @@ public String getDomain() { * * @return the endpoint */ - public String getEndpoint() { + public String endpoint() { return endpoint; } @@ -316,13 +618,11 @@ public String getEndpoint() { * The access key ID associated with the cloud object store. Only valid, and required, with a **credential_type** of * `aws4_hmac`. This value is never returned and is only used when creating or modifying **credentials**. For more * infomation, see the [cloud object store - * documentation] - * (https://cloud.ibm.com/docs/services/cloud-object-storage - * ?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). + * documentation](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). * * @return the accessKeyId */ - public String getAccessKeyId() { + public String accessKeyId() { return accessKeyId; } @@ -332,184 +632,11 @@ public String getAccessKeyId() { * The secret access key associated with the cloud object store. Only valid, and required, with a **credential_type** * of `aws4_hmac`. This value is never returned and is only used when creating or modifying **credentials**. For more * infomation, see the [cloud object store - * documentation] - * (https://cloud.ibm.com/docs/services/cloud-object-storage - * ?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). + * documentation](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). * * @return the secretAccessKey */ - public String getSecretAccessKey() { + public String secretAccessKey() { return secretAccessKey; } - - /** - * Sets the credentialType. - * - * @param credentialType the new credentialType - */ - public void setCredentialType(final String credentialType) { - this.credentialType = credentialType; - } - - /** - * Sets the clientId. - * - * @param clientId the new clientId - */ - public void setClientId(final String clientId) { - this.clientId = clientId; - } - - /** - * Sets the enterpriseId. - * - * @param enterpriseId the new enterpriseId - */ - public void setEnterpriseId(final String enterpriseId) { - this.enterpriseId = enterpriseId; - } - - /** - * Sets the url. - * - * @param url the new url - */ - public void setUrl(final String url) { - this.url = url; - } - - /** - * Sets the username. - * - * @param username the new username - */ - public void setUsername(final String username) { - this.username = username; - } - - /** - * Sets the organizationUrl. - * - * @param organizationUrl the new organizationUrl - */ - public void setOrganizationUrl(final String organizationUrl) { - this.organizationUrl = organizationUrl; - } - - /** - * Sets the siteCollectionPath. - * - * @param siteCollectionPath the new siteCollectionPath - */ - public void setSiteCollectionPath(final String siteCollectionPath) { - this.siteCollectionPath = siteCollectionPath; - } - - /** - * Sets the clientSecret. - * - * @param clientSecret the new clientSecret - */ - public void setClientSecret(final String clientSecret) { - this.clientSecret = clientSecret; - } - - /** - * Sets the publicKeyId. - * - * @param publicKeyId the new publicKeyId - */ - public void setPublicKeyId(final String publicKeyId) { - this.publicKeyId = publicKeyId; - } - - /** - * Sets the privateKey. - * - * @param privateKey the new privateKey - */ - public void setPrivateKey(final String privateKey) { - this.privateKey = privateKey; - } - - /** - * Sets the passphrase. - * - * @param passphrase the new passphrase - */ - public void setPassphrase(final String passphrase) { - this.passphrase = passphrase; - } - - /** - * Sets the password. - * - * @param password the new password - */ - public void setPassword(final String password) { - this.password = password; - } - - /** - * Sets the gatewayId. - * - * @param gatewayId the new gatewayId - */ - public void setGatewayId(final String gatewayId) { - this.gatewayId = gatewayId; - } - - /** - * Sets the sourceVersion. - * - * @param sourceVersion the new sourceVersion - */ - public void setSourceVersion(final String sourceVersion) { - this.sourceVersion = sourceVersion; - } - - /** - * Sets the webApplicationUrl. - * - * @param webApplicationUrl the new webApplicationUrl - */ - public void setWebApplicationUrl(final String webApplicationUrl) { - this.webApplicationUrl = webApplicationUrl; - } - - /** - * Sets the domain. - * - * @param domain the new domain - */ - public void setDomain(final String domain) { - this.domain = domain; - } - - /** - * Sets the endpoint. - * - * @param endpoint the new endpoint - */ - public void setEndpoint(final String endpoint) { - this.endpoint = endpoint; - } - - /** - * Sets the accessKeyId. - * - * @param accessKeyId the new accessKeyId - */ - public void setAccessKeyId(final String accessKeyId) { - this.accessKeyId = accessKeyId; - } - - /** - * Sets the secretAccessKey. - * - * @param secretAccessKey the new secretAccessKey - */ - public void setSecretAccessKey(final String secretAccessKey) { - this.secretAccessKey = secretAccessKey; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java index 787eb3dda09..ff5db5c49ba 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -61,6 +61,98 @@ public interface Status { private CredentialDetails credentialDetails; private String status; + /** + * Builder. + */ + public static class Builder { + private String credentialId; + private String sourceType; + private CredentialDetails credentialDetails; + private String status; + + private Builder(Credentials credentials) { + this.credentialId = credentials.credentialId; + this.sourceType = credentials.sourceType; + this.credentialDetails = credentials.credentialDetails; + this.status = credentials.status; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a Credentials. + * + * @return the credentials + */ + public Credentials build() { + return new Credentials(this); + } + + /** + * Set the credentialId. + * + * @param credentialId the credentialId + * @return the Credentials builder + */ + public Builder credentialId(String credentialId) { + this.credentialId = credentialId; + return this; + } + + /** + * Set the sourceType. + * + * @param sourceType the sourceType + * @return the Credentials builder + */ + public Builder sourceType(String sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Set the credentialDetails. + * + * @param credentialDetails the credentialDetails + * @return the Credentials builder + */ + public Builder credentialDetails(CredentialDetails credentialDetails) { + this.credentialDetails = credentialDetails; + return this; + } + + /** + * Set the status. + * + * @param status the status + * @return the Credentials builder + */ + public Builder status(String status) { + this.status = status; + return this; + } + } + + private Credentials(Builder builder) { + credentialId = builder.credentialId; + sourceType = builder.sourceType; + credentialDetails = builder.credentialDetails; + status = builder.status; + } + + /** + * New builder. + * + * @return a Credentials builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the credentialId. * @@ -68,7 +160,7 @@ public interface Status { * * @return the credentialId */ - public String getCredentialId() { + public String credentialId() { return credentialId; } @@ -84,7 +176,7 @@ public String getCredentialId() { * * @return the sourceType */ - public String getSourceType() { + public String sourceType() { return sourceType; } @@ -97,7 +189,7 @@ public String getSourceType() { * * @return the credentialDetails */ - public CredentialDetails getCredentialDetails() { + public CredentialDetails credentialDetails() { return credentialDetails; } @@ -110,34 +202,7 @@ public CredentialDetails getCredentialDetails() { * * @return the status */ - public String getStatus() { + public String status() { return status; } - - /** - * Sets the sourceType. - * - * @param sourceType the new sourceType - */ - public void setSourceType(final String sourceType) { - this.sourceType = sourceType; - } - - /** - * Sets the credentialDetails. - * - * @param credentialDetails the new credentialDetails - */ - public void setCredentialDetails(final CredentialDetails credentialDetails) { - this.credentialDetails = credentialDetails; - } - - /** - * Sets the status. - * - * @param status the new status - */ - public void setStatus(final String status) { - this.status = status; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialsList.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialsList.java index c6cb8a4a273..52364e98122 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialsList.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialsList.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptions.java index 6c7c252bc94..97e5001c183 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteAllTrainingData options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private DeleteAllTrainingDataOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptions.java index 21252ed8927..19f40b5009a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteCollection options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private DeleteCollectionOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponse.java index 1f33ec8aef8..7a2c19c431f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptions.java index 25b3228aaad..79d671b27b9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteConfiguration options. @@ -85,8 +84,10 @@ public Builder configurationId(String configurationId) { } private DeleteConfigurationOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.configurationId, "configurationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.configurationId, + "configurationId cannot be empty"); environmentId = builder.environmentId; configurationId = builder.configurationId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponse.java index 3b4e3699a96..67d2db22079 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentials.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentials.java index c217db8c3d4..3fdd75150b8 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentials.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentials.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptions.java index ab2b536694e..84ab6f1cb1e 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteCredentials options. @@ -85,8 +84,10 @@ public Builder credentialId(String credentialId) { } private DeleteCredentialsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.credentialId, "credentialId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.credentialId, + "credentialId cannot be empty"); environmentId = builder.environmentId; credentialId = builder.credentialId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptions.java index 91e25d58b9f..09583f52ea4 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteDocument options. @@ -101,9 +100,12 @@ public Builder documentId(String documentId) { } private DeleteDocumentOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.documentId, "documentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.documentId, + "documentId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; documentId = builder.documentId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponse.java index 5054722e443..20875cbb8f3 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptions.java index f740fd773f3..f5786ac25ad 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteEnvironment options. @@ -69,7 +68,8 @@ public Builder environmentId(String environmentId) { } private DeleteEnvironmentOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponse.java index 3440e64bda5..bf39cdf3802 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptions.java index e733018394d..3867168b6c9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteExpansions options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private DeleteExpansionsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptions.java index a69cc5a3e4d..9c71332d52b 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteGateway options. @@ -85,8 +84,10 @@ public Builder gatewayId(String gatewayId) { } private DeleteGatewayOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.gatewayId, "gatewayId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.gatewayId, + "gatewayId cannot be empty"); environmentId = builder.environmentId; gatewayId = builder.gatewayId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptions.java index f4b69aea52f..066e193821e 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteStopwordList options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private DeleteStopwordListOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptions.java index f6232eefc6b..2b2d42a316f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteTokenizationDictionary options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private DeleteTokenizationDictionaryOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptions.java index 78b883707b2..ac69389d4f7 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteTrainingData options. @@ -101,9 +100,12 @@ public Builder queryId(String queryId) { } private DeleteTrainingDataOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.queryId, "queryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, + "queryId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; queryId = builder.queryId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptions.java index 4e529552373..ca32e40e5d2 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteTrainingExample options. @@ -117,10 +116,14 @@ public Builder exampleId(String exampleId) { } private DeleteTrainingExampleOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - Validator.notEmpty(builder.exampleId, "exampleId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, + "queryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.exampleId, + "exampleId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; queryId = builder.queryId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptions.java index 4bbc6e21199..d9686fdfcae 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteUserData options. @@ -69,7 +68,8 @@ public Builder customerId(String customerId) { } private DeleteUserDataOptions(Builder builder) { - Validator.notNull(builder.customerId, "customerId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, + "customerId cannot be null"); customerId = builder.customerId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DiskUsage.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DiskUsage.java index 77d2d49c7bb..bdf90f58d9a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DiskUsage.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DiskUsage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentAccepted.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentAccepted.java index 237e6c241b7..3ee181bc79a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentAccepted.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentAccepted.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentCounts.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentCounts.java index 0ca28e674fe..9fa84d5bd0f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentCounts.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentCounts.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java index 02ed8111a04..e3885ea75ff 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,10 +12,11 @@ */ package com.ibm.watson.discovery.v1.model; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - +import java.util.List; import java.util.Map; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + /** * DocumentSnapshot. */ @@ -40,7 +41,7 @@ public interface Step { } private String step; - private Map snapshot; + private Map snapshot; /** * Gets the step. @@ -60,7 +61,7 @@ public String getStep() { * * @return the snapshot */ - public Map getSnapshot() { + public Map getSnapshot() { return snapshot; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentStatus.java index 98e81c8d8c9..2f2b7926d8d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentStatus.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java index 464812c5e59..7162542f884 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -26,12 +26,164 @@ public class Enrichment extends GenericModel { @SerializedName("source_field") private String sourceField; private Boolean overwrite; - @SerializedName("enrichment") - private String enrichmentName; + private String enrichment; @SerializedName("ignore_downstream_errors") private Boolean ignoreDownstreamErrors; private EnrichmentOptions options; + /** + * Builder. + */ + public static class Builder { + private String description; + private String destinationField; + private String sourceField; + private Boolean overwrite; + private String enrichment; + private Boolean ignoreDownstreamErrors; + private EnrichmentOptions options; + + private Builder(Enrichment enrichment) { + this.description = enrichment.description; + this.destinationField = enrichment.destinationField; + this.sourceField = enrichment.sourceField; + this.overwrite = enrichment.overwrite; + this.enrichment = enrichment.enrichment; + this.ignoreDownstreamErrors = enrichment.ignoreDownstreamErrors; + this.options = enrichment.options; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param destinationField the destinationField + * @param sourceField the sourceField + * @param enrichment the enrichment + */ + public Builder(String destinationField, String sourceField, String enrichment) { + this.destinationField = destinationField; + this.sourceField = sourceField; + this.enrichment = enrichment; + } + + /** + * Builds a Enrichment. + * + * @return the enrichment + */ + public Enrichment build() { + return new Enrichment(this); + } + + /** + * Set the description. + * + * @param description the description + * @return the Enrichment builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the destinationField. + * + * @param destinationField the destinationField + * @return the Enrichment builder + */ + public Builder destinationField(String destinationField) { + this.destinationField = destinationField; + return this; + } + + /** + * Set the sourceField. + * + * @param sourceField the sourceField + * @return the Enrichment builder + */ + public Builder sourceField(String sourceField) { + this.sourceField = sourceField; + return this; + } + + /** + * Set the overwrite. + * + * @param overwrite the overwrite + * @return the Enrichment builder + */ + public Builder overwrite(Boolean overwrite) { + this.overwrite = overwrite; + return this; + } + + /** + * Set the enrichment. + * + * @param enrichment the enrichment + * @return the Enrichment builder + */ + public Builder enrichment(String enrichment) { + this.enrichment = enrichment; + return this; + } + + /** + * Set the ignoreDownstreamErrors. + * + * @param ignoreDownstreamErrors the ignoreDownstreamErrors + * @return the Enrichment builder + */ + public Builder ignoreDownstreamErrors(Boolean ignoreDownstreamErrors) { + this.ignoreDownstreamErrors = ignoreDownstreamErrors; + return this; + } + + /** + * Set the options. + * + * @param options the options + * @return the Enrichment builder + */ + public Builder options(EnrichmentOptions options) { + this.options = options; + return this; + } + } + + private Enrichment(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.destinationField, + "destinationField cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.sourceField, + "sourceField cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.enrichment, + "enrichment cannot be null"); + description = builder.description; + destinationField = builder.destinationField; + sourceField = builder.sourceField; + overwrite = builder.overwrite; + enrichment = builder.enrichment; + ignoreDownstreamErrors = builder.ignoreDownstreamErrors; + options = builder.options; + } + + /** + * New builder. + * + * @return a Enrichment builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the description. * @@ -39,7 +191,7 @@ public class Enrichment extends GenericModel { * * @return the description */ - public String getDescription() { + public String description() { return description; } @@ -52,7 +204,7 @@ public String getDescription() { * * @return the destinationField */ - public String getDestinationField() { + public String destinationField() { return destinationField; } @@ -66,7 +218,7 @@ public String getDestinationField() { * * @return the sourceField */ - public String getSourceField() { + public String sourceField() { return sourceField; } @@ -77,12 +229,12 @@ public String getSourceField() { * * @return the overwrite */ - public Boolean isOverwrite() { + public Boolean overwrite() { return overwrite; } /** - * Gets the enrichmentName. + * Gets the enrichment. * * Name of the enrichment service to call. Current options are `natural_language_understanding` and `elements`. * @@ -92,13 +244,12 @@ public Boolean isOverwrite() { * When using `elements` the **options** object must contain Element Classification options. Additionally, when using * the `elements` enrichment the configuration specified and files ingested must meet all the criteria specified in * [the - * documentation] - * (https://cloud.ibm.com/docs/services/discovery?topic=discovery-element-classification#element-classification). + * documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-element-classification#element-classification). * - * @return the enrichmentName + * @return the enrichment */ - public String getEnrichmentName() { - return enrichmentName; + public String enrichment() { + return enrichment; } /** @@ -109,7 +260,7 @@ public String getEnrichmentName() { * * @return the ignoreDownstreamErrors */ - public Boolean isIgnoreDownstreamErrors() { + public Boolean ignoreDownstreamErrors() { return ignoreDownstreamErrors; } @@ -120,70 +271,7 @@ public Boolean isIgnoreDownstreamErrors() { * * @return the options */ - public EnrichmentOptions getOptions() { + public EnrichmentOptions options() { return options; } - - /** - * Sets the description. - * - * @param description the new description - */ - public void setDescription(final String description) { - this.description = description; - } - - /** - * Sets the destinationField. - * - * @param destinationField the new destinationField - */ - public void setDestinationField(final String destinationField) { - this.destinationField = destinationField; - } - - /** - * Sets the sourceField. - * - * @param sourceField the new sourceField - */ - public void setSourceField(final String sourceField) { - this.sourceField = sourceField; - } - - /** - * Sets the overwrite. - * - * @param overwrite the new overwrite - */ - public void setOverwrite(final Boolean overwrite) { - this.overwrite = overwrite; - } - - /** - * Sets the enrichmentName. - * - * @param enrichmentName the new enrichmentName - */ - public void setEnrichmentName(final String enrichmentName) { - this.enrichmentName = enrichmentName; - } - - /** - * Sets the ignoreDownstreamErrors. - * - * @param ignoreDownstreamErrors the new ignoreDownstreamErrors - */ - public void setIgnoreDownstreamErrors(final Boolean ignoreDownstreamErrors) { - this.ignoreDownstreamErrors = ignoreDownstreamErrors; - } - - /** - * Sets the options. - * - * @param options the new options - */ - public void setOptions(final EnrichmentOptions options) { - this.options = options; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java index 30921033ef8..c0946b06c62 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Environment.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Environment.java index 3093e5aed7c..4c6901ad3e4 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Environment.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Environment.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnvironmentDocuments.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnvironmentDocuments.java index 5c7e3977e49..a313bd70874 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnvironmentDocuments.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnvironmentDocuments.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EventData.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EventData.java index 748c886b4b3..b826dfd3802 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EventData.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EventData.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -37,6 +37,163 @@ public class EventData extends GenericModel { @SerializedName("query_id") private String queryId; + /** + * Builder. + */ + public static class Builder { + private String environmentId; + private String sessionToken; + private Date clientTimestamp; + private Long displayRank; + private String collectionId; + private String documentId; + private String queryId; + + private Builder(EventData eventData) { + this.environmentId = eventData.environmentId; + this.sessionToken = eventData.sessionToken; + this.clientTimestamp = eventData.clientTimestamp; + this.displayRank = eventData.displayRank; + this.collectionId = eventData.collectionId; + this.documentId = eventData.documentId; + this.queryId = eventData.queryId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param environmentId the environmentId + * @param sessionToken the sessionToken + * @param collectionId the collectionId + * @param documentId the documentId + */ + public Builder(String environmentId, String sessionToken, String collectionId, String documentId) { + this.environmentId = environmentId; + this.sessionToken = sessionToken; + this.collectionId = collectionId; + this.documentId = documentId; + } + + /** + * Builds a EventData. + * + * @return the eventData + */ + public EventData build() { + return new EventData(this); + } + + /** + * Set the environmentId. + * + * @param environmentId the environmentId + * @return the EventData builder + */ + public Builder environmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Set the sessionToken. + * + * @param sessionToken the sessionToken + * @return the EventData builder + */ + public Builder sessionToken(String sessionToken) { + this.sessionToken = sessionToken; + return this; + } + + /** + * Set the clientTimestamp. + * + * @param clientTimestamp the clientTimestamp + * @return the EventData builder + */ + public Builder clientTimestamp(Date clientTimestamp) { + this.clientTimestamp = clientTimestamp; + return this; + } + + /** + * Set the displayRank. + * + * @param displayRank the displayRank + * @return the EventData builder + */ + public Builder displayRank(long displayRank) { + this.displayRank = displayRank; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the EventData builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + + /** + * Set the documentId. + * + * @param documentId the documentId + * @return the EventData builder + */ + public Builder documentId(String documentId) { + this.documentId = documentId; + return this; + } + + /** + * Set the queryId. + * + * @param queryId the queryId + * @return the EventData builder + */ + public Builder queryId(String queryId) { + this.queryId = queryId; + return this; + } + } + + private EventData(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.environmentId, + "environmentId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.sessionToken, + "sessionToken cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.collectionId, + "collectionId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.documentId, + "documentId cannot be null"); + environmentId = builder.environmentId; + sessionToken = builder.sessionToken; + clientTimestamp = builder.clientTimestamp; + displayRank = builder.displayRank; + collectionId = builder.collectionId; + documentId = builder.documentId; + queryId = builder.queryId; + } + + /** + * New builder. + * + * @return a EventData builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the environmentId. * @@ -44,7 +201,7 @@ public class EventData extends GenericModel { * * @return the environmentId */ - public String getEnvironmentId() { + public String environmentId() { return environmentId; } @@ -55,7 +212,7 @@ public String getEnvironmentId() { * * @return the sessionToken */ - public String getSessionToken() { + public String sessionToken() { return sessionToken; } @@ -67,7 +224,7 @@ public String getSessionToken() { * * @return the clientTimestamp */ - public Date getClientTimestamp() { + public Date clientTimestamp() { return clientTimestamp; } @@ -78,7 +235,7 @@ public Date getClientTimestamp() { * * @return the displayRank */ - public Long getDisplayRank() { + public Long displayRank() { return displayRank; } @@ -89,7 +246,7 @@ public Long getDisplayRank() { * * @return the collectionId */ - public String getCollectionId() { + public String collectionId() { return collectionId; } @@ -100,7 +257,7 @@ public String getCollectionId() { * * @return the documentId */ - public String getDocumentId() { + public String documentId() { return documentId; } @@ -112,61 +269,7 @@ public String getDocumentId() { * * @return the queryId */ - public String getQueryId() { + public String queryId() { return queryId; } - - /** - * Sets the environmentId. - * - * @param environmentId the new environmentId - */ - public void setEnvironmentId(final String environmentId) { - this.environmentId = environmentId; - } - - /** - * Sets the sessionToken. - * - * @param sessionToken the new sessionToken - */ - public void setSessionToken(final String sessionToken) { - this.sessionToken = sessionToken; - } - - /** - * Sets the clientTimestamp. - * - * @param clientTimestamp the new clientTimestamp - */ - public void setClientTimestamp(final Date clientTimestamp) { - this.clientTimestamp = clientTimestamp; - } - - /** - * Sets the displayRank. - * - * @param displayRank the new displayRank - */ - public void setDisplayRank(final long displayRank) { - this.displayRank = displayRank; - } - - /** - * Sets the collectionId. - * - * @param collectionId the new collectionId - */ - public void setCollectionId(final String collectionId) { - this.collectionId = collectionId; - } - - /** - * Sets the documentId. - * - * @param documentId the new documentId - */ - public void setDocumentId(final String documentId) { - this.documentId = documentId; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansion.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansion.java index 74f7a021368..88f57e4bbb3 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansion.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansion.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -28,6 +29,115 @@ public class Expansion extends GenericModel { @SerializedName("expanded_terms") private List expandedTerms; + /** + * Builder. + */ + public static class Builder { + private List inputTerms; + private List expandedTerms; + + private Builder(Expansion expansion) { + this.inputTerms = expansion.inputTerms; + this.expandedTerms = expansion.expandedTerms; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param expandedTerms the expandedTerms + */ + public Builder(List expandedTerms) { + this.expandedTerms = expandedTerms; + } + + /** + * Builds a Expansion. + * + * @return the expansion + */ + public Expansion build() { + return new Expansion(this); + } + + /** + * Adds an inputTerms to inputTerms. + * + * @param inputTerms the new inputTerms + * @return the Expansion builder + */ + public Builder addInputTerms(String inputTerms) { + com.ibm.cloud.sdk.core.util.Validator.notNull(inputTerms, + "inputTerms cannot be null"); + if (this.inputTerms == null) { + this.inputTerms = new ArrayList(); + } + this.inputTerms.add(inputTerms); + return this; + } + + /** + * Adds an expandedTerms to expandedTerms. + * + * @param expandedTerms the new expandedTerms + * @return the Expansion builder + */ + public Builder addExpandedTerms(String expandedTerms) { + com.ibm.cloud.sdk.core.util.Validator.notNull(expandedTerms, + "expandedTerms cannot be null"); + if (this.expandedTerms == null) { + this.expandedTerms = new ArrayList(); + } + this.expandedTerms.add(expandedTerms); + return this; + } + + /** + * Set the inputTerms. + * Existing inputTerms will be replaced. + * + * @param inputTerms the inputTerms + * @return the Expansion builder + */ + public Builder inputTerms(List inputTerms) { + this.inputTerms = inputTerms; + return this; + } + + /** + * Set the expandedTerms. + * Existing expandedTerms will be replaced. + * + * @param expandedTerms the expandedTerms + * @return the Expansion builder + */ + public Builder expandedTerms(List expandedTerms) { + this.expandedTerms = expandedTerms; + return this; + } + } + + private Expansion(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.expandedTerms, + "expandedTerms cannot be null"); + inputTerms = builder.inputTerms; + expandedTerms = builder.expandedTerms; + } + + /** + * New builder. + * + * @return a Expansion builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the inputTerms. * @@ -35,7 +145,7 @@ public class Expansion extends GenericModel { * * @return the inputTerms */ - public List getInputTerms() { + public List inputTerms() { return inputTerms; } @@ -47,25 +157,7 @@ public List getInputTerms() { * * @return the expandedTerms */ - public List getExpandedTerms() { + public List expandedTerms() { return expandedTerms; } - - /** - * Sets the inputTerms. - * - * @param inputTerms the new inputTerms - */ - public void setInputTerms(final List inputTerms) { - this.inputTerms = inputTerms; - } - - /** - * Sets the expandedTerms. - * - * @param expandedTerms the new expandedTerms - */ - public void setExpandedTerms(final List expandedTerms) { - this.expandedTerms = expandedTerms; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansions.java index 562607a3cfe..e698c92b593 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -23,6 +24,84 @@ public class Expansions extends GenericModel { private List expansions; + /** + * Builder. + */ + public static class Builder { + private List expansions; + + private Builder(Expansions expansions) { + this.expansions = expansions.expansions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param expansions the expansions + */ + public Builder(List expansions) { + this.expansions = expansions; + } + + /** + * Builds a Expansions. + * + * @return the expansions + */ + public Expansions build() { + return new Expansions(this); + } + + /** + * Adds an expansions to expansions. + * + * @param expansions the new expansions + * @return the Expansions builder + */ + public Builder addExpansions(Expansion expansions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(expansions, + "expansions cannot be null"); + if (this.expansions == null) { + this.expansions = new ArrayList(); + } + this.expansions.add(expansions); + return this; + } + + /** + * Set the expansions. + * Existing expansions will be replaced. + * + * @param expansions the expansions + * @return the Expansions builder + */ + public Builder expansions(List expansions) { + this.expansions = expansions; + return this; + } + } + + private Expansions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.expansions, + "expansions cannot be null"); + expansions = builder.expansions; + } + + /** + * New builder. + * + * @return a Expansions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the expansions. * @@ -42,16 +121,7 @@ public class Expansions extends GenericModel { * * @return the expansions */ - public List getExpansions() { + public List expansions() { return expansions; } - - /** - * Sets the expansions. - * - * @param expansions the new expansions - */ - public void setExpansions(final List expansions) { - this.expansions = expansions; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java index c4aef5e8ac0..4054af0e91a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The federatedQueryNotices options. @@ -30,7 +29,7 @@ public class FederatedQueryNoticesOptions extends GenericModel { private String naturalLanguageQuery; private String aggregation; private Long count; - private List returnFields; + private List xreturn; private Long offset; private List sort; private Boolean highlight; @@ -50,7 +49,7 @@ public static class Builder { private String naturalLanguageQuery; private String aggregation; private Long count; - private List returnFields; + private List xreturn; private Long offset; private List sort; private Boolean highlight; @@ -67,7 +66,7 @@ private Builder(FederatedQueryNoticesOptions federatedQueryNoticesOptions) { this.naturalLanguageQuery = federatedQueryNoticesOptions.naturalLanguageQuery; this.aggregation = federatedQueryNoticesOptions.aggregation; this.count = federatedQueryNoticesOptions.count; - this.returnFields = federatedQueryNoticesOptions.returnFields; + this.xreturn = federatedQueryNoticesOptions.xreturn; this.offset = federatedQueryNoticesOptions.offset; this.sort = federatedQueryNoticesOptions.sort; this.highlight = federatedQueryNoticesOptions.highlight; @@ -110,7 +109,8 @@ public FederatedQueryNoticesOptions build() { * @return the FederatedQueryNoticesOptions builder */ public Builder addCollectionIds(String collectionIds) { - Validator.notNull(collectionIds, "collectionIds cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(collectionIds, + "collectionIds cannot be null"); if (this.collectionIds == null) { this.collectionIds = new ArrayList(); } @@ -119,17 +119,18 @@ public Builder addCollectionIds(String collectionIds) { } /** - * Adds an returnField to returnFields. + * Adds an returnField to xreturn. * * @param returnField the new returnField * @return the FederatedQueryNoticesOptions builder */ public Builder addReturnField(String returnField) { - Validator.notNull(returnField, "returnField cannot be null"); - if (this.returnFields == null) { - this.returnFields = new ArrayList(); + com.ibm.cloud.sdk.core.util.Validator.notNull(returnField, + "returnField cannot be null"); + if (this.xreturn == null) { + this.xreturn = new ArrayList(); } - this.returnFields.add(returnField); + this.xreturn.add(returnField); return this; } @@ -140,7 +141,8 @@ public Builder addReturnField(String returnField) { * @return the FederatedQueryNoticesOptions builder */ public Builder addSort(String sort) { - Validator.notNull(sort, "sort cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(sort, + "sort cannot be null"); if (this.sort == null) { this.sort = new ArrayList(); } @@ -155,7 +157,8 @@ public Builder addSort(String sort) { * @return the FederatedQueryNoticesOptions builder */ public Builder addSimilarDocumentIds(String similarDocumentIds) { - Validator.notNull(similarDocumentIds, "similarDocumentIds cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(similarDocumentIds, + "similarDocumentIds cannot be null"); if (this.similarDocumentIds == null) { this.similarDocumentIds = new ArrayList(); } @@ -170,7 +173,8 @@ public Builder addSimilarDocumentIds(String similarDocumentIds) { * @return the FederatedQueryNoticesOptions builder */ public Builder addSimilarFields(String similarFields) { - Validator.notNull(similarFields, "similarFields cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(similarFields, + "similarFields cannot be null"); if (this.similarFields == null) { this.similarFields = new ArrayList(); } @@ -257,14 +261,14 @@ public Builder count(long count) { } /** - * Set the returnFields. - * Existing returnFields will be replaced. + * Set the xreturn. + * Existing xreturn will be replaced. * - * @param returnFields the returnFields + * @param xreturn the xreturn * @return the FederatedQueryNoticesOptions builder */ - public Builder returnFields(List returnFields) { - this.returnFields = returnFields; + public Builder xreturn(List xreturn) { + this.xreturn = xreturn; return this; } @@ -350,8 +354,10 @@ public Builder similarFields(List similarFields) { } private FederatedQueryNoticesOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notNull(builder.collectionIds, "collectionIds cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.collectionIds, + "collectionIds cannot be null"); environmentId = builder.environmentId; collectionIds = builder.collectionIds; filter = builder.filter; @@ -359,7 +365,7 @@ private FederatedQueryNoticesOptions(Builder builder) { naturalLanguageQuery = builder.naturalLanguageQuery; aggregation = builder.aggregation; count = builder.count; - returnFields = builder.returnFields; + xreturn = builder.xreturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -461,14 +467,14 @@ public Long count() { } /** - * Gets the returnFields. + * Gets the xreturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the returnFields + * @return the xreturn */ - public List returnFields() { - return returnFields; + public List xreturn() { + return xreturn; } /** diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java index df5e5609e48..b93ccf474a9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The federatedQuery options. @@ -27,7 +26,7 @@ public class FederatedQueryOptions extends GenericModel { private Boolean passages; private String aggregation; private Long count; - private String returnFields; + private String xreturn; private Long offset; private String sort; private Boolean highlight; @@ -41,7 +40,7 @@ public class FederatedQueryOptions extends GenericModel { private String similarDocumentIds; private String similarFields; private String bias; - private Boolean loggingOptOut; + private Boolean xWatsonLoggingOptOut; /** * Builder. @@ -54,7 +53,7 @@ public static class Builder { private Boolean passages; private String aggregation; private Long count; - private String returnFields; + private String xreturn; private Long offset; private String sort; private Boolean highlight; @@ -68,7 +67,7 @@ public static class Builder { private String similarDocumentIds; private String similarFields; private String bias; - private Boolean loggingOptOut; + private Boolean xWatsonLoggingOptOut; private Builder(FederatedQueryOptions federatedQueryOptions) { this.environmentId = federatedQueryOptions.environmentId; @@ -78,7 +77,7 @@ private Builder(FederatedQueryOptions federatedQueryOptions) { this.passages = federatedQueryOptions.passages; this.aggregation = federatedQueryOptions.aggregation; this.count = federatedQueryOptions.count; - this.returnFields = federatedQueryOptions.returnFields; + this.xreturn = federatedQueryOptions.xreturn; this.offset = federatedQueryOptions.offset; this.sort = federatedQueryOptions.sort; this.highlight = federatedQueryOptions.highlight; @@ -92,7 +91,7 @@ private Builder(FederatedQueryOptions federatedQueryOptions) { this.similarDocumentIds = federatedQueryOptions.similarDocumentIds; this.similarFields = federatedQueryOptions.similarFields; this.bias = federatedQueryOptions.bias; - this.loggingOptOut = federatedQueryOptions.loggingOptOut; + this.xWatsonLoggingOptOut = federatedQueryOptions.xWatsonLoggingOptOut; } /** @@ -197,13 +196,13 @@ public Builder count(long count) { } /** - * Set the returnFields. + * Set the xreturn. * - * @param returnFields the returnFields + * @param xreturn the xreturn * @return the FederatedQueryOptions builder */ - public Builder returnFields(String returnFields) { - this.returnFields = returnFields; + public Builder xreturn(String xreturn) { + this.xreturn = xreturn; return this; } @@ -351,19 +350,20 @@ public Builder bias(String bias) { } /** - * Set the loggingOptOut. + * Set the xWatsonLoggingOptOut. * - * @param loggingOptOut the loggingOptOut + * @param xWatsonLoggingOptOut the xWatsonLoggingOptOut * @return the FederatedQueryOptions builder */ - public Builder loggingOptOut(Boolean loggingOptOut) { - this.loggingOptOut = loggingOptOut; + public Builder xWatsonLoggingOptOut(Boolean xWatsonLoggingOptOut) { + this.xWatsonLoggingOptOut = xWatsonLoggingOptOut; return this; } } private FederatedQueryOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; filter = builder.filter; query = builder.query; @@ -371,7 +371,7 @@ private FederatedQueryOptions(Builder builder) { passages = builder.passages; aggregation = builder.aggregation; count = builder.count; - returnFields = builder.returnFields; + xreturn = builder.xreturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -385,7 +385,7 @@ private FederatedQueryOptions(Builder builder) { similarDocumentIds = builder.similarDocumentIds; similarFields = builder.similarFields; bias = builder.bias; - loggingOptOut = builder.loggingOptOut; + xWatsonLoggingOptOut = builder.xWatsonLoggingOptOut; } /** @@ -479,14 +479,14 @@ public Long count() { } /** - * Gets the returnFields. + * Gets the xreturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the returnFields + * @return the xreturn */ - public String returnFields() { - return returnFields; + public String xreturn() { + return xreturn; } /** @@ -653,13 +653,13 @@ public String bias() { } /** - * Gets the loggingOptOut. + * Gets the xWatsonLoggingOptOut. * * If `true`, queries are not stored in the Discovery **Logs** endpoint. * - * @return the loggingOptOut + * @return the xWatsonLoggingOptOut */ - public Boolean loggingOptOut() { - return loggingOptOut; + public Boolean xWatsonLoggingOptOut() { + return xWatsonLoggingOptOut; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java index d8d83f43a11..1a4bf91c510 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,7 +12,6 @@ */ package com.ibm.watson.discovery.v1.model; -import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; /** @@ -23,7 +22,7 @@ public class Field extends GenericModel { /** * The type of the field. */ - public interface FieldType { + public interface Type { /** nested. */ String NESTED = "nested"; /** string. */ @@ -48,30 +47,28 @@ public interface FieldType { String BINARY = "binary"; } - @SerializedName("field") - private String fieldName; - @SerializedName("type") - private String fieldType; + private String field; + private String type; /** - * Gets the fieldName. + * Gets the field. * * The name of the field. * - * @return the fieldName + * @return the field */ - public String getFieldName() { - return fieldName; + public String getField() { + return field; } /** - * Gets the fieldType. + * Gets the type. * * The type of the field. * - * @return the fieldType + * @return the type */ - public String getFieldType() { - return fieldType; + public String getType() { + return type; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Filter.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Filter.java index 76bca8af5e1..5fb1517d54f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Filter.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FontSetting.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FontSetting.java index 47b538e1319..0b8b4cb4ebb 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FontSetting.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FontSetting.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -29,6 +29,126 @@ public class FontSetting extends GenericModel { private Boolean italic; private String name; + /** + * Builder. + */ + public static class Builder { + private Long level; + private Long minSize; + private Long maxSize; + private Boolean bold; + private Boolean italic; + private String name; + + private Builder(FontSetting fontSetting) { + this.level = fontSetting.level; + this.minSize = fontSetting.minSize; + this.maxSize = fontSetting.maxSize; + this.bold = fontSetting.bold; + this.italic = fontSetting.italic; + this.name = fontSetting.name; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a FontSetting. + * + * @return the fontSetting + */ + public FontSetting build() { + return new FontSetting(this); + } + + /** + * Set the level. + * + * @param level the level + * @return the FontSetting builder + */ + public Builder level(long level) { + this.level = level; + return this; + } + + /** + * Set the minSize. + * + * @param minSize the minSize + * @return the FontSetting builder + */ + public Builder minSize(long minSize) { + this.minSize = minSize; + return this; + } + + /** + * Set the maxSize. + * + * @param maxSize the maxSize + * @return the FontSetting builder + */ + public Builder maxSize(long maxSize) { + this.maxSize = maxSize; + return this; + } + + /** + * Set the bold. + * + * @param bold the bold + * @return the FontSetting builder + */ + public Builder bold(Boolean bold) { + this.bold = bold; + return this; + } + + /** + * Set the italic. + * + * @param italic the italic + * @return the FontSetting builder + */ + public Builder italic(Boolean italic) { + this.italic = italic; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the FontSetting builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + } + + private FontSetting(Builder builder) { + level = builder.level; + minSize = builder.minSize; + maxSize = builder.maxSize; + bold = builder.bold; + italic = builder.italic; + name = builder.name; + } + + /** + * New builder. + * + * @return a FontSetting builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the level. * @@ -36,7 +156,7 @@ public class FontSetting extends GenericModel { * * @return the level */ - public Long getLevel() { + public Long level() { return level; } @@ -47,7 +167,7 @@ public Long getLevel() { * * @return the minSize */ - public Long getMinSize() { + public Long minSize() { return minSize; } @@ -58,7 +178,7 @@ public Long getMinSize() { * * @return the maxSize */ - public Long getMaxSize() { + public Long maxSize() { return maxSize; } @@ -69,7 +189,7 @@ public Long getMaxSize() { * * @return the bold */ - public Boolean isBold() { + public Boolean bold() { return bold; } @@ -80,7 +200,7 @@ public Boolean isBold() { * * @return the italic */ - public Boolean isItalic() { + public Boolean italic() { return italic; } @@ -91,61 +211,7 @@ public Boolean isItalic() { * * @return the name */ - public String getName() { + public String name() { return name; } - - /** - * Sets the level. - * - * @param level the new level - */ - public void setLevel(final long level) { - this.level = level; - } - - /** - * Sets the minSize. - * - * @param minSize the new minSize - */ - public void setMinSize(final long minSize) { - this.minSize = minSize; - } - - /** - * Sets the maxSize. - * - * @param maxSize the new maxSize - */ - public void setMaxSize(final long maxSize) { - this.maxSize = maxSize; - } - - /** - * Sets the bold. - * - * @param bold the new bold - */ - public void setBold(final Boolean bold) { - this.bold = bold; - } - - /** - * Sets the italic. - * - * @param italic the new italic - */ - public void setItalic(final Boolean italic) { - this.italic = italic; - } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(final String name) { - this.name = name; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Gateway.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Gateway.java index c10c516379a..59e6b4a2164 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Gateway.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Gateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayDelete.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayDelete.java index 231277849a3..9c6141094df 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayDelete.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayDelete.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayList.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayList.java index c754fe012e5..1a999a43dbf 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayList.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayList.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCollectionOptions.java index f036bddba27..0491ae8b736 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCollectionOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCollectionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getCollection options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private GetCollectionOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptions.java index acb58e92c38..b9567a0bc2a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getConfiguration options. @@ -85,8 +84,10 @@ public Builder configurationId(String configurationId) { } private GetConfigurationOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.configurationId, "configurationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.configurationId, + "configurationId cannot be empty"); environmentId = builder.environmentId; configurationId = builder.configurationId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptions.java index 65288c5c2e5..16d12ed352a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getCredentials options. @@ -85,8 +84,10 @@ public Builder credentialId(String credentialId) { } private GetCredentialsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.credentialId, "credentialId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.credentialId, + "credentialId cannot be empty"); environmentId = builder.environmentId; credentialId = builder.credentialId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptions.java index 62778a26476..e0d1dd3d5be 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getDocumentStatus options. @@ -101,9 +100,12 @@ public Builder documentId(String documentId) { } private GetDocumentStatusOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.documentId, "documentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.documentId, + "documentId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; documentId = builder.documentId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptions.java index 84be0a3209d..dec851c7562 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getEnvironment options. @@ -69,7 +68,8 @@ public Builder environmentId(String environmentId) { } private GetEnvironmentOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetGatewayOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetGatewayOptions.java index a3438eccb3c..f79d683e0fa 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetGatewayOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetGatewayOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getGateway options. @@ -85,8 +84,10 @@ public Builder gatewayId(String gatewayId) { } private GetGatewayOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.gatewayId, "gatewayId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.gatewayId, + "gatewayId cannot be empty"); environmentId = builder.environmentId; gatewayId = builder.gatewayId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptions.java index 78c0d28b179..61b2434b9f3 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptions.java index b139ff04c9b..88581c7e1bc 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptions.java index 218ce4d543d..c6912c3dec8 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptions.java index 4d957206dca..fc39e5c47aa 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptions.java index 7477327cf03..0416c267da2 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptions.java index bdbd26cfcc7..a15188cb70c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getStopwordListStatus options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private GetStopwordListStatusOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptions.java index 18cd992c944..bea59e5f74f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getTokenizationDictionaryStatus options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private GetTokenizationDictionaryStatusOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptions.java index 24e3230df8f..4e4c12e566f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getTrainingData options. @@ -101,9 +100,12 @@ public Builder queryId(String queryId) { } private GetTrainingDataOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.queryId, "queryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, + "queryId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; queryId = builder.queryId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptions.java index e5ad415a054..509c66d383a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getTrainingExample options. @@ -117,10 +116,14 @@ public Builder exampleId(String exampleId) { } private GetTrainingExampleOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - Validator.notEmpty(builder.exampleId, "exampleId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, + "queryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.exampleId, + "exampleId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; queryId = builder.queryId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Histogram.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Histogram.java index 4e695a6b0e7..440421f382c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Histogram.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Histogram.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/HtmlSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/HtmlSettings.java index 935fa1bee8e..5ccebb05461 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/HtmlSettings.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/HtmlSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -35,6 +36,194 @@ public class HtmlSettings extends GenericModel { @SerializedName("exclude_tag_attributes") private List excludeTagAttributes; + /** + * Builder. + */ + public static class Builder { + private List excludeTagsCompletely; + private List excludeTagsKeepContent; + private XPathPatterns keepContent; + private XPathPatterns excludeContent; + private List keepTagAttributes; + private List excludeTagAttributes; + + private Builder(HtmlSettings htmlSettings) { + this.excludeTagsCompletely = htmlSettings.excludeTagsCompletely; + this.excludeTagsKeepContent = htmlSettings.excludeTagsKeepContent; + this.keepContent = htmlSettings.keepContent; + this.excludeContent = htmlSettings.excludeContent; + this.keepTagAttributes = htmlSettings.keepTagAttributes; + this.excludeTagAttributes = htmlSettings.excludeTagAttributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a HtmlSettings. + * + * @return the htmlSettings + */ + public HtmlSettings build() { + return new HtmlSettings(this); + } + + /** + * Adds an excludeTagsCompletely to excludeTagsCompletely. + * + * @param excludeTagsCompletely the new excludeTagsCompletely + * @return the HtmlSettings builder + */ + public Builder addExcludeTagsCompletely(String excludeTagsCompletely) { + com.ibm.cloud.sdk.core.util.Validator.notNull(excludeTagsCompletely, + "excludeTagsCompletely cannot be null"); + if (this.excludeTagsCompletely == null) { + this.excludeTagsCompletely = new ArrayList(); + } + this.excludeTagsCompletely.add(excludeTagsCompletely); + return this; + } + + /** + * Adds an excludeTagsKeepContent to excludeTagsKeepContent. + * + * @param excludeTagsKeepContent the new excludeTagsKeepContent + * @return the HtmlSettings builder + */ + public Builder addExcludeTagsKeepContent(String excludeTagsKeepContent) { + com.ibm.cloud.sdk.core.util.Validator.notNull(excludeTagsKeepContent, + "excludeTagsKeepContent cannot be null"); + if (this.excludeTagsKeepContent == null) { + this.excludeTagsKeepContent = new ArrayList(); + } + this.excludeTagsKeepContent.add(excludeTagsKeepContent); + return this; + } + + /** + * Adds an keepTagAttributes to keepTagAttributes. + * + * @param keepTagAttributes the new keepTagAttributes + * @return the HtmlSettings builder + */ + public Builder addKeepTagAttributes(String keepTagAttributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(keepTagAttributes, + "keepTagAttributes cannot be null"); + if (this.keepTagAttributes == null) { + this.keepTagAttributes = new ArrayList(); + } + this.keepTagAttributes.add(keepTagAttributes); + return this; + } + + /** + * Adds an excludeTagAttributes to excludeTagAttributes. + * + * @param excludeTagAttributes the new excludeTagAttributes + * @return the HtmlSettings builder + */ + public Builder addExcludeTagAttributes(String excludeTagAttributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(excludeTagAttributes, + "excludeTagAttributes cannot be null"); + if (this.excludeTagAttributes == null) { + this.excludeTagAttributes = new ArrayList(); + } + this.excludeTagAttributes.add(excludeTagAttributes); + return this; + } + + /** + * Set the excludeTagsCompletely. + * Existing excludeTagsCompletely will be replaced. + * + * @param excludeTagsCompletely the excludeTagsCompletely + * @return the HtmlSettings builder + */ + public Builder excludeTagsCompletely(List excludeTagsCompletely) { + this.excludeTagsCompletely = excludeTagsCompletely; + return this; + } + + /** + * Set the excludeTagsKeepContent. + * Existing excludeTagsKeepContent will be replaced. + * + * @param excludeTagsKeepContent the excludeTagsKeepContent + * @return the HtmlSettings builder + */ + public Builder excludeTagsKeepContent(List excludeTagsKeepContent) { + this.excludeTagsKeepContent = excludeTagsKeepContent; + return this; + } + + /** + * Set the keepContent. + * + * @param keepContent the keepContent + * @return the HtmlSettings builder + */ + public Builder keepContent(XPathPatterns keepContent) { + this.keepContent = keepContent; + return this; + } + + /** + * Set the excludeContent. + * + * @param excludeContent the excludeContent + * @return the HtmlSettings builder + */ + public Builder excludeContent(XPathPatterns excludeContent) { + this.excludeContent = excludeContent; + return this; + } + + /** + * Set the keepTagAttributes. + * Existing keepTagAttributes will be replaced. + * + * @param keepTagAttributes the keepTagAttributes + * @return the HtmlSettings builder + */ + public Builder keepTagAttributes(List keepTagAttributes) { + this.keepTagAttributes = keepTagAttributes; + return this; + } + + /** + * Set the excludeTagAttributes. + * Existing excludeTagAttributes will be replaced. + * + * @param excludeTagAttributes the excludeTagAttributes + * @return the HtmlSettings builder + */ + public Builder excludeTagAttributes(List excludeTagAttributes) { + this.excludeTagAttributes = excludeTagAttributes; + return this; + } + } + + private HtmlSettings(Builder builder) { + excludeTagsCompletely = builder.excludeTagsCompletely; + excludeTagsKeepContent = builder.excludeTagsKeepContent; + keepContent = builder.keepContent; + excludeContent = builder.excludeContent; + keepTagAttributes = builder.keepTagAttributes; + excludeTagAttributes = builder.excludeTagAttributes; + } + + /** + * New builder. + * + * @return a HtmlSettings builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the excludeTagsCompletely. * @@ -42,7 +231,7 @@ public class HtmlSettings extends GenericModel { * * @return the excludeTagsCompletely */ - public List getExcludeTagsCompletely() { + public List excludeTagsCompletely() { return excludeTagsCompletely; } @@ -53,7 +242,7 @@ public List getExcludeTagsCompletely() { * * @return the excludeTagsKeepContent */ - public List getExcludeTagsKeepContent() { + public List excludeTagsKeepContent() { return excludeTagsKeepContent; } @@ -62,7 +251,7 @@ public List getExcludeTagsKeepContent() { * * @return the keepContent */ - public XPathPatterns getKeepContent() { + public XPathPatterns keepContent() { return keepContent; } @@ -71,7 +260,7 @@ public XPathPatterns getKeepContent() { * * @return the excludeContent */ - public XPathPatterns getExcludeContent() { + public XPathPatterns excludeContent() { return excludeContent; } @@ -82,7 +271,7 @@ public XPathPatterns getExcludeContent() { * * @return the keepTagAttributes */ - public List getKeepTagAttributes() { + public List keepTagAttributes() { return keepTagAttributes; } @@ -93,61 +282,7 @@ public List getKeepTagAttributes() { * * @return the excludeTagAttributes */ - public List getExcludeTagAttributes() { + public List excludeTagAttributes() { return excludeTagAttributes; } - - /** - * Sets the excludeTagsCompletely. - * - * @param excludeTagsCompletely the new excludeTagsCompletely - */ - public void setExcludeTagsCompletely(final List excludeTagsCompletely) { - this.excludeTagsCompletely = excludeTagsCompletely; - } - - /** - * Sets the excludeTagsKeepContent. - * - * @param excludeTagsKeepContent the new excludeTagsKeepContent - */ - public void setExcludeTagsKeepContent(final List excludeTagsKeepContent) { - this.excludeTagsKeepContent = excludeTagsKeepContent; - } - - /** - * Sets the keepContent. - * - * @param keepContent the new keepContent - */ - public void setKeepContent(final XPathPatterns keepContent) { - this.keepContent = keepContent; - } - - /** - * Sets the excludeContent. - * - * @param excludeContent the new excludeContent - */ - public void setExcludeContent(final XPathPatterns excludeContent) { - this.excludeContent = excludeContent; - } - - /** - * Sets the keepTagAttributes. - * - * @param keepTagAttributes the new keepTagAttributes - */ - public void setKeepTagAttributes(final List keepTagAttributes) { - this.keepTagAttributes = keepTagAttributes; - } - - /** - * Sets the excludeTagAttributes. - * - * @param excludeTagAttributes the new excludeTagAttributes - */ - public void setExcludeTagAttributes(final List excludeTagAttributes) { - this.excludeTagAttributes = excludeTagAttributes; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/IndexCapacity.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/IndexCapacity.java index 923e37c50f5..718847832b2 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/IndexCapacity.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/IndexCapacity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptions.java index 99b3d1e8cce..170f0094c6e 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listCollectionFields options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private ListCollectionFieldsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponse.java index 5e3f4fd23e4..fc49b663a5d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptions.java index 7e1ab87b854..5fd9c5bf3b5 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listCollections options. @@ -83,7 +82,8 @@ public Builder name(String name) { } private ListCollectionsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; name = builder.name; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponse.java index 7c69948e3ff..b2d1a01b781 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptions.java index 13244661e78..7370ca5b423 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listConfigurations options. @@ -83,7 +82,8 @@ public Builder name(String name) { } private ListConfigurationsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; name = builder.name; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponse.java index aa8fbff417e..961d111f5a3 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptions.java index d5e3f21d3f3..7f45d6c8b0f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listCredentials options. @@ -69,7 +68,8 @@ public Builder environmentId(String environmentId) { } private ListCredentialsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptions.java index 342780cd548..0b416e15e46 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponse.java index a2212b2255b..52529d432fb 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptions.java index 18a05f6c85f..1954b407aef 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listExpansions options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private ListExpansionsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListFieldsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListFieldsOptions.java index 7a45c85b7b7..574245cf2ed 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListFieldsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListFieldsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listFields options. @@ -71,7 +70,8 @@ public ListFieldsOptions build() { * @return the ListFieldsOptions builder */ public Builder addCollectionIds(String collectionIds) { - Validator.notNull(collectionIds, "collectionIds cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(collectionIds, + "collectionIds cannot be null"); if (this.collectionIds == null) { this.collectionIds = new ArrayList(); } @@ -104,8 +104,10 @@ public Builder collectionIds(List collectionIds) { } private ListFieldsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notNull(builder.collectionIds, "collectionIds cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.collectionIds, + "collectionIds cannot be null"); environmentId = builder.environmentId; collectionIds = builder.collectionIds; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptions.java index 889b4344a49..d612a719ffc 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listGateways options. @@ -69,7 +68,8 @@ public Builder environmentId(String environmentId) { } private ListGatewaysOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptions.java index 0f830ba69fa..c9bfe4a2181 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listTrainingData options. @@ -85,8 +84,10 @@ public Builder collectionId(String collectionId) { } private ListTrainingDataOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptions.java index 6ef8fe925aa..57144a47c31 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listTrainingExamples options. @@ -101,9 +100,12 @@ public Builder queryId(String queryId) { } private ListTrainingExamplesOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.queryId, "queryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, + "queryId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; queryId = builder.queryId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponse.java index 3ddaad64dac..d6b3c46fec0 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResult.java index 4c1c9dee545..eb6a64751dc 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocuments.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocuments.java index 6dc809c43f1..04478f4d62f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocuments.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocuments.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResult.java index 4d00b6510d5..a54d2824d83 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregation.java index 5c47d5feef5..9f7c5c631cf 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregation.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregationResult.java index 111ba85a6b7..ed76d641fd3 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregationResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricResponse.java index 24d23fcbb07..5abb783e86b 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregation.java index d7aa07add3d..03161ce5c8b 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregation.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResult.java index 09ed0d23346..a10bc553236 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenResponse.java index 80e7ffcd2d1..5d7b81f1f2f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Nested.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Nested.java index 70957482e1b..b7bf615188e 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Nested.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Nested.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java index 44ffa37e5e2..5242d80b6e9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConcepts.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConcepts.java index f199a647f42..313e121bcb5 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConcepts.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConcepts.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,22 +22,63 @@ public class NluEnrichmentConcepts extends GenericModel { private Long limit; /** - * Gets the limit. - * - * The maximum number of concepts enrichments to extact from each instance of the specified field. + * Builder. + */ + public static class Builder { + private Long limit; + + private Builder(NluEnrichmentConcepts nluEnrichmentConcepts) { + this.limit = nluEnrichmentConcepts.limit; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a NluEnrichmentConcepts. + * + * @return the nluEnrichmentConcepts + */ + public NluEnrichmentConcepts build() { + return new NluEnrichmentConcepts(this); + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the NluEnrichmentConcepts builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + } + + private NluEnrichmentConcepts(Builder builder) { + limit = builder.limit; + } + + /** + * New builder. * - * @return the limit + * @return a NluEnrichmentConcepts builder */ - public Long getLimit() { - return limit; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the limit. + * Gets the limit. + * + * The maximum number of concepts enrichments to extact from each instance of the specified field. * - * @param limit the new limit + * @return the limit */ - public void setLimit(final long limit) { - this.limit = limit; + public Long limit() { + return limit; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotion.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotion.java index 6ed706040ab..52a8046a4f6 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotion.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotion.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * An object specifying the emotion detection enrichment and related parameters. @@ -60,7 +59,8 @@ public NluEnrichmentEmotion build() { * @return the NluEnrichmentEmotion builder */ public Builder addTarget(String target) { - Validator.notNull(target, "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(target, + "target cannot be null"); if (this.targets == null) { this.targets = new ArrayList(); } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntities.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntities.java index 321104b25db..3a1349abdee 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntities.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntities.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeatures.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeatures.java index 0099443aa9d..d6794ffe85c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeatures.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeatures.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywords.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywords.java index 07dfb8132b7..a2796d655aa 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywords.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywords.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelations.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelations.java index 990c9664c66..17904a856c5 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelations.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelations.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -21,6 +21,56 @@ public class NluEnrichmentRelations extends GenericModel { private String model; + /** + * Builder. + */ + public static class Builder { + private String model; + + private Builder(NluEnrichmentRelations nluEnrichmentRelations) { + this.model = nluEnrichmentRelations.model; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a NluEnrichmentRelations. + * + * @return the nluEnrichmentRelations + */ + public NluEnrichmentRelations build() { + return new NluEnrichmentRelations(this); + } + + /** + * Set the model. + * + * @param model the model + * @return the NluEnrichmentRelations builder + */ + public Builder model(String model) { + this.model = model; + return this; + } + } + + private NluEnrichmentRelations(Builder builder) { + model = builder.model; + } + + /** + * New builder. + * + * @return a NluEnrichmentRelations builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the model. * @@ -30,16 +80,7 @@ public class NluEnrichmentRelations extends GenericModel { * * @return the model */ - public String getModel() { + public String model() { return model; } - - /** - * Sets the model. - * - * @param model the new model - */ - public void setModel(final String model) { - this.model = model; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRoles.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRoles.java index 46475c759ad..d05836abaf8 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRoles.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRoles.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentiment.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentiment.java index b49682d8dcc..a9202f36b3d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentiment.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentiment.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * An object specifying the sentiment extraction enrichment and related parameters. @@ -60,7 +59,8 @@ public NluEnrichmentSentiment build() { * @return the NluEnrichmentSentiment builder */ public Builder addTarget(String target) { - Validator.notNull(target, "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(target, + "target cannot be null"); if (this.targets == null) { this.targets = new ArrayList(); } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NormalizationOperation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NormalizationOperation.java index 352d4bca600..4ca307f3622 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NormalizationOperation.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NormalizationOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -65,6 +65,84 @@ public interface Operation { @SerializedName("destination_field") private String destinationField; + /** + * Builder. + */ + public static class Builder { + private String operation; + private String sourceField; + private String destinationField; + + private Builder(NormalizationOperation normalizationOperation) { + this.operation = normalizationOperation.operation; + this.sourceField = normalizationOperation.sourceField; + this.destinationField = normalizationOperation.destinationField; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a NormalizationOperation. + * + * @return the normalizationOperation + */ + public NormalizationOperation build() { + return new NormalizationOperation(this); + } + + /** + * Set the operation. + * + * @param operation the operation + * @return the NormalizationOperation builder + */ + public Builder operation(String operation) { + this.operation = operation; + return this; + } + + /** + * Set the sourceField. + * + * @param sourceField the sourceField + * @return the NormalizationOperation builder + */ + public Builder sourceField(String sourceField) { + this.sourceField = sourceField; + return this; + } + + /** + * Set the destinationField. + * + * @param destinationField the destinationField + * @return the NormalizationOperation builder + */ + public Builder destinationField(String destinationField) { + this.destinationField = destinationField; + return this; + } + } + + private NormalizationOperation(Builder builder) { + operation = builder.operation; + sourceField = builder.sourceField; + destinationField = builder.destinationField; + } + + /** + * New builder. + * + * @return a NormalizationOperation builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the operation. * @@ -95,7 +173,7 @@ public interface Operation { * * @return the operation */ - public String getOperation() { + public String operation() { return operation; } @@ -106,7 +184,7 @@ public String getOperation() { * * @return the sourceField */ - public String getSourceField() { + public String sourceField() { return sourceField; } @@ -117,34 +195,7 @@ public String getSourceField() { * * @return the destinationField */ - public String getDestinationField() { + public String destinationField() { return destinationField; } - - /** - * Sets the operation. - * - * @param operation the new operation - */ - public void setOperation(final String operation) { - this.operation = operation; - } - - /** - * Sets the sourceField. - * - * @param sourceField the new sourceField - */ - public void setSourceField(final String sourceField) { - this.sourceField = sourceField; - } - - /** - * Sets the destinationField. - * - * @param destinationField the new destinationField - */ - public void setDestinationField(final String destinationField) { - this.destinationField = destinationField; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Notice.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Notice.java index 64f4c76097f..e6cb50ca309 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Notice.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Notice.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetection.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetection.java index 4c5a85d6e94..1dad456a57c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetection.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,20 +25,78 @@ public class PdfHeadingDetection extends GenericModel { private List fonts; /** - * Gets the fonts. + * Builder. + */ + public static class Builder { + private List fonts; + + private Builder(PdfHeadingDetection pdfHeadingDetection) { + this.fonts = pdfHeadingDetection.fonts; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a PdfHeadingDetection. + * + * @return the pdfHeadingDetection + */ + public PdfHeadingDetection build() { + return new PdfHeadingDetection(this); + } + + /** + * Adds an fontSetting to fonts. + * + * @param fontSetting the new fontSetting + * @return the PdfHeadingDetection builder + */ + public Builder addFontSetting(FontSetting fontSetting) { + com.ibm.cloud.sdk.core.util.Validator.notNull(fontSetting, + "fontSetting cannot be null"); + if (this.fonts == null) { + this.fonts = new ArrayList(); + } + this.fonts.add(fontSetting); + return this; + } + + /** + * Set the fonts. + * Existing fonts will be replaced. + * + * @param fonts the fonts + * @return the PdfHeadingDetection builder + */ + public Builder fonts(List fonts) { + this.fonts = fonts; + return this; + } + } + + private PdfHeadingDetection(Builder builder) { + fonts = builder.fonts; + } + + /** + * New builder. * - * @return the fonts + * @return a PdfHeadingDetection builder */ - public List getFonts() { - return fonts; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the fonts. + * Gets the fonts. * - * @param fonts the new fonts + * @return the fonts */ - public void setFonts(final List fonts) { - this.fonts = fonts; + public List fonts() { + return fonts; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfSettings.java index da0532c28a9..ba1f5c65928 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfSettings.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,20 +22,61 @@ public class PdfSettings extends GenericModel { private PdfHeadingDetection heading; /** - * Gets the heading. + * Builder. + */ + public static class Builder { + private PdfHeadingDetection heading; + + private Builder(PdfSettings pdfSettings) { + this.heading = pdfSettings.heading; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a PdfSettings. + * + * @return the pdfSettings + */ + public PdfSettings build() { + return new PdfSettings(this); + } + + /** + * Set the heading. + * + * @param heading the heading + * @return the PdfSettings builder + */ + public Builder heading(PdfHeadingDetection heading) { + this.heading = heading; + return this; + } + } + + private PdfSettings(Builder builder) { + heading = builder.heading; + } + + /** + * New builder. * - * @return the heading + * @return a PdfSettings builder */ - public PdfHeadingDetection getHeading() { - return heading; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the heading. + * Gets the heading. * - * @param heading the new heading + * @return the heading */ - public void setHeading(final PdfHeadingDetection heading) { - this.heading = heading; + public PdfHeadingDetection heading() { + return heading; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java index eb47bb1b185..07972a605b4 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -14,15 +14,12 @@ import java.util.List; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.watson.discovery.v1.query.AggregationDeserializer; /** * An aggregation produced by Discovery to analyze the input provided. */ -@JsonAdapter(AggregationDeserializer.class) public class QueryAggregation extends GenericModel { private String type; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesContext.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesContext.java index 933588b36c0..9f9332739cc 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesContext.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,6 +22,56 @@ public class QueryEntitiesContext extends GenericModel { private String text; + /** + * Builder. + */ + public static class Builder { + private String text; + + private Builder(QueryEntitiesContext queryEntitiesContext) { + this.text = queryEntitiesContext.text; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a QueryEntitiesContext. + * + * @return the queryEntitiesContext + */ + public QueryEntitiesContext build() { + return new QueryEntitiesContext(this); + } + + /** + * Set the text. + * + * @param text the text + * @return the QueryEntitiesContext builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + } + + private QueryEntitiesContext(Builder builder) { + text = builder.text; + } + + /** + * New builder. + * + * @return a QueryEntitiesContext builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the text. * @@ -30,16 +80,7 @@ public class QueryEntitiesContext extends GenericModel { * * @return the text */ - public String getText() { + public String text() { return text; } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(final String text) { - this.text = text; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesEntity.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesEntity.java index 94d4edd5934..948c3fa5212 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesEntity.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,6 +22,70 @@ public class QueryEntitiesEntity extends GenericModel { private String text; private String type; + /** + * Builder. + */ + public static class Builder { + private String text; + private String type; + + private Builder(QueryEntitiesEntity queryEntitiesEntity) { + this.text = queryEntitiesEntity.text; + this.type = queryEntitiesEntity.type; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a QueryEntitiesEntity. + * + * @return the queryEntitiesEntity + */ + public QueryEntitiesEntity build() { + return new QueryEntitiesEntity(this); + } + + /** + * Set the text. + * + * @param text the text + * @return the QueryEntitiesEntity builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the QueryEntitiesEntity builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + } + + private QueryEntitiesEntity(Builder builder) { + text = builder.text; + type = builder.type; + } + + /** + * New builder. + * + * @return a QueryEntitiesEntity builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the text. * @@ -29,7 +93,7 @@ public class QueryEntitiesEntity extends GenericModel { * * @return the text */ - public String getText() { + public String text() { return text; } @@ -40,25 +104,7 @@ public String getText() { * * @return the type */ - public String getType() { + public String type() { return type; } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(final String text) { - this.text = text; - } - - /** - * Sets the type. - * - * @param type the new type - */ - public void setType(final String type) { - this.type = type; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesOptions.java index 88c67c22d1a..c99c282e821 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The queryEntities options. @@ -155,8 +154,10 @@ public Builder evidenceCount(long evidenceCount) { } private QueryEntitiesOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; feature = builder.feature; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponse.java index 4385197c7bc..75f7e38e1be 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponseItem.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponseItem.java index ea95e74ca75..336e5ac4c53 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponseItem.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEntitiesResponseItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidence.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidence.java index b71675b1f30..0cb96a11547 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidence.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidence.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidenceEntity.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidenceEntity.java index 29a3fdd86d0..db74085f022 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidenceEntity.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryEvidenceEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryFilterType.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryFilterType.java index b62ceed600b..9b91c4fc504 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryFilterType.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryFilterType.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,6 +25,104 @@ public class QueryFilterType extends GenericModel { private List exclude; private List include; + /** + * Builder. + */ + public static class Builder { + private List exclude; + private List include; + + private Builder(QueryFilterType queryFilterType) { + this.exclude = queryFilterType.exclude; + this.include = queryFilterType.include; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a QueryFilterType. + * + * @return the queryFilterType + */ + public QueryFilterType build() { + return new QueryFilterType(this); + } + + /** + * Adds an exclude to exclude. + * + * @param exclude the new exclude + * @return the QueryFilterType builder + */ + public Builder addExclude(String exclude) { + com.ibm.cloud.sdk.core.util.Validator.notNull(exclude, + "exclude cannot be null"); + if (this.exclude == null) { + this.exclude = new ArrayList(); + } + this.exclude.add(exclude); + return this; + } + + /** + * Adds an include to include. + * + * @param include the new include + * @return the QueryFilterType builder + */ + public Builder addInclude(String include) { + com.ibm.cloud.sdk.core.util.Validator.notNull(include, + "include cannot be null"); + if (this.include == null) { + this.include = new ArrayList(); + } + this.include.add(include); + return this; + } + + /** + * Set the exclude. + * Existing exclude will be replaced. + * + * @param exclude the exclude + * @return the QueryFilterType builder + */ + public Builder exclude(List exclude) { + this.exclude = exclude; + return this; + } + + /** + * Set the include. + * Existing include will be replaced. + * + * @param include the include + * @return the QueryFilterType builder + */ + public Builder include(List include) { + this.include = include; + return this; + } + } + + private QueryFilterType(Builder builder) { + exclude = builder.exclude; + include = builder.include; + } + + /** + * New builder. + * + * @return a QueryFilterType builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the exclude. * @@ -31,7 +130,7 @@ public class QueryFilterType extends GenericModel { * * @return the exclude */ - public List getExclude() { + public List exclude() { return exclude; } @@ -42,25 +141,7 @@ public List getExclude() { * * @return the include */ - public List getInclude() { + public List include() { return include; } - - /** - * Sets the exclude. - * - * @param exclude the new exclude - */ - public void setExclude(final List exclude) { - this.exclude = exclude; - } - - /** - * Sets the include. - * - * @param include the new include - */ - public void setInclude(final List include) { - this.include = include; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryLogOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryLogOptions.java index d9c82ebe616..b2e2435597d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryLogOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryLogOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The queryLog options. @@ -69,7 +68,8 @@ public QueryLogOptions build() { * @return the QueryLogOptions builder */ public Builder addSort(String sort) { - Validator.notNull(sort, "sort cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(sort, + "sort cannot be null"); if (this.sort == null) { this.sort = new ArrayList(); } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java index 6cc5dfdd758..3a1f2031338 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The queryNotices options. @@ -31,7 +30,7 @@ public class QueryNoticesOptions extends GenericModel { private Boolean passages; private String aggregation; private Long count; - private List returnFields; + private List xreturn; private Long offset; private List sort; private Boolean highlight; @@ -55,7 +54,7 @@ public static class Builder { private Boolean passages; private String aggregation; private Long count; - private List returnFields; + private List xreturn; private Long offset; private List sort; private Boolean highlight; @@ -76,7 +75,7 @@ private Builder(QueryNoticesOptions queryNoticesOptions) { this.passages = queryNoticesOptions.passages; this.aggregation = queryNoticesOptions.aggregation; this.count = queryNoticesOptions.count; - this.returnFields = queryNoticesOptions.returnFields; + this.xreturn = queryNoticesOptions.xreturn; this.offset = queryNoticesOptions.offset; this.sort = queryNoticesOptions.sort; this.highlight = queryNoticesOptions.highlight; @@ -116,17 +115,18 @@ public QueryNoticesOptions build() { } /** - * Adds an returnField to returnFields. + * Adds an returnField to xreturn. * * @param returnField the new returnField * @return the QueryNoticesOptions builder */ public Builder addReturnField(String returnField) { - Validator.notNull(returnField, "returnField cannot be null"); - if (this.returnFields == null) { - this.returnFields = new ArrayList(); + com.ibm.cloud.sdk.core.util.Validator.notNull(returnField, + "returnField cannot be null"); + if (this.xreturn == null) { + this.xreturn = new ArrayList(); } - this.returnFields.add(returnField); + this.xreturn.add(returnField); return this; } @@ -137,7 +137,8 @@ public Builder addReturnField(String returnField) { * @return the QueryNoticesOptions builder */ public Builder addSort(String sort) { - Validator.notNull(sort, "sort cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(sort, + "sort cannot be null"); if (this.sort == null) { this.sort = new ArrayList(); } @@ -152,7 +153,8 @@ public Builder addSort(String sort) { * @return the QueryNoticesOptions builder */ public Builder addPassagesFields(String passagesFields) { - Validator.notNull(passagesFields, "passagesFields cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(passagesFields, + "passagesFields cannot be null"); if (this.passagesFields == null) { this.passagesFields = new ArrayList(); } @@ -167,7 +169,8 @@ public Builder addPassagesFields(String passagesFields) { * @return the QueryNoticesOptions builder */ public Builder addSimilarDocumentIds(String similarDocumentIds) { - Validator.notNull(similarDocumentIds, "similarDocumentIds cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(similarDocumentIds, + "similarDocumentIds cannot be null"); if (this.similarDocumentIds == null) { this.similarDocumentIds = new ArrayList(); } @@ -182,7 +185,8 @@ public Builder addSimilarDocumentIds(String similarDocumentIds) { * @return the QueryNoticesOptions builder */ public Builder addSimilarFields(String similarFields) { - Validator.notNull(similarFields, "similarFields cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(similarFields, + "similarFields cannot be null"); if (this.similarFields == null) { this.similarFields = new ArrayList(); } @@ -279,14 +283,14 @@ public Builder count(long count) { } /** - * Set the returnFields. - * Existing returnFields will be replaced. + * Set the xreturn. + * Existing xreturn will be replaced. * - * @param returnFields the returnFields + * @param xreturn the xreturn * @return the QueryNoticesOptions builder */ - public Builder returnFields(List returnFields) { - this.returnFields = returnFields; + public Builder xreturn(List xreturn) { + this.xreturn = xreturn; return this; } @@ -406,8 +410,10 @@ public Builder similarFields(List similarFields) { } private QueryNoticesOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; filter = builder.filter; @@ -416,7 +422,7 @@ private QueryNoticesOptions(Builder builder) { passages = builder.passages; aggregation = builder.aggregation; count = builder.count; - returnFields = builder.returnFields; + xreturn = builder.xreturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -532,14 +538,14 @@ public Long count() { } /** - * Gets the returnFields. + * Gets the xreturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the returnFields + * @return the xreturn */ - public List returnFields() { - return returnFields; + public List xreturn() { + return xreturn; } /** diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponse.java index e971d7f9133..21aadfd0b7a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResult.java index 8d49b972d6e..9f17413bb76 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -40,7 +40,7 @@ public interface FileType { @SerializedName("id") private String id; @SerializedName("metadata") - private Map metadata; + private Map metadata; @SerializedName("collection_id") private String collectionId; @SerializedName("result_metadata") @@ -81,7 +81,7 @@ public String getId() { * * @return the metadata */ - public Map getMetadata() { + public Map getMetadata() { return this.metadata; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java index 62012ad48f7..795b68a9517 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The query options. @@ -28,7 +27,7 @@ public class QueryOptions extends GenericModel { private Boolean passages; private String aggregation; private Long count; - private String returnFields; + private String xreturn; private Long offset; private String sort; private Boolean highlight; @@ -42,7 +41,7 @@ public class QueryOptions extends GenericModel { private String similarDocumentIds; private String similarFields; private String bias; - private Boolean loggingOptOut; + private Boolean xWatsonLoggingOptOut; /** * Builder. @@ -56,7 +55,7 @@ public static class Builder { private Boolean passages; private String aggregation; private Long count; - private String returnFields; + private String xreturn; private Long offset; private String sort; private Boolean highlight; @@ -70,7 +69,7 @@ public static class Builder { private String similarDocumentIds; private String similarFields; private String bias; - private Boolean loggingOptOut; + private Boolean xWatsonLoggingOptOut; private Builder(QueryOptions queryOptions) { this.environmentId = queryOptions.environmentId; @@ -81,7 +80,7 @@ private Builder(QueryOptions queryOptions) { this.passages = queryOptions.passages; this.aggregation = queryOptions.aggregation; this.count = queryOptions.count; - this.returnFields = queryOptions.returnFields; + this.xreturn = queryOptions.xreturn; this.offset = queryOptions.offset; this.sort = queryOptions.sort; this.highlight = queryOptions.highlight; @@ -95,7 +94,7 @@ private Builder(QueryOptions queryOptions) { this.similarDocumentIds = queryOptions.similarDocumentIds; this.similarFields = queryOptions.similarFields; this.bias = queryOptions.bias; - this.loggingOptOut = queryOptions.loggingOptOut; + this.xWatsonLoggingOptOut = queryOptions.xWatsonLoggingOptOut; } /** @@ -213,13 +212,13 @@ public Builder count(long count) { } /** - * Set the returnFields. + * Set the xreturn. * - * @param returnFields the returnFields + * @param xreturn the xreturn * @return the QueryOptions builder */ - public Builder returnFields(String returnFields) { - this.returnFields = returnFields; + public Builder xreturn(String xreturn) { + this.xreturn = xreturn; return this; } @@ -367,20 +366,22 @@ public Builder bias(String bias) { } /** - * Set the loggingOptOut. + * Set the xWatsonLoggingOptOut. * - * @param loggingOptOut the loggingOptOut + * @param xWatsonLoggingOptOut the xWatsonLoggingOptOut * @return the QueryOptions builder */ - public Builder loggingOptOut(Boolean loggingOptOut) { - this.loggingOptOut = loggingOptOut; + public Builder xWatsonLoggingOptOut(Boolean xWatsonLoggingOptOut) { + this.xWatsonLoggingOptOut = xWatsonLoggingOptOut; return this; } } private QueryOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; filter = builder.filter; @@ -389,7 +390,7 @@ private QueryOptions(Builder builder) { passages = builder.passages; aggregation = builder.aggregation; count = builder.count; - returnFields = builder.returnFields; + xreturn = builder.xreturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -403,7 +404,7 @@ private QueryOptions(Builder builder) { similarDocumentIds = builder.similarDocumentIds; similarFields = builder.similarFields; bias = builder.bias; - loggingOptOut = builder.loggingOptOut; + xWatsonLoggingOptOut = builder.xWatsonLoggingOptOut; } /** @@ -508,14 +509,14 @@ public Long count() { } /** - * Gets the returnFields. + * Gets the xreturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the returnFields + * @return the xreturn */ - public String returnFields() { - return returnFields; + public String xreturn() { + return xreturn; } /** @@ -682,13 +683,13 @@ public String bias() { } /** - * Gets the loggingOptOut. + * Gets the xWatsonLoggingOptOut. * * If `true`, queries are not stored in the Discovery **Logs** endpoint. * - * @return the loggingOptOut + * @return the xWatsonLoggingOptOut */ - public Boolean loggingOptOut() { - return loggingOptOut; + public Boolean xWatsonLoggingOptOut() { + return xWatsonLoggingOptOut; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryPassages.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryPassages.java index 7964b21d197..94a780467f1 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryPassages.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryPassages.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsArgument.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsArgument.java index 25acdc7771d..615132b719d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsArgument.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsArgument.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsEntity.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsEntity.java index 77efbb00598..eebf0d9d8a7 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsEntity.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -23,6 +23,84 @@ public class QueryRelationsEntity extends GenericModel { private String type; private Boolean exact; + /** + * Builder. + */ + public static class Builder { + private String text; + private String type; + private Boolean exact; + + private Builder(QueryRelationsEntity queryRelationsEntity) { + this.text = queryRelationsEntity.text; + this.type = queryRelationsEntity.type; + this.exact = queryRelationsEntity.exact; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a QueryRelationsEntity. + * + * @return the queryRelationsEntity + */ + public QueryRelationsEntity build() { + return new QueryRelationsEntity(this); + } + + /** + * Set the text. + * + * @param text the text + * @return the QueryRelationsEntity builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the QueryRelationsEntity builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the exact. + * + * @param exact the exact + * @return the QueryRelationsEntity builder + */ + public Builder exact(Boolean exact) { + this.exact = exact; + return this; + } + } + + private QueryRelationsEntity(Builder builder) { + text = builder.text; + type = builder.type; + exact = builder.exact; + } + + /** + * New builder. + * + * @return a QueryRelationsEntity builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the text. * @@ -30,7 +108,7 @@ public class QueryRelationsEntity extends GenericModel { * * @return the text */ - public String getText() { + public String text() { return text; } @@ -41,7 +119,7 @@ public String getText() { * * @return the type */ - public String getType() { + public String type() { return type; } @@ -52,34 +130,7 @@ public String getType() { * * @return the exact */ - public Boolean isExact() { + public Boolean exact() { return exact; } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(final String text) { - this.text = text; - } - - /** - * Sets the type. - * - * @param type the new type - */ - public void setType(final String type) { - this.type = type; - } - - /** - * Sets the exact. - * - * @param exact the new exact - */ - public void setExact(final Boolean exact) { - this.exact = exact; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsFilter.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsFilter.java index 71866116085..e254319b3b6 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsFilter.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -30,58 +31,126 @@ public class QueryRelationsFilter extends GenericModel { private List documentIds; /** - * Gets the relationTypes. - * - * @return the relationTypes + * Builder. */ - public QueryFilterType getRelationTypes() { - return relationTypes; + public static class Builder { + private QueryFilterType relationTypes; + private QueryFilterType entityTypes; + private List documentIds; + + private Builder(QueryRelationsFilter queryRelationsFilter) { + this.relationTypes = queryRelationsFilter.relationTypes; + this.entityTypes = queryRelationsFilter.entityTypes; + this.documentIds = queryRelationsFilter.documentIds; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a QueryRelationsFilter. + * + * @return the queryRelationsFilter + */ + public QueryRelationsFilter build() { + return new QueryRelationsFilter(this); + } + + /** + * Adds an documentIds to documentIds. + * + * @param documentIds the new documentIds + * @return the QueryRelationsFilter builder + */ + public Builder addDocumentIds(String documentIds) { + com.ibm.cloud.sdk.core.util.Validator.notNull(documentIds, + "documentIds cannot be null"); + if (this.documentIds == null) { + this.documentIds = new ArrayList(); + } + this.documentIds.add(documentIds); + return this; + } + + /** + * Set the relationTypes. + * + * @param relationTypes the relationTypes + * @return the QueryRelationsFilter builder + */ + public Builder relationTypes(QueryFilterType relationTypes) { + this.relationTypes = relationTypes; + return this; + } + + /** + * Set the entityTypes. + * + * @param entityTypes the entityTypes + * @return the QueryRelationsFilter builder + */ + public Builder entityTypes(QueryFilterType entityTypes) { + this.entityTypes = entityTypes; + return this; + } + + /** + * Set the documentIds. + * Existing documentIds will be replaced. + * + * @param documentIds the documentIds + * @return the QueryRelationsFilter builder + */ + public Builder documentIds(List documentIds) { + this.documentIds = documentIds; + return this; + } } - /** - * Gets the entityTypes. - * - * @return the entityTypes - */ - public QueryFilterType getEntityTypes() { - return entityTypes; + private QueryRelationsFilter(Builder builder) { + relationTypes = builder.relationTypes; + entityTypes = builder.entityTypes; + documentIds = builder.documentIds; } /** - * Gets the documentIds. - * - * A comma-separated list of document IDs to include in the query. + * New builder. * - * @return the documentIds + * @return a QueryRelationsFilter builder */ - public List getDocumentIds() { - return documentIds; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the relationTypes. + * Gets the relationTypes. * - * @param relationTypes the new relationTypes + * @return the relationTypes */ - public void setRelationTypes(final QueryFilterType relationTypes) { - this.relationTypes = relationTypes; + public QueryFilterType relationTypes() { + return relationTypes; } /** - * Sets the entityTypes. + * Gets the entityTypes. * - * @param entityTypes the new entityTypes + * @return the entityTypes */ - public void setEntityTypes(final QueryFilterType entityTypes) { - this.entityTypes = entityTypes; + public QueryFilterType entityTypes() { + return entityTypes; } /** - * Sets the documentIds. + * Gets the documentIds. * - * @param documentIds the new documentIds + * A comma-separated list of document IDs to include in the query. + * + * @return the documentIds */ - public void setDocumentIds(final List documentIds) { - this.documentIds = documentIds; + public List documentIds() { + return documentIds; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsOptions.java index 15cc874487c..b896d61672d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The queryRelations options. @@ -101,7 +100,8 @@ public QueryRelationsOptions build() { * @return the QueryRelationsOptions builder */ public Builder addEntities(QueryRelationsEntity entities) { - Validator.notNull(entities, "entities cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(entities, + "entities cannot be null"); if (this.entities == null) { this.entities = new ArrayList(); } @@ -200,8 +200,10 @@ public Builder evidenceCount(long evidenceCount) { } private QueryRelationsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; entities = builder.entities; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsRelationship.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsRelationship.java index 482d55ae7e6..e5e62880f51 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsRelationship.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsRelationship.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsResponse.java index 46aac7315c4..cfe7cd64420 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryRelationsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResponse.java index 5c2a6fe1bda..14913af33f6 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java index e0b1ecf293b..e5f935f56a3 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,12 +12,13 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.List; +import java.util.Map; + import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; -import java.util.Map; - /** * QueryResult. */ @@ -25,7 +26,7 @@ public class QueryResult extends DynamicModel { @SerializedName("id") private String id; @SerializedName("metadata") - private Map metadata; + private Map metadata; @SerializedName("collection_id") private String collectionId; @SerializedName("result_metadata") @@ -56,7 +57,7 @@ public String getId() { * * @return the metadata */ - public Map getMetadata() { + public Map getMetadata() { return this.metadata; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResultMetadata.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResultMetadata.java index 375acae4d1e..54bbbf3309a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResultMetadata.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResultMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/RetrievalDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/RetrievalDetails.java index 9eabb511081..6b1de21529c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/RetrievalDetails.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/RetrievalDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatus.java index 5359258efd2..a4b1942f8e1 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatus.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFields.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFields.java index 715f8eca5c7..da3311b090f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFields.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFields.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SearchStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SearchStatus.java index 0f761fb5e37..ffb9be3b279 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SearchStatus.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SearchStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SegmentSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SegmentSettings.java index 2dcad5d97c8..fa008d93f09 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SegmentSettings.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SegmentSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -28,6 +29,118 @@ public class SegmentSettings extends GenericModel { @SerializedName("annotated_fields") private List annotatedFields; + /** + * Builder. + */ + public static class Builder { + private Boolean enabled; + private List selectorTags; + private List annotatedFields; + + private Builder(SegmentSettings segmentSettings) { + this.enabled = segmentSettings.enabled; + this.selectorTags = segmentSettings.selectorTags; + this.annotatedFields = segmentSettings.annotatedFields; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a SegmentSettings. + * + * @return the segmentSettings + */ + public SegmentSettings build() { + return new SegmentSettings(this); + } + + /** + * Adds an selectorTags to selectorTags. + * + * @param selectorTags the new selectorTags + * @return the SegmentSettings builder + */ + public Builder addSelectorTags(String selectorTags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(selectorTags, + "selectorTags cannot be null"); + if (this.selectorTags == null) { + this.selectorTags = new ArrayList(); + } + this.selectorTags.add(selectorTags); + return this; + } + + /** + * Adds an annotatedFields to annotatedFields. + * + * @param annotatedFields the new annotatedFields + * @return the SegmentSettings builder + */ + public Builder addAnnotatedFields(String annotatedFields) { + com.ibm.cloud.sdk.core.util.Validator.notNull(annotatedFields, + "annotatedFields cannot be null"); + if (this.annotatedFields == null) { + this.annotatedFields = new ArrayList(); + } + this.annotatedFields.add(annotatedFields); + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the SegmentSettings builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the selectorTags. + * Existing selectorTags will be replaced. + * + * @param selectorTags the selectorTags + * @return the SegmentSettings builder + */ + public Builder selectorTags(List selectorTags) { + this.selectorTags = selectorTags; + return this; + } + + /** + * Set the annotatedFields. + * Existing annotatedFields will be replaced. + * + * @param annotatedFields the annotatedFields + * @return the SegmentSettings builder + */ + public Builder annotatedFields(List annotatedFields) { + this.annotatedFields = annotatedFields; + return this; + } + } + + private SegmentSettings(Builder builder) { + enabled = builder.enabled; + selectorTags = builder.selectorTags; + annotatedFields = builder.annotatedFields; + } + + /** + * New builder. + * + * @return a SegmentSettings builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the enabled. * @@ -35,7 +148,7 @@ public class SegmentSettings extends GenericModel { * * @return the enabled */ - public Boolean isEnabled() { + public Boolean enabled() { return enabled; } @@ -48,7 +161,7 @@ public Boolean isEnabled() { * * @return the selectorTags */ - public List getSelectorTags() { + public List selectorTags() { return selectorTags; } @@ -65,34 +178,7 @@ public List getSelectorTags() { * * @return the annotatedFields */ - public List getAnnotatedFields() { + public List annotatedFields() { return annotatedFields; } - - /** - * Sets the enabled. - * - * @param enabled the new enabled - */ - public void setEnabled(final Boolean enabled) { - this.enabled = enabled; - } - - /** - * Sets the selectorTags. - * - * @param selectorTags the new selectorTags - */ - public void setSelectorTags(final List selectorTags) { - this.selectorTags = selectorTags; - } - - /** - * Sets the annotatedFields. - * - * @param annotatedFields the new annotatedFields - */ - public void setAnnotatedFields(final List annotatedFields) { - this.annotatedFields = annotatedFields; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Source.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Source.java index 2a28de3a759..216c0c07bf8 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Source.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Source.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -47,6 +47,98 @@ public interface Type { private SourceSchedule schedule; private SourceOptions options; + /** + * Builder. + */ + public static class Builder { + private String type; + private String credentialId; + private SourceSchedule schedule; + private SourceOptions options; + + private Builder(Source source) { + this.type = source.type; + this.credentialId = source.credentialId; + this.schedule = source.schedule; + this.options = source.options; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a Source. + * + * @return the source + */ + public Source build() { + return new Source(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the Source builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the credentialId. + * + * @param credentialId the credentialId + * @return the Source builder + */ + public Builder credentialId(String credentialId) { + this.credentialId = credentialId; + return this; + } + + /** + * Set the schedule. + * + * @param schedule the schedule + * @return the Source builder + */ + public Builder schedule(SourceSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Set the options. + * + * @param options the options + * @return the Source builder + */ + public Builder options(SourceOptions options) { + this.options = options; + return this; + } + } + + private Source(Builder builder) { + type = builder.type; + credentialId = builder.credentialId; + schedule = builder.schedule; + options = builder.options; + } + + /** + * New builder. + * + * @return a Source builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the type. * @@ -59,7 +151,7 @@ public interface Type { * * @return the type */ - public String getType() { + public String type() { return type; } @@ -72,7 +164,7 @@ public String getType() { * * @return the credentialId */ - public String getCredentialId() { + public String credentialId() { return credentialId; } @@ -83,7 +175,7 @@ public String getCredentialId() { * * @return the schedule */ - public SourceSchedule getSchedule() { + public SourceSchedule schedule() { return schedule; } @@ -94,43 +186,7 @@ public SourceSchedule getSchedule() { * * @return the options */ - public SourceOptions getOptions() { + public SourceOptions options() { return options; } - - /** - * Sets the type. - * - * @param type the new type - */ - public void setType(final String type) { - this.type = type; - } - - /** - * Sets the credentialId. - * - * @param credentialId the new credentialId - */ - public void setCredentialId(final String credentialId) { - this.credentialId = credentialId; - } - - /** - * Sets the schedule. - * - * @param schedule the new schedule - */ - public void setSchedule(final SourceSchedule schedule) { - this.schedule = schedule; - } - - /** - * Sets the options. - * - * @param options the new options - */ - public void setOptions(final SourceOptions options) { - this.options = options; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java index e88cd99961c..742515254df 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -31,6 +32,211 @@ public class SourceOptions extends GenericModel { @SerializedName("crawl_all_buckets") private Boolean crawlAllBuckets; + /** + * Builder. + */ + public static class Builder { + private List folders; + private List objects; + private List siteCollections; + private List urls; + private List buckets; + private Boolean crawlAllBuckets; + + private Builder(SourceOptions sourceOptions) { + this.folders = sourceOptions.folders; + this.objects = sourceOptions.objects; + this.siteCollections = sourceOptions.siteCollections; + this.urls = sourceOptions.urls; + this.buckets = sourceOptions.buckets; + this.crawlAllBuckets = sourceOptions.crawlAllBuckets; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a SourceOptions. + * + * @return the sourceOptions + */ + public SourceOptions build() { + return new SourceOptions(this); + } + + /** + * Adds an folders to folders. + * + * @param folders the new folders + * @return the SourceOptions builder + */ + public Builder addFolders(SourceOptionsFolder folders) { + com.ibm.cloud.sdk.core.util.Validator.notNull(folders, + "folders cannot be null"); + if (this.folders == null) { + this.folders = new ArrayList(); + } + this.folders.add(folders); + return this; + } + + /** + * Adds an objects to objects. + * + * @param objects the new objects + * @return the SourceOptions builder + */ + public Builder addObjects(SourceOptionsObject objects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(objects, + "objects cannot be null"); + if (this.objects == null) { + this.objects = new ArrayList(); + } + this.objects.add(objects); + return this; + } + + /** + * Adds an siteCollections to siteCollections. + * + * @param siteCollections the new siteCollections + * @return the SourceOptions builder + */ + public Builder addSiteCollections(SourceOptionsSiteColl siteCollections) { + com.ibm.cloud.sdk.core.util.Validator.notNull(siteCollections, + "siteCollections cannot be null"); + if (this.siteCollections == null) { + this.siteCollections = new ArrayList(); + } + this.siteCollections.add(siteCollections); + return this; + } + + /** + * Adds an urls to urls. + * + * @param urls the new urls + * @return the SourceOptions builder + */ + public Builder addUrls(SourceOptionsWebCrawl urls) { + com.ibm.cloud.sdk.core.util.Validator.notNull(urls, + "urls cannot be null"); + if (this.urls == null) { + this.urls = new ArrayList(); + } + this.urls.add(urls); + return this; + } + + /** + * Adds an buckets to buckets. + * + * @param buckets the new buckets + * @return the SourceOptions builder + */ + public Builder addBuckets(SourceOptionsBuckets buckets) { + com.ibm.cloud.sdk.core.util.Validator.notNull(buckets, + "buckets cannot be null"); + if (this.buckets == null) { + this.buckets = new ArrayList(); + } + this.buckets.add(buckets); + return this; + } + + /** + * Set the folders. + * Existing folders will be replaced. + * + * @param folders the folders + * @return the SourceOptions builder + */ + public Builder folders(List folders) { + this.folders = folders; + return this; + } + + /** + * Set the objects. + * Existing objects will be replaced. + * + * @param objects the objects + * @return the SourceOptions builder + */ + public Builder objects(List objects) { + this.objects = objects; + return this; + } + + /** + * Set the siteCollections. + * Existing siteCollections will be replaced. + * + * @param siteCollections the siteCollections + * @return the SourceOptions builder + */ + public Builder siteCollections(List siteCollections) { + this.siteCollections = siteCollections; + return this; + } + + /** + * Set the urls. + * Existing urls will be replaced. + * + * @param urls the urls + * @return the SourceOptions builder + */ + public Builder urls(List urls) { + this.urls = urls; + return this; + } + + /** + * Set the buckets. + * Existing buckets will be replaced. + * + * @param buckets the buckets + * @return the SourceOptions builder + */ + public Builder buckets(List buckets) { + this.buckets = buckets; + return this; + } + + /** + * Set the crawlAllBuckets. + * + * @param crawlAllBuckets the crawlAllBuckets + * @return the SourceOptions builder + */ + public Builder crawlAllBuckets(Boolean crawlAllBuckets) { + this.crawlAllBuckets = crawlAllBuckets; + return this; + } + } + + private SourceOptions(Builder builder) { + folders = builder.folders; + objects = builder.objects; + siteCollections = builder.siteCollections; + urls = builder.urls; + buckets = builder.buckets; + crawlAllBuckets = builder.crawlAllBuckets; + } + + /** + * New builder. + * + * @return a SourceOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the folders. * @@ -39,7 +245,7 @@ public class SourceOptions extends GenericModel { * * @return the folders */ - public List getFolders() { + public List folders() { return folders; } @@ -51,7 +257,7 @@ public List getFolders() { * * @return the objects */ - public List getObjects() { + public List objects() { return objects; } @@ -63,7 +269,7 @@ public List getObjects() { * * @return the siteCollections */ - public List getSiteCollections() { + public List siteCollections() { return siteCollections; } @@ -75,7 +281,7 @@ public List getSiteCollections() { * * @return the urls */ - public List getUrls() { + public List urls() { return urls; } @@ -87,7 +293,7 @@ public List getUrls() { * * @return the buckets */ - public List getBuckets() { + public List buckets() { return buckets; } @@ -99,61 +305,7 @@ public List getBuckets() { * * @return the crawlAllBuckets */ - public Boolean isCrawlAllBuckets() { + public Boolean crawlAllBuckets() { return crawlAllBuckets; } - - /** - * Sets the folders. - * - * @param folders the new folders - */ - public void setFolders(final List folders) { - this.folders = folders; - } - - /** - * Sets the objects. - * - * @param objects the new objects - */ - public void setObjects(final List objects) { - this.objects = objects; - } - - /** - * Sets the siteCollections. - * - * @param siteCollections the new siteCollections - */ - public void setSiteCollections(final List siteCollections) { - this.siteCollections = siteCollections; - } - - /** - * Sets the urls. - * - * @param urls the new urls - */ - public void setUrls(final List urls) { - this.urls = urls; - } - - /** - * Sets the buckets. - * - * @param buckets the new buckets - */ - public void setBuckets(final List buckets) { - this.buckets = buckets; - } - - /** - * Sets the crawlAllBuckets. - * - * @param crawlAllBuckets the new crawlAllBuckets - */ - public void setCrawlAllBuckets(final Boolean crawlAllBuckets) { - this.crawlAllBuckets = crawlAllBuckets; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsBuckets.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsBuckets.java index c0fa0b281a7..1835a1b1fc9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsBuckets.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsBuckets.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,6 +22,81 @@ public class SourceOptionsBuckets extends GenericModel { private String name; private Long limit; + /** + * Builder. + */ + public static class Builder { + private String name; + private Long limit; + + private Builder(SourceOptionsBuckets sourceOptionsBuckets) { + this.name = sourceOptionsBuckets.name; + this.limit = sourceOptionsBuckets.limit; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + */ + public Builder(String name) { + this.name = name; + } + + /** + * Builds a SourceOptionsBuckets. + * + * @return the sourceOptionsBuckets + */ + public SourceOptionsBuckets build() { + return new SourceOptionsBuckets(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SourceOptionsBuckets builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the SourceOptionsBuckets builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + } + + private SourceOptionsBuckets(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + name = builder.name; + limit = builder.limit; + } + + /** + * New builder. + * + * @return a SourceOptionsBuckets builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the name. * @@ -29,7 +104,7 @@ public class SourceOptionsBuckets extends GenericModel { * * @return the name */ - public String getName() { + public String name() { return name; } @@ -41,25 +116,7 @@ public String getName() { * * @return the limit */ - public Long getLimit() { + public Long limit() { return limit; } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(final String name) { - this.name = name; - } - - /** - * Sets the limit. - * - * @param limit the new limit - */ - public void setLimit(final long limit) { - this.limit = limit; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolder.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolder.java index 09ab22dcd82..b8e98ab823b 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolder.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -26,6 +26,99 @@ public class SourceOptionsFolder extends GenericModel { private String folderId; private Long limit; + /** + * Builder. + */ + public static class Builder { + private String ownerUserId; + private String folderId; + private Long limit; + + private Builder(SourceOptionsFolder sourceOptionsFolder) { + this.ownerUserId = sourceOptionsFolder.ownerUserId; + this.folderId = sourceOptionsFolder.folderId; + this.limit = sourceOptionsFolder.limit; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param ownerUserId the ownerUserId + * @param folderId the folderId + */ + public Builder(String ownerUserId, String folderId) { + this.ownerUserId = ownerUserId; + this.folderId = folderId; + } + + /** + * Builds a SourceOptionsFolder. + * + * @return the sourceOptionsFolder + */ + public SourceOptionsFolder build() { + return new SourceOptionsFolder(this); + } + + /** + * Set the ownerUserId. + * + * @param ownerUserId the ownerUserId + * @return the SourceOptionsFolder builder + */ + public Builder ownerUserId(String ownerUserId) { + this.ownerUserId = ownerUserId; + return this; + } + + /** + * Set the folderId. + * + * @param folderId the folderId + * @return the SourceOptionsFolder builder + */ + public Builder folderId(String folderId) { + this.folderId = folderId; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the SourceOptionsFolder builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + } + + private SourceOptionsFolder(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ownerUserId, + "ownerUserId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.folderId, + "folderId cannot be null"); + ownerUserId = builder.ownerUserId; + folderId = builder.folderId; + limit = builder.limit; + } + + /** + * New builder. + * + * @return a SourceOptionsFolder builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the ownerUserId. * @@ -33,7 +126,7 @@ public class SourceOptionsFolder extends GenericModel { * * @return the ownerUserId */ - public String getOwnerUserId() { + public String ownerUserId() { return ownerUserId; } @@ -44,7 +137,7 @@ public String getOwnerUserId() { * * @return the folderId */ - public String getFolderId() { + public String folderId() { return folderId; } @@ -55,34 +148,7 @@ public String getFolderId() { * * @return the limit */ - public Long getLimit() { + public Long limit() { return limit; } - - /** - * Sets the ownerUserId. - * - * @param ownerUserId the new ownerUserId - */ - public void setOwnerUserId(final String ownerUserId) { - this.ownerUserId = ownerUserId; - } - - /** - * Sets the folderId. - * - * @param folderId the new folderId - */ - public void setFolderId(final String folderId) { - this.folderId = folderId; - } - - /** - * Sets the limit. - * - * @param limit the new limit - */ - public void setLimit(final long limit) { - this.limit = limit; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsObject.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsObject.java index cbb8f3cb8eb..0a078a3baf8 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsObject.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsObject.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,6 +22,81 @@ public class SourceOptionsObject extends GenericModel { private String name; private Long limit; + /** + * Builder. + */ + public static class Builder { + private String name; + private Long limit; + + private Builder(SourceOptionsObject sourceOptionsObject) { + this.name = sourceOptionsObject.name; + this.limit = sourceOptionsObject.limit; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + */ + public Builder(String name) { + this.name = name; + } + + /** + * Builds a SourceOptionsObject. + * + * @return the sourceOptionsObject + */ + public SourceOptionsObject build() { + return new SourceOptionsObject(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SourceOptionsObject builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the SourceOptionsObject builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + } + + private SourceOptionsObject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + name = builder.name; + limit = builder.limit; + } + + /** + * New builder. + * + * @return a SourceOptionsObject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the name. * @@ -29,7 +104,7 @@ public class SourceOptionsObject extends GenericModel { * * @return the name */ - public String getName() { + public String name() { return name; } @@ -41,25 +116,7 @@ public String getName() { * * @return the limit */ - public Long getLimit() { + public Long limit() { return limit; } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(final String name) { - this.name = name; - } - - /** - * Sets the limit. - * - * @param limit the new limit - */ - public void setLimit(final long limit) { - this.limit = limit; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteColl.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteColl.java index 3556628a857..acf27a5a2cc 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteColl.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteColl.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -24,6 +24,81 @@ public class SourceOptionsSiteColl extends GenericModel { private String siteCollectionPath; private Long limit; + /** + * Builder. + */ + public static class Builder { + private String siteCollectionPath; + private Long limit; + + private Builder(SourceOptionsSiteColl sourceOptionsSiteColl) { + this.siteCollectionPath = sourceOptionsSiteColl.siteCollectionPath; + this.limit = sourceOptionsSiteColl.limit; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param siteCollectionPath the siteCollectionPath + */ + public Builder(String siteCollectionPath) { + this.siteCollectionPath = siteCollectionPath; + } + + /** + * Builds a SourceOptionsSiteColl. + * + * @return the sourceOptionsSiteColl + */ + public SourceOptionsSiteColl build() { + return new SourceOptionsSiteColl(this); + } + + /** + * Set the siteCollectionPath. + * + * @param siteCollectionPath the siteCollectionPath + * @return the SourceOptionsSiteColl builder + */ + public Builder siteCollectionPath(String siteCollectionPath) { + this.siteCollectionPath = siteCollectionPath; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the SourceOptionsSiteColl builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + } + + private SourceOptionsSiteColl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.siteCollectionPath, + "siteCollectionPath cannot be null"); + siteCollectionPath = builder.siteCollectionPath; + limit = builder.limit; + } + + /** + * New builder. + * + * @return a SourceOptionsSiteColl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the siteCollectionPath. * @@ -32,7 +107,7 @@ public class SourceOptionsSiteColl extends GenericModel { * * @return the siteCollectionPath */ - public String getSiteCollectionPath() { + public String siteCollectionPath() { return siteCollectionPath; } @@ -44,25 +119,7 @@ public String getSiteCollectionPath() { * * @return the limit */ - public Long getLimit() { + public Long limit() { return limit; } - - /** - * Sets the siteCollectionPath. - * - * @param siteCollectionPath the new siteCollectionPath - */ - public void setSiteCollectionPath(final String siteCollectionPath) { - this.siteCollectionPath = siteCollectionPath; - } - - /** - * Sets the limit. - * - * @param limit the new limit - */ - public void setLimit(final long limit) { - this.limit = limit; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawl.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawl.java index 4373f807b89..77c197df42a 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawl.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawl.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -51,6 +52,182 @@ public interface CrawlSpeed { private Boolean overrideRobotsTxt; private List blacklist; + /** + * Builder. + */ + public static class Builder { + private String url; + private Boolean limitToStartingHosts; + private String crawlSpeed; + private Boolean allowUntrustedCertificate; + private Long maximumHops; + private Long requestTimeout; + private Boolean overrideRobotsTxt; + private List blacklist; + + private Builder(SourceOptionsWebCrawl sourceOptionsWebCrawl) { + this.url = sourceOptionsWebCrawl.url; + this.limitToStartingHosts = sourceOptionsWebCrawl.limitToStartingHosts; + this.crawlSpeed = sourceOptionsWebCrawl.crawlSpeed; + this.allowUntrustedCertificate = sourceOptionsWebCrawl.allowUntrustedCertificate; + this.maximumHops = sourceOptionsWebCrawl.maximumHops; + this.requestTimeout = sourceOptionsWebCrawl.requestTimeout; + this.overrideRobotsTxt = sourceOptionsWebCrawl.overrideRobotsTxt; + this.blacklist = sourceOptionsWebCrawl.blacklist; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param url the url + */ + public Builder(String url) { + this.url = url; + } + + /** + * Builds a SourceOptionsWebCrawl. + * + * @return the sourceOptionsWebCrawl + */ + public SourceOptionsWebCrawl build() { + return new SourceOptionsWebCrawl(this); + } + + /** + * Adds an blacklist to blacklist. + * + * @param blacklist the new blacklist + * @return the SourceOptionsWebCrawl builder + */ + public Builder addBlacklist(String blacklist) { + com.ibm.cloud.sdk.core.util.Validator.notNull(blacklist, + "blacklist cannot be null"); + if (this.blacklist == null) { + this.blacklist = new ArrayList(); + } + this.blacklist.add(blacklist); + return this; + } + + /** + * Set the url. + * + * @param url the url + * @return the SourceOptionsWebCrawl builder + */ + public Builder url(String url) { + this.url = url; + return this; + } + + /** + * Set the limitToStartingHosts. + * + * @param limitToStartingHosts the limitToStartingHosts + * @return the SourceOptionsWebCrawl builder + */ + public Builder limitToStartingHosts(Boolean limitToStartingHosts) { + this.limitToStartingHosts = limitToStartingHosts; + return this; + } + + /** + * Set the crawlSpeed. + * + * @param crawlSpeed the crawlSpeed + * @return the SourceOptionsWebCrawl builder + */ + public Builder crawlSpeed(String crawlSpeed) { + this.crawlSpeed = crawlSpeed; + return this; + } + + /** + * Set the allowUntrustedCertificate. + * + * @param allowUntrustedCertificate the allowUntrustedCertificate + * @return the SourceOptionsWebCrawl builder + */ + public Builder allowUntrustedCertificate(Boolean allowUntrustedCertificate) { + this.allowUntrustedCertificate = allowUntrustedCertificate; + return this; + } + + /** + * Set the maximumHops. + * + * @param maximumHops the maximumHops + * @return the SourceOptionsWebCrawl builder + */ + public Builder maximumHops(long maximumHops) { + this.maximumHops = maximumHops; + return this; + } + + /** + * Set the requestTimeout. + * + * @param requestTimeout the requestTimeout + * @return the SourceOptionsWebCrawl builder + */ + public Builder requestTimeout(long requestTimeout) { + this.requestTimeout = requestTimeout; + return this; + } + + /** + * Set the overrideRobotsTxt. + * + * @param overrideRobotsTxt the overrideRobotsTxt + * @return the SourceOptionsWebCrawl builder + */ + public Builder overrideRobotsTxt(Boolean overrideRobotsTxt) { + this.overrideRobotsTxt = overrideRobotsTxt; + return this; + } + + /** + * Set the blacklist. + * Existing blacklist will be replaced. + * + * @param blacklist the blacklist + * @return the SourceOptionsWebCrawl builder + */ + public Builder blacklist(List blacklist) { + this.blacklist = blacklist; + return this; + } + } + + private SourceOptionsWebCrawl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.url, + "url cannot be null"); + url = builder.url; + limitToStartingHosts = builder.limitToStartingHosts; + crawlSpeed = builder.crawlSpeed; + allowUntrustedCertificate = builder.allowUntrustedCertificate; + maximumHops = builder.maximumHops; + requestTimeout = builder.requestTimeout; + overrideRobotsTxt = builder.overrideRobotsTxt; + blacklist = builder.blacklist; + } + + /** + * New builder. + * + * @return a SourceOptionsWebCrawl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the url. * @@ -58,7 +235,7 @@ public interface CrawlSpeed { * * @return the url */ - public String getUrl() { + public String url() { return url; } @@ -69,7 +246,7 @@ public String getUrl() { * * @return the limitToStartingHosts */ - public Boolean isLimitToStartingHosts() { + public Boolean limitToStartingHosts() { return limitToStartingHosts; } @@ -82,7 +259,7 @@ public Boolean isLimitToStartingHosts() { * * @return the crawlSpeed */ - public String getCrawlSpeed() { + public String crawlSpeed() { return crawlSpeed; } @@ -93,7 +270,7 @@ public String getCrawlSpeed() { * * @return the allowUntrustedCertificate */ - public Boolean isAllowUntrustedCertificate() { + public Boolean allowUntrustedCertificate() { return allowUntrustedCertificate; } @@ -106,7 +283,7 @@ public Boolean isAllowUntrustedCertificate() { * * @return the maximumHops */ - public Long getMaximumHops() { + public Long maximumHops() { return maximumHops; } @@ -117,7 +294,7 @@ public Long getMaximumHops() { * * @return the requestTimeout */ - public Long getRequestTimeout() { + public Long requestTimeout() { return requestTimeout; } @@ -130,7 +307,7 @@ public Long getRequestTimeout() { * * @return the overrideRobotsTxt */ - public Boolean isOverrideRobotsTxt() { + public Boolean overrideRobotsTxt() { return overrideRobotsTxt; } @@ -142,79 +319,7 @@ public Boolean isOverrideRobotsTxt() { * * @return the blacklist */ - public List getBlacklist() { + public List blacklist() { return blacklist; } - - /** - * Sets the url. - * - * @param url the new url - */ - public void setUrl(final String url) { - this.url = url; - } - - /** - * Sets the limitToStartingHosts. - * - * @param limitToStartingHosts the new limitToStartingHosts - */ - public void setLimitToStartingHosts(final Boolean limitToStartingHosts) { - this.limitToStartingHosts = limitToStartingHosts; - } - - /** - * Sets the crawlSpeed. - * - * @param crawlSpeed the new crawlSpeed - */ - public void setCrawlSpeed(final String crawlSpeed) { - this.crawlSpeed = crawlSpeed; - } - - /** - * Sets the allowUntrustedCertificate. - * - * @param allowUntrustedCertificate the new allowUntrustedCertificate - */ - public void setAllowUntrustedCertificate(final Boolean allowUntrustedCertificate) { - this.allowUntrustedCertificate = allowUntrustedCertificate; - } - - /** - * Sets the maximumHops. - * - * @param maximumHops the new maximumHops - */ - public void setMaximumHops(final long maximumHops) { - this.maximumHops = maximumHops; - } - - /** - * Sets the requestTimeout. - * - * @param requestTimeout the new requestTimeout - */ - public void setRequestTimeout(final long requestTimeout) { - this.requestTimeout = requestTimeout; - } - - /** - * Sets the overrideRobotsTxt. - * - * @param overrideRobotsTxt the new overrideRobotsTxt - */ - public void setOverrideRobotsTxt(final Boolean overrideRobotsTxt) { - this.overrideRobotsTxt = overrideRobotsTxt; - } - - /** - * Sets the blacklist. - * - * @param blacklist the new blacklist - */ - public void setBlacklist(final List blacklist) { - this.blacklist = blacklist; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceSchedule.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceSchedule.java index 66b9c4868e6..9453a3adaa4 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceSchedule.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceSchedule.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -47,6 +47,84 @@ public interface Frequency { private String timeZone; private String frequency; + /** + * Builder. + */ + public static class Builder { + private Boolean enabled; + private String timeZone; + private String frequency; + + private Builder(SourceSchedule sourceSchedule) { + this.enabled = sourceSchedule.enabled; + this.timeZone = sourceSchedule.timeZone; + this.frequency = sourceSchedule.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a SourceSchedule. + * + * @return the sourceSchedule + */ + public SourceSchedule build() { + return new SourceSchedule(this); + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the SourceSchedule builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the timeZone. + * + * @param timeZone the timeZone + * @return the SourceSchedule builder + */ + public Builder timeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the SourceSchedule builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + private SourceSchedule(Builder builder) { + enabled = builder.enabled; + timeZone = builder.timeZone; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a SourceSchedule builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the enabled. * @@ -55,7 +133,7 @@ public interface Frequency { * * @return the enabled */ - public Boolean isEnabled() { + public Boolean enabled() { return enabled; } @@ -67,7 +145,7 @@ public Boolean isEnabled() { * * @return the timeZone */ - public String getTimeZone() { + public String timeZone() { return timeZone; } @@ -84,34 +162,7 @@ public String getTimeZone() { * * @return the frequency */ - public String getFrequency() { + public String frequency() { return frequency; } - - /** - * Sets the enabled. - * - * @param enabled the new enabled - */ - public void setEnabled(final Boolean enabled) { - this.enabled = enabled; - } - - /** - * Sets the timeZone. - * - * @param timeZone the new timeZone - */ - public void setTimeZone(final String timeZone) { - this.timeZone = timeZone; - } - - /** - * Sets the frequency. - * - * @param frequency the new frequency - */ - public void setFrequency(final String frequency) { - this.frequency = frequency; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceStatus.java index 8f0f3741e82..72acd3e5736 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceStatus.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Term.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Term.java index d827c8c2fca..a1155657534 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Term.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Term.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestConfigurationInEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestConfigurationInEnvironmentOptions.java index 5c80a6a0a7d..43d9904180d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestConfigurationInEnvironmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestConfigurationInEnvironmentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The testConfigurationInEnvironment options. @@ -205,8 +204,9 @@ public Builder file(File file) throws FileNotFoundException { } private TestConfigurationInEnvironmentOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.isTrue((builder.file == null) || (builder.filename != null), + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((builder.file == null) || (builder.filename != null), "filename cannot be null if file is not null."); environmentId = builder.environmentId; configuration = builder.configuration; @@ -244,8 +244,7 @@ public String environmentId() { * The configuration to use to process the document. If this part is provided, then the provided configuration is used * to process the document. If the **configuration_id** is also provided (both are present at the same time), then * request is rejected. The maximum supported configuration size is 1 MB. Configuration parts larger than 1 MB are - * rejected. - * See the `GET /configurations/{configuration_id}` operation for an example configuration. + * rejected. See the `GET /configurations/{configuration_id}` operation for an example configuration. * * @return the configuration */ @@ -291,8 +290,7 @@ public String fileContentType() { /** * Gets the metadata. * - * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. - * Example: ``` { + * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` { * "Creator": "Johnny Appleseed", * "Subject": "Apples" * } ```. diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestDocument.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestDocument.java index 503851c31b4..e72fef0b020 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestDocument.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TestDocument.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Timeslice.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Timeslice.java index 077379d2957..73ceacfa0b6 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Timeslice.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Timeslice.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictRule.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictRule.java index b2292829d86..450158f8290 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictRule.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -28,6 +29,151 @@ public class TokenDictRule extends GenericModel { @SerializedName("part_of_speech") private String partOfSpeech; + /** + * Builder. + */ + public static class Builder { + private String text; + private List tokens; + private List readings; + private String partOfSpeech; + + private Builder(TokenDictRule tokenDictRule) { + this.text = tokenDictRule.text; + this.tokens = tokenDictRule.tokens; + this.readings = tokenDictRule.readings; + this.partOfSpeech = tokenDictRule.partOfSpeech; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param text the text + * @param tokens the tokens + * @param partOfSpeech the partOfSpeech + */ + public Builder(String text, List tokens, String partOfSpeech) { + this.text = text; + this.tokens = tokens; + this.partOfSpeech = partOfSpeech; + } + + /** + * Builds a TokenDictRule. + * + * @return the tokenDictRule + */ + public TokenDictRule build() { + return new TokenDictRule(this); + } + + /** + * Adds an tokens to tokens. + * + * @param tokens the new tokens + * @return the TokenDictRule builder + */ + public Builder addTokens(String tokens) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tokens, + "tokens cannot be null"); + if (this.tokens == null) { + this.tokens = new ArrayList(); + } + this.tokens.add(tokens); + return this; + } + + /** + * Adds an readings to readings. + * + * @param readings the new readings + * @return the TokenDictRule builder + */ + public Builder addReadings(String readings) { + com.ibm.cloud.sdk.core.util.Validator.notNull(readings, + "readings cannot be null"); + if (this.readings == null) { + this.readings = new ArrayList(); + } + this.readings.add(readings); + return this; + } + + /** + * Set the text. + * + * @param text the text + * @return the TokenDictRule builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + + /** + * Set the tokens. + * Existing tokens will be replaced. + * + * @param tokens the tokens + * @return the TokenDictRule builder + */ + public Builder tokens(List tokens) { + this.tokens = tokens; + return this; + } + + /** + * Set the readings. + * Existing readings will be replaced. + * + * @param readings the readings + * @return the TokenDictRule builder + */ + public Builder readings(List readings) { + this.readings = readings; + return this; + } + + /** + * Set the partOfSpeech. + * + * @param partOfSpeech the partOfSpeech + * @return the TokenDictRule builder + */ + public Builder partOfSpeech(String partOfSpeech) { + this.partOfSpeech = partOfSpeech; + return this; + } + } + + private TokenDictRule(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.tokens, + "tokens cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.partOfSpeech, + "partOfSpeech cannot be null"); + text = builder.text; + tokens = builder.tokens; + readings = builder.readings; + partOfSpeech = builder.partOfSpeech; + } + + /** + * New builder. + * + * @return a TokenDictRule builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the text. * @@ -35,7 +181,7 @@ public class TokenDictRule extends GenericModel { * * @return the text */ - public String getText() { + public String text() { return text; } @@ -46,7 +192,7 @@ public String getText() { * * @return the tokens */ - public List getTokens() { + public List tokens() { return tokens; } @@ -57,7 +203,7 @@ public List getTokens() { * * @return the readings */ - public List getReadings() { + public List readings() { return readings; } @@ -68,43 +214,7 @@ public List getReadings() { * * @return the partOfSpeech */ - public String getPartOfSpeech() { + public String partOfSpeech() { return partOfSpeech; } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(final String text) { - this.text = text; - } - - /** - * Sets the tokens. - * - * @param tokens the new tokens - */ - public void setTokens(final List tokens) { - this.tokens = tokens; - } - - /** - * Sets the readings. - * - * @param readings the new readings - */ - public void setReadings(final List readings) { - this.readings = readings; - } - - /** - * Sets the partOfSpeech. - * - * @param partOfSpeech the new partOfSpeech - */ - public void setPartOfSpeech(final String partOfSpeech) { - this.partOfSpeech = partOfSpeech; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponse.java index ad25b4a8dc1..57011ebf704 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHits.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHits.java index abc1ad882ad..c3320d13fdc 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHits.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHits.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHitsResults.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHitsResults.java index 5fb2253a548..695e4d04b0f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHitsResults.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHitsResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingDataSet.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingDataSet.java index 64f67b061ad..34285b27f76 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingDataSet.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingDataSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExample.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExample.java index f0951ff32d9..d430fb3f7a4 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExample.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExample.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -26,6 +26,84 @@ public class TrainingExample extends GenericModel { private String crossReference; private Long relevance; + /** + * Builder. + */ + public static class Builder { + private String documentId; + private String crossReference; + private Long relevance; + + private Builder(TrainingExample trainingExample) { + this.documentId = trainingExample.documentId; + this.crossReference = trainingExample.crossReference; + this.relevance = trainingExample.relevance; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a TrainingExample. + * + * @return the trainingExample + */ + public TrainingExample build() { + return new TrainingExample(this); + } + + /** + * Set the documentId. + * + * @param documentId the documentId + * @return the TrainingExample builder + */ + public Builder documentId(String documentId) { + this.documentId = documentId; + return this; + } + + /** + * Set the crossReference. + * + * @param crossReference the crossReference + * @return the TrainingExample builder + */ + public Builder crossReference(String crossReference) { + this.crossReference = crossReference; + return this; + } + + /** + * Set the relevance. + * + * @param relevance the relevance + * @return the TrainingExample builder + */ + public Builder relevance(long relevance) { + this.relevance = relevance; + return this; + } + } + + private TrainingExample(Builder builder) { + documentId = builder.documentId; + crossReference = builder.crossReference; + relevance = builder.relevance; + } + + /** + * New builder. + * + * @return a TrainingExample builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the documentId. * @@ -33,7 +111,7 @@ public class TrainingExample extends GenericModel { * * @return the documentId */ - public String getDocumentId() { + public String documentId() { return documentId; } @@ -44,7 +122,7 @@ public String getDocumentId() { * * @return the crossReference */ - public String getCrossReference() { + public String crossReference() { return crossReference; } @@ -55,34 +133,7 @@ public String getCrossReference() { * * @return the relevance */ - public Long getRelevance() { + public Long relevance() { return relevance; } - - /** - * Sets the documentId. - * - * @param documentId the new documentId - */ - public void setDocumentId(final String documentId) { - this.documentId = documentId; - } - - /** - * Sets the crossReference. - * - * @param crossReference the new crossReference - */ - public void setCrossReference(final String crossReference) { - this.crossReference = crossReference; - } - - /** - * Sets the relevance. - * - * @param relevance the new relevance - */ - public void setRelevance(final long relevance) { - this.relevance = relevance; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExampleList.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExampleList.java index fcd29bdcdf6..62f4986310d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExampleList.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExampleList.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingQuery.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingQuery.java index 4fa0de69aa6..23dffe329d2 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingQuery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingQuery.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingStatus.java index a0f706fea7e..19b77d19ff9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingStatus.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptions.java index e2155b9645f..2c87ad0c4d9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateCollection options. @@ -127,8 +126,10 @@ public Builder configurationId(String configurationId) { } private UpdateCollectionOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; name = builder.name; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptions.java index 70398c60683..c33a2254ae3 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateConfiguration options. @@ -91,7 +90,8 @@ public UpdateConfigurationOptions build() { * @return the UpdateConfigurationOptions builder */ public Builder addEnrichment(Enrichment enrichment) { - Validator.notNull(enrichment, "enrichment cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(enrichment, + "enrichment cannot be null"); if (this.enrichments == null) { this.enrichments = new ArrayList(); } @@ -106,7 +106,8 @@ public Builder addEnrichment(Enrichment enrichment) { * @return the UpdateConfigurationOptions builder */ public Builder addNormalization(NormalizationOperation normalization) { - Validator.notNull(normalization, "normalization cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, + "normalization cannot be null"); if (this.normalizations == null) { this.normalizations = new ArrayList(); } @@ -211,20 +212,23 @@ public Builder source(Source source) { * @return the UpdateConfigurationOptions builder */ public Builder configuration(Configuration configuration) { - this.name = configuration.getName(); - this.description = configuration.getDescription(); - this.conversions = configuration.getConversions(); - this.enrichments = configuration.getEnrichments(); - this.normalizations = configuration.getNormalizations(); - this.source = configuration.getSource(); + this.name = configuration.name(); + this.description = configuration.description(); + this.conversions = configuration.conversions(); + this.enrichments = configuration.enrichments(); + this.normalizations = configuration.normalizations(); + this.source = configuration.source(); return this; } } private UpdateConfigurationOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.configurationId, "configurationId cannot be empty"); - Validator.notNull(builder.name, "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.configurationId, + "configurationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); environmentId = builder.environmentId; configurationId = builder.configurationId; name = builder.name; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java index 4435e2dc4ca..c88eb020057 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateCredentials options. @@ -165,16 +164,18 @@ public Builder status(String status) { * @return the UpdateCredentialsOptions builder */ public Builder credentials(Credentials credentials) { - this.sourceType = credentials.getSourceType(); - this.credentialDetails = credentials.getCredentialDetails(); - this.status = credentials.getStatus(); + this.sourceType = credentials.sourceType(); + this.credentialDetails = credentials.credentialDetails(); + this.status = credentials.status(); return this; } } private UpdateCredentialsOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.credentialId, "credentialId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.credentialId, + "credentialId cannot be empty"); environmentId = builder.environmentId; credentialId = builder.credentialId; sourceType = builder.sourceType; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptions.java index 0a47e6fa45d..a2d375afb70 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateDocument options. @@ -176,10 +175,13 @@ public Builder file(File file) throws FileNotFoundException { } private UpdateDocumentOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.documentId, "documentId cannot be empty"); - Validator.isTrue((builder.file == null) || (builder.filename != null), + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.documentId, + "documentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((builder.file == null) || (builder.filename != null), "filename cannot be null if file is not null."); environmentId = builder.environmentId; collectionId = builder.collectionId; @@ -270,8 +272,7 @@ public String fileContentType() { /** * Gets the metadata. * - * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. - * Example: ``` { + * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` { * "Creator": "Johnny Appleseed", * "Subject": "Apples" * } ```. diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptions.java index 4afc97beda8..c8668e68d74 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateEnvironment options. @@ -134,7 +133,8 @@ public Builder size(String size) { } private UpdateEnvironmentOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); environmentId = builder.environmentId; name = builder.name; description = builder.description; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptions.java index aa7253d06e6..fac22c7a882 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.discovery.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateTrainingExample options. @@ -145,10 +144,14 @@ public Builder relevance(long relevance) { } private UpdateTrainingExampleOptions(Builder builder) { - Validator.notEmpty(builder.environmentId, "environmentId cannot be empty"); - Validator.notEmpty(builder.collectionId, "collectionId cannot be empty"); - Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - Validator.notEmpty(builder.exampleId, "exampleId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.environmentId, + "environmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.collectionId, + "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, + "queryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.exampleId, + "exampleId cannot be empty"); environmentId = builder.environmentId; collectionId = builder.collectionId; queryId = builder.queryId; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordHeadingDetection.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordHeadingDetection.java index 34a6df38edb..5c11506d703 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordHeadingDetection.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordHeadingDetection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -25,38 +26,118 @@ public class WordHeadingDetection extends GenericModel { private List styles; /** - * Gets the fonts. - * - * @return the fonts + * Builder. */ - public List getFonts() { - return fonts; + public static class Builder { + private List fonts; + private List styles; + + private Builder(WordHeadingDetection wordHeadingDetection) { + this.fonts = wordHeadingDetection.fonts; + this.styles = wordHeadingDetection.styles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a WordHeadingDetection. + * + * @return the wordHeadingDetection + */ + public WordHeadingDetection build() { + return new WordHeadingDetection(this); + } + + /** + * Adds an fontSetting to fonts. + * + * @param fontSetting the new fontSetting + * @return the WordHeadingDetection builder + */ + public Builder addFontSetting(FontSetting fontSetting) { + com.ibm.cloud.sdk.core.util.Validator.notNull(fontSetting, + "fontSetting cannot be null"); + if (this.fonts == null) { + this.fonts = new ArrayList(); + } + this.fonts.add(fontSetting); + return this; + } + + /** + * Adds an wordStyle to styles. + * + * @param wordStyle the new wordStyle + * @return the WordHeadingDetection builder + */ + public Builder addWordStyle(WordStyle wordStyle) { + com.ibm.cloud.sdk.core.util.Validator.notNull(wordStyle, + "wordStyle cannot be null"); + if (this.styles == null) { + this.styles = new ArrayList(); + } + this.styles.add(wordStyle); + return this; + } + + /** + * Set the fonts. + * Existing fonts will be replaced. + * + * @param fonts the fonts + * @return the WordHeadingDetection builder + */ + public Builder fonts(List fonts) { + this.fonts = fonts; + return this; + } + + /** + * Set the styles. + * Existing styles will be replaced. + * + * @param styles the styles + * @return the WordHeadingDetection builder + */ + public Builder styles(List styles) { + this.styles = styles; + return this; + } + } + + private WordHeadingDetection(Builder builder) { + fonts = builder.fonts; + styles = builder.styles; } /** - * Gets the styles. + * New builder. * - * @return the styles + * @return a WordHeadingDetection builder */ - public List getStyles() { - return styles; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the fonts. + * Gets the fonts. * - * @param fonts the new fonts + * @return the fonts */ - public void setFonts(final List fonts) { - this.fonts = fonts; + public List fonts() { + return fonts; } /** - * Sets the styles. + * Gets the styles. * - * @param styles the new styles + * @return the styles */ - public void setStyles(final List styles) { - this.styles = styles; + public List styles() { + return styles; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordSettings.java index a706e15fa02..6b120b4e8c9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordSettings.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,20 +22,61 @@ public class WordSettings extends GenericModel { private WordHeadingDetection heading; /** - * Gets the heading. + * Builder. + */ + public static class Builder { + private WordHeadingDetection heading; + + private Builder(WordSettings wordSettings) { + this.heading = wordSettings.heading; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a WordSettings. + * + * @return the wordSettings + */ + public WordSettings build() { + return new WordSettings(this); + } + + /** + * Set the heading. + * + * @param heading the heading + * @return the WordSettings builder + */ + public Builder heading(WordHeadingDetection heading) { + this.heading = heading; + return this; + } + } + + private WordSettings(Builder builder) { + heading = builder.heading; + } + + /** + * New builder. * - * @return the heading + * @return a WordSettings builder */ - public WordHeadingDetection getHeading() { - return heading; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the heading. + * Gets the heading. * - * @param heading the new heading + * @return the heading */ - public void setHeading(final WordHeadingDetection heading) { - this.heading = heading; + public WordHeadingDetection heading() { + return heading; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordStyle.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordStyle.java index b1a0a7693bb..1b32e93a100 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordStyle.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordStyle.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,6 +25,87 @@ public class WordStyle extends GenericModel { private Long level; private List names; + /** + * Builder. + */ + public static class Builder { + private Long level; + private List names; + + private Builder(WordStyle wordStyle) { + this.level = wordStyle.level; + this.names = wordStyle.names; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a WordStyle. + * + * @return the wordStyle + */ + public WordStyle build() { + return new WordStyle(this); + } + + /** + * Adds an names to names. + * + * @param names the new names + * @return the WordStyle builder + */ + public Builder addNames(String names) { + com.ibm.cloud.sdk.core.util.Validator.notNull(names, + "names cannot be null"); + if (this.names == null) { + this.names = new ArrayList(); + } + this.names.add(names); + return this; + } + + /** + * Set the level. + * + * @param level the level + * @return the WordStyle builder + */ + public Builder level(long level) { + this.level = level; + return this; + } + + /** + * Set the names. + * Existing names will be replaced. + * + * @param names the names + * @return the WordStyle builder + */ + public Builder names(List names) { + this.names = names; + return this; + } + } + + private WordStyle(Builder builder) { + level = builder.level; + names = builder.names; + } + + /** + * New builder. + * + * @return a WordStyle builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the level. * @@ -31,7 +113,7 @@ public class WordStyle extends GenericModel { * * @return the level */ - public Long getLevel() { + public Long level() { return level; } @@ -42,25 +124,7 @@ public Long getLevel() { * * @return the names */ - public List getNames() { + public List names() { return names; } - - /** - * Sets the level. - * - * @param level the new level - */ - public void setLevel(final long level) { - this.level = level; - } - - /** - * Sets the names. - * - * @param names the new names - */ - public void setNames(final List names) { - this.names = names; - } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/XPathPatterns.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/XPathPatterns.java index 4c12f5ced6f..e8a1d83af8d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/XPathPatterns.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/XPathPatterns.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.discovery.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,22 +25,80 @@ public class XPathPatterns extends GenericModel { private List xpaths; /** - * Gets the xpaths. - * - * An array to XPaths. + * Builder. + */ + public static class Builder { + private List xpaths; + + private Builder(XPathPatterns xPathPatterns) { + this.xpaths = xPathPatterns.xpaths; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a XPathPatterns. + * + * @return the xPathPatterns + */ + public XPathPatterns build() { + return new XPathPatterns(this); + } + + /** + * Adds an xpaths to xpaths. + * + * @param xpaths the new xpaths + * @return the XPathPatterns builder + */ + public Builder addXpaths(String xpaths) { + com.ibm.cloud.sdk.core.util.Validator.notNull(xpaths, + "xpaths cannot be null"); + if (this.xpaths == null) { + this.xpaths = new ArrayList(); + } + this.xpaths.add(xpaths); + return this; + } + + /** + * Set the xpaths. + * Existing xpaths will be replaced. + * + * @param xpaths the xpaths + * @return the XPathPatterns builder + */ + public Builder xpaths(List xpaths) { + this.xpaths = xpaths; + return this; + } + } + + private XPathPatterns(Builder builder) { + xpaths = builder.xpaths; + } + + /** + * New builder. * - * @return the xpaths + * @return a XPathPatterns builder */ - public List getXpaths() { - return xpaths; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the xpaths. + * Gets the xpaths. + * + * An array to XPaths. * - * @param xpaths the new xpaths + * @return the xpaths */ - public void setXpaths(final List xpaths) { - this.xpaths = xpaths; + public List xpaths() { + return xpaths; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/package-info.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/package-info.java index 6259ff8a95d..9ec2ce02778 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/package-info.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java index 1e0e564d643..34e37fcad4b 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,12 +16,10 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.language_translator.v3.model.CreateModelOptions; import com.ibm.watson.language_translator.v3.model.DeleteDocumentOptions; @@ -47,7 +45,6 @@ import java.util.Map; import java.util.Map.Entry; import okhttp3.MultipartBody; -import okhttp3.RequestBody; /** * IBM Watson™ Language Translator translates text from one language to another. The service offers multiple IBM @@ -56,7 +53,7 @@ * their own language, and more. * * @version v3 - * @see Language Translator + * @see Language Translator */ public class LanguageTranslator extends BaseService { @@ -66,54 +63,19 @@ public class LanguageTranslator extends BaseService { private String versionDate; /** - * Instantiates a new `LanguageTranslator`. + * Constructs a new `LanguageTranslator` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use LanguageTranslator(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public LanguageTranslator(String versionDate) { - super(SERVICE_NAME); + public LanguageTranslator(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `LanguageTranslator` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use LanguageTranslator(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public LanguageTranslator(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `LanguageTranslator` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public LanguageTranslator(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -126,7 +88,8 @@ public LanguageTranslator(String versionDate, AuthenticatorConfig authenticatorC * @return a {@link ServiceCall} with a response type of {@link TranslationResult} */ public ServiceCall translate(TranslateOptions translateOptions) { - Validator.notNull(translateOptions, "translateOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(translateOptions, + "translateOptions cannot be null"); String[] pathSegments = { "v3/translate" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -136,7 +99,7 @@ public ServiceCall translate(TranslateOptions translateOption } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("text", GsonSingleton.getGson().toJsonTree(translateOptions.text())); + contentJson.add("text", {{corePackage}.util.GsonSingleton.getGson().toJsonTree(translateOptions.text())); if (translateOptions.modelId() != null) { contentJson.addProperty("model_id", translateOptions.modelId()); } @@ -147,9 +110,8 @@ public ServiceCall translate(TranslateOptions translateOption contentJson.addProperty("target", translateOptions.target()); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() { - }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } @@ -202,7 +164,8 @@ public ServiceCall listIdentifiableLanguages() { * @return a {@link ServiceCall} with a response type of {@link IdentifiedLanguages} */ public ServiceCall identify(IdentifyOptions identifyOptions) { - Validator.notNull(identifyOptions, "identifyOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(identifyOptions, + "identifyOptions cannot be null"); String[] pathSegments = { "v3/identify" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -242,8 +205,8 @@ public ServiceCall listModels(ListModelsOptions listModelsOpt if (listModelsOptions.target() != null) { builder.query("target", listModelsOptions.target()); } - if (listModelsOptions.defaultModels() != null) { - builder.query("default", String.valueOf(listModelsOptions.defaultModels())); + if (listModelsOptions.xdefault() != null) { + builder.query("default", String.valueOf(listModelsOptions.xdefault())); } } ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -277,15 +240,16 @@ public ServiceCall listModels() { * files is limited to 250 MB. To successfully train with a parallel corpus you must have at least 5,000 * parallel sentences in your corpus. * - * You can have a maxium of 10 custom models per language pair. + * You can have a maximum of 10 custom models per language pair. * * @param createModelOptions the {@link CreateModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TranslationModel} */ public ServiceCall createModel(CreateModelOptions createModelOptions) { - Validator.notNull(createModelOptions, "createModelOptions cannot be null"); - Validator.isTrue((createModelOptions.forcedGlossary() != null) || (createModelOptions.parallelCorpus() != null), - "At least one of forcedGlossary or parallelCorpus must be supplied."); + com.ibm.cloud.sdk.core.util.Validator.notNull(createModelOptions, + "createModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((createModelOptions.forcedGlossary() != null) || (createModelOptions + .parallelCorpus() != null), "At least one of forcedGlossary or parallelCorpus must be supplied."); String[] pathSegments = { "v3/models" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -301,12 +265,12 @@ public ServiceCall createModel(CreateModelOptions createModelO MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (createModelOptions.forcedGlossary() != null) { - RequestBody forcedGlossaryBody = RequestUtils.inputStreamBody(createModelOptions.forcedGlossary(), + okhttp3.RequestBody forcedGlossaryBody = RequestUtils.inputStreamBody(createModelOptions.forcedGlossary(), "application/octet-stream"); multipartBuilder.addFormDataPart("forced_glossary", "filename", forcedGlossaryBody); } if (createModelOptions.parallelCorpus() != null) { - RequestBody parallelCorpusBody = RequestUtils.inputStreamBody(createModelOptions.parallelCorpus(), + okhttp3.RequestBody parallelCorpusBody = RequestUtils.inputStreamBody(createModelOptions.parallelCorpus(), "application/octet-stream"); multipartBuilder.addFormDataPart("parallel_corpus", "filename", parallelCorpusBody); } @@ -326,7 +290,8 @@ public ServiceCall createModel(CreateModelOptions createModelO * @return a {@link ServiceCall} with a response type of {@link DeleteModelResult} */ public ServiceCall deleteModel(DeleteModelOptions deleteModelOptions) { - Validator.notNull(deleteModelOptions, "deleteModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteModelOptions, + "deleteModelOptions cannot be null"); String[] pathSegments = { "v3/models" }; String[] pathParameters = { deleteModelOptions.modelId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -353,7 +318,8 @@ public ServiceCall deleteModel(DeleteModelOptions deleteModel * @return a {@link ServiceCall} with a response type of {@link TranslationModel} */ public ServiceCall getModel(GetModelOptions getModelOptions) { - Validator.notNull(getModelOptions, "getModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getModelOptions, + "getModelOptions cannot be null"); String[] pathSegments = { "v3/models" }; String[] pathParameters = { getModelOptions.modelId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -416,7 +382,8 @@ public ServiceCall listDocuments() { * @return a {@link ServiceCall} with a response type of {@link DocumentStatus} */ public ServiceCall translateDocument(TranslateDocumentOptions translateDocumentOptions) { - Validator.notNull(translateDocumentOptions, "translateDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(translateDocumentOptions, + "translateDocumentOptions cannot be null"); String[] pathSegments = { "v3/documents" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -427,8 +394,8 @@ public ServiceCall translateDocument(TranslateDocumentOptions tr builder.header("Accept", "application/json"); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody fileBody = RequestUtils.inputStreamBody(translateDocumentOptions.file(), translateDocumentOptions - .fileContentType()); + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(translateDocumentOptions.file(), + translateDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", translateDocumentOptions.filename(), fileBody); if (translateDocumentOptions.modelId() != null) { multipartBuilder.addFormDataPart("model_id", translateDocumentOptions.modelId()); @@ -458,7 +425,8 @@ public ServiceCall translateDocument(TranslateDocumentOptions tr * @return a {@link ServiceCall} with a response type of {@link DocumentStatus} */ public ServiceCall getDocumentStatus(GetDocumentStatusOptions getDocumentStatusOptions) { - Validator.notNull(getDocumentStatusOptions, "getDocumentStatusOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getDocumentStatusOptions, + "getDocumentStatusOptions cannot be null"); String[] pathSegments = { "v3/documents" }; String[] pathParameters = { getDocumentStatusOptions.documentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -484,7 +452,8 @@ public ServiceCall getDocumentStatus(GetDocumentStatusOptions ge * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteDocument(DeleteDocumentOptions deleteDocumentOptions) { - Validator.notNull(deleteDocumentOptions, "deleteDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteDocumentOptions, + "deleteDocumentOptions cannot be null"); String[] pathSegments = { "v3/documents" }; String[] pathParameters = { deleteDocumentOptions.documentId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -507,7 +476,8 @@ public ServiceCall deleteDocument(DeleteDocumentOptions deleteDocumentOpti * @return a {@link ServiceCall} with a response type of {@link InputStream} */ public ServiceCall getTranslatedDocument(GetTranslatedDocumentOptions getTranslatedDocumentOptions) { - Validator.notNull(getTranslatedDocumentOptions, "getTranslatedDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getTranslatedDocumentOptions, + "getTranslatedDocumentOptions cannot be null"); String[] pathSegments = { "v3/documents", "translated_document" }; String[] pathParameters = { getTranslatedDocumentOptions.documentId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java index 883fec96110..e1d49fa558c 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createModel options. @@ -142,7 +141,8 @@ public Builder parallelCorpus(File parallelCorpus) throws FileNotFoundException } private CreateModelOptions(Builder builder) { - Validator.notNull(builder.baseModelId, "baseModelId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.baseModelId, + "baseModelId cannot be null"); baseModelId = builder.baseModelId; forcedGlossary = builder.forcedGlossary; parallelCorpus = builder.parallelCorpus; diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteDocumentOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteDocumentOptions.java index bda2070c87e..dba593a4567 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteDocumentOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteDocumentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.language_translator.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteDocument options. @@ -69,7 +68,8 @@ public Builder documentId(String documentId) { } private DeleteDocumentOptions(Builder builder) { - Validator.notEmpty(builder.documentId, "documentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.documentId, + "documentId cannot be empty"); documentId = builder.documentId; } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelOptions.java index 75c411d37bf..60e9086d1d0 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.language_translator.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteModel options. @@ -69,7 +68,8 @@ public Builder modelId(String modelId) { } private DeleteModelOptions(Builder builder) { - Validator.notEmpty(builder.modelId, "modelId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.modelId, + "modelId cannot be empty"); modelId = builder.modelId; } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelResult.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelResult.java index 753c75e924c..da33fa13c94 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelResult.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DeleteModelResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentList.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentList.java index 865d92988b2..13e5c6f6aef 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentList.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentList.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java index a910f1446fb..dbeb54455e0 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetDocumentStatusOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetDocumentStatusOptions.java index b3f8df3718e..67e3ad8f14f 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetDocumentStatusOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetDocumentStatusOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.language_translator.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getDocumentStatus options. @@ -69,7 +68,8 @@ public Builder documentId(String documentId) { } private GetDocumentStatusOptions(Builder builder) { - Validator.notEmpty(builder.documentId, "documentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.documentId, + "documentId cannot be empty"); documentId = builder.documentId; } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetModelOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetModelOptions.java index 4290acc323f..4a6ead2e142 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetModelOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.language_translator.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getModel options. @@ -69,7 +68,8 @@ public Builder modelId(String modelId) { } private GetModelOptions(Builder builder) { - Validator.notEmpty(builder.modelId, "modelId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.modelId, + "modelId cannot be empty"); modelId = builder.modelId; } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java index c1a39bde6cf..3227e87c918 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.language_translator.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getTranslatedDocument options. @@ -44,18 +43,15 @@ public interface Accept { /** application/vnd.ms-excel. */ String APPLICATION_VND_MS_EXCEL = "application/vnd.ms-excel"; /** application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. */ - String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET - = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; /** application/vnd.ms-powerpoint. */ String APPLICATION_VND_MS_POWERPOINT = "application/vnd.ms-powerpoint"; /** application/vnd.openxmlformats-officedocument.presentationml.presentation. */ - String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION - = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; + String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; /** application/msword. */ String APPLICATION_MSWORD = "application/msword"; /** application/vnd.openxmlformats-officedocument.wordprocessingml.document. */ - String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT - = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; + String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; /** application/vnd.oasis.opendocument.spreadsheet. */ String APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET = "application/vnd.oasis.opendocument.spreadsheet"; /** application/vnd.oasis.opendocument.presentation. */ @@ -143,7 +139,8 @@ public Builder accept(String accept) { } private GetTranslatedDocumentOptions(Builder builder) { - Validator.notEmpty(builder.documentId, "documentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.documentId, + "documentId cannot be empty"); documentId = builder.documentId; accept = builder.accept; } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguage.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguage.java index 74c3247aa74..40909598d58 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguage.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguages.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguages.java index b3ff8ac11af..9aa194459da 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguages.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiableLanguages.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguage.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguage.java index e23f47a8044..90d1ac76c34 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguage.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguages.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguages.java index 4e7825fcad0..a357f1649ae 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguages.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifiedLanguages.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifyOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifyOptions.java index b113f99c3df..725c2d734dc 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifyOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/IdentifyOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.language_translator.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The identify options. @@ -69,7 +68,8 @@ public Builder text(String text) { } private IdentifyOptions(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java index fb19e1bde0f..c3713b3661a 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java index 19d6e329fce..740852eab1e 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java index 0af5c11f39b..48e10db3aa5 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -21,7 +21,7 @@ public class ListModelsOptions extends GenericModel { private String source; private String target; - private Boolean defaultModels; + private Boolean xdefault; /** * Builder. @@ -29,12 +29,12 @@ public class ListModelsOptions extends GenericModel { public static class Builder { private String source; private String target; - private Boolean defaultModels; + private Boolean xdefault; private Builder(ListModelsOptions listModelsOptions) { this.source = listModelsOptions.source; this.target = listModelsOptions.target; - this.defaultModels = listModelsOptions.defaultModels; + this.xdefault = listModelsOptions.xdefault; } /** @@ -75,13 +75,13 @@ public Builder target(String target) { } /** - * Set the defaultModels. + * Set the xdefault. * - * @param defaultModels the defaultModels + * @param xdefault the xdefault * @return the ListModelsOptions builder */ - public Builder defaultModels(Boolean defaultModels) { - this.defaultModels = defaultModels; + public Builder xdefault(Boolean xdefault) { + this.xdefault = xdefault; return this; } } @@ -89,7 +89,7 @@ public Builder defaultModels(Boolean defaultModels) { private ListModelsOptions(Builder builder) { source = builder.source; target = builder.target; - defaultModels = builder.defaultModels; + xdefault = builder.xdefault; } /** @@ -124,15 +124,15 @@ public String target() { } /** - * Gets the defaultModels. + * Gets the xdefault. * * If the default parameter isn't specified, the service will return all models (default and non-default) for each * language pair. To return only default models, set this to `true`. To return only non-default models, set this to * `false`. There is exactly one default model per language pair, the IBM provided base model. * - * @return the defaultModels + * @return the xdefault */ - public Boolean defaultModels() { - return defaultModels; + public Boolean xdefault() { + return xdefault; } } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java index 5debe019757..90eb13ce329 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The translateDocument options. @@ -174,8 +173,10 @@ public Builder file(File file) throws FileNotFoundException { } private TranslateDocumentOptions(Builder builder) { - Validator.notNull(builder.file, "file cannot be null"); - Validator.notNull(builder.filename, "filename cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.file, + "file cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.filename, + "filename cannot be null"); file = builder.file; filename = builder.filename; fileContentType = builder.fileContentType; @@ -200,9 +201,7 @@ public Builder newBuilder() { * The source file to translate. * * [Supported file - * types] - * (https://cloud.ibm.com/docs/services/language-translator - * ?topic=language-translator-document-translator-tutorial#supported-file-formats) + * types](https://cloud.ibm.com/docs/services/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats) * * Maximum file size: **20 MB**. * diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java index 6d4bf211c9b..917d86b48e7 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The translate options. @@ -75,7 +74,8 @@ public TranslateOptions build() { * @return the TranslateOptions builder */ public Builder addText(String text) { - Validator.notNull(text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(text, + "text cannot be null"); if (this.text == null) { this.text = new ArrayList(); } @@ -130,7 +130,8 @@ public Builder target(String target) { } private TranslateOptions(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; modelId = builder.modelId; source = builder.source; diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Translation.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Translation.java index d3b09df58ab..82da28cf612 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Translation.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Translation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,7 +12,6 @@ */ package com.ibm.watson.language_translator.v3.model; -import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; /** @@ -20,17 +19,16 @@ */ public class Translation extends GenericModel { - @SerializedName("translation") - private String translationOutput; + private String translation; /** - * Gets the translationOutput. + * Gets the translation. * * Translation output in UTF-8. * - * @return the translationOutput + * @return the translation */ - public String getTranslationOutput() { - return translationOutput; + public String getTranslation() { + return translation; } } diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModel.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModel.java index 84cc10642cd..a80e71f9a9c 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModel.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModels.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModels.java index 8d1e2598910..a8e8af0ec64 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModels.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationModels.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java index 324fc77c402..624a7f910b9 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/package-info.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/package-info.java index 42df24ff563..9245dae08ec 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/package-info.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java index 91795ff7517..4948ca76af7 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,12 +16,10 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.natural_language_classifier.v1.model.Classification; import com.ibm.watson.natural_language_classifier.v1.model.ClassificationCollection; @@ -36,7 +34,6 @@ import java.util.Map; import java.util.Map.Entry; import okhttp3.MultipartBody; -import okhttp3.RequestBody; /** * IBM Watson™ Natural Language Classifier uses machine learning algorithms to return the top matching predefined @@ -44,8 +41,7 @@ * that the service can apply those classes to new inputs. * * @version v1 - * @see Natural Language - * Classifier + * @see Natural Language Classifier */ public class NaturalLanguageClassifier extends BaseService { @@ -53,44 +49,17 @@ public class NaturalLanguageClassifier extends BaseService { private static final String URL = "https://gateway.watsonplatform.net/natural-language-classifier/api"; /** - * Instantiates a new `NaturalLanguageClassifier`. + * Constructs a new `NaturalLanguageClassifier` client with the specified Authenticator. * - * @deprecated Use NaturalLanguageClassifier(AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public NaturalLanguageClassifier() { - super(SERVICE_NAME); + public NaturalLanguageClassifier(Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } } - /** - * Instantiates a new `NaturalLanguageClassifier` with username and password. - * - * @param username the username - * @param password the password - * @deprecated Use NaturalLanguageClassifier(AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public NaturalLanguageClassifier(String username, String password) { - this(); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `NaturalLanguageClassifier` with the specified authentication configuration. - * - * @param authenticatorConfig the authentication configuration for this service - */ - public NaturalLanguageClassifier(AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - } - /** * Classify a phrase. * @@ -101,7 +70,8 @@ public NaturalLanguageClassifier(AuthenticatorConfig authenticatorConfig) { * @return a {@link ServiceCall} with a response type of {@link Classification} */ public ServiceCall classify(ClassifyOptions classifyOptions) { - Validator.notNull(classifyOptions, "classifyOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(classifyOptions, + "classifyOptions cannot be null"); String[] pathSegments = { "v1/classifiers", "classify" }; String[] pathParameters = { classifyOptions.classifierId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -132,7 +102,8 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { * @return a {@link ServiceCall} with a response type of {@link ClassificationCollection} */ public ServiceCall classifyCollection(ClassifyCollectionOptions classifyCollectionOptions) { - Validator.notNull(classifyCollectionOptions, "classifyCollectionOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(classifyCollectionOptions, + "classifyCollectionOptions cannot be null"); String[] pathSegments = { "v1/classifiers", "classify_collection" }; String[] pathParameters = { classifyCollectionOptions.classifierId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -143,7 +114,8 @@ public ServiceCall classifyCollection(ClassifyCollecti } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("collection", GsonSingleton.getGson().toJsonTree(classifyCollectionOptions.collection())); + contentJson.add("collection", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + classifyCollectionOptions.collection())); builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { @@ -160,7 +132,8 @@ public ServiceCall classifyCollection(ClassifyCollecti * @return a {@link ServiceCall} with a response type of {@link Classifier} */ public ServiceCall createClassifier(CreateClassifierOptions createClassifierOptions) { - Validator.notNull(createClassifierOptions, "createClassifierOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createClassifierOptions, + "createClassifierOptions cannot be null"); String[] pathSegments = { "v1/classifiers" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("natural_language_classifier", "v1", "createClassifier"); @@ -170,10 +143,11 @@ public ServiceCall createClassifier(CreateClassifierOptions createCl builder.header("Accept", "application/json"); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - RequestBody trainingMetadataBody = RequestUtils.inputStreamBody(createClassifierOptions.metadata(), + okhttp3.RequestBody trainingMetadataBody = RequestUtils.inputStreamBody(createClassifierOptions.trainingMetadata(), "application/json"); multipartBuilder.addFormDataPart("training_metadata", "filename", trainingMetadataBody); - RequestBody trainingDataBody = RequestUtils.inputStreamBody(createClassifierOptions.trainingData(), "text/csv"); + okhttp3.RequestBody trainingDataBody = RequestUtils.inputStreamBody(createClassifierOptions.trainingData(), + "text/csv"); multipartBuilder.addFormDataPart("training_data", "filename", trainingDataBody); builder.body(multipartBuilder.build()); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -226,7 +200,8 @@ public ServiceCall listClassifiers() { * @return a {@link ServiceCall} with a response type of {@link Classifier} */ public ServiceCall getClassifier(GetClassifierOptions getClassifierOptions) { - Validator.notNull(getClassifierOptions, "getClassifierOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getClassifierOptions, + "getClassifierOptions cannot be null"); String[] pathSegments = { "v1/classifiers" }; String[] pathParameters = { getClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -249,7 +224,8 @@ public ServiceCall getClassifier(GetClassifierOptions getClassifierO * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteClassifier(DeleteClassifierOptions deleteClassifierOptions) { - Validator.notNull(deleteClassifierOptions, "deleteClassifierOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteClassifierOptions, + "deleteClassifierOptions cannot be null"); String[] pathSegments = { "v1/classifiers" }; String[] pathParameters = { deleteClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classification.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classification.java index 0c0d218516e..87d0728242b 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classification.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classification.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassificationCollection.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassificationCollection.java index 573711d9278..7d552784dd2 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassificationCollection.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassificationCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifiedClass.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifiedClass.java index ac041ef8ab0..eb0f2a88693 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifiedClass.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifiedClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classifier.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classifier.java index 351a815c833..e7c0e96ecdf 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classifier.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/Classifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifierList.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifierList.java index 5f48db6a804..ece95f132a8 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifierList.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifierList.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyCollectionOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyCollectionOptions.java index 0cbbff2f58d..d56889a581b 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyCollectionOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyCollectionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The classifyCollection options. @@ -71,7 +70,8 @@ public ClassifyCollectionOptions build() { * @return the ClassifyCollectionOptions builder */ public Builder addClassifyInput(ClassifyInput classifyInput) { - Validator.notNull(classifyInput, "classifyInput cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(classifyInput, + "classifyInput cannot be null"); if (this.collection == null) { this.collection = new ArrayList(); } @@ -104,8 +104,10 @@ public Builder collection(List collection) { } private ClassifyCollectionOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); - Validator.notNull(builder.collection, "collection cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.collection, + "collection cannot be null"); classifierId = builder.classifierId; collection = builder.collection; } diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyInput.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyInput.java index 8acb637837b..685be49cdd6 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyInput.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyInput.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,22 +22,74 @@ public class ClassifyInput extends GenericModel { private String text; /** - * Gets the text. - * - * The submitted phrase. The maximum length is 2048 characters. + * Builder. + */ + public static class Builder { + private String text; + + private Builder(ClassifyInput classifyInput) { + this.text = classifyInput.text; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param text the text + */ + public Builder(String text) { + this.text = text; + } + + /** + * Builds a ClassifyInput. + * + * @return the classifyInput + */ + public ClassifyInput build() { + return new ClassifyInput(this); + } + + /** + * Set the text. + * + * @param text the text + * @return the ClassifyInput builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + } + + private ClassifyInput(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); + text = builder.text; + } + + /** + * New builder. * - * @return the text + * @return a ClassifyInput builder */ - public String getText() { - return text; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the text. + * Gets the text. + * + * The submitted phrase. The maximum length is 2048 characters. * - * @param text the new text + * @return the text */ - public void setText(final String text) { - this.text = text; + public String text() { + return text; } } diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyOptions.java index 9452e61d163..dda4f58a514 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ClassifyOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.natural_language_classifier.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The classify options. @@ -85,8 +84,10 @@ public Builder text(String text) { } private ClassifyOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); classifierId = builder.classifierId; text = builder.text; } diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CollectionItem.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CollectionItem.java index 4642cc1d42c..b9224f1a57f 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CollectionItem.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CollectionItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java index b660f2fea33..d08f3c8882a 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,25 +18,24 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createClassifier options. */ public class CreateClassifierOptions extends GenericModel { - private InputStream metadata; + private InputStream trainingMetadata; private InputStream trainingData; /** * Builder. */ public static class Builder { - private InputStream metadata; + private InputStream trainingMetadata; private InputStream trainingData; private Builder(CreateClassifierOptions createClassifierOptions) { - this.metadata = createClassifierOptions.metadata; + this.trainingMetadata = createClassifierOptions.trainingMetadata; this.trainingData = createClassifierOptions.trainingData; } @@ -49,11 +48,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param metadata the metadata + * @param trainingMetadata the trainingMetadata * @param trainingData the trainingData */ - public Builder(InputStream metadata, InputStream trainingData) { - this.metadata = metadata; + public Builder(InputStream trainingMetadata, InputStream trainingData) { + this.trainingMetadata = trainingMetadata; this.trainingData = trainingData; } @@ -67,13 +66,13 @@ public CreateClassifierOptions build() { } /** - * Set the metadata. + * Set the trainingMetadata. * - * @param metadata the metadata + * @param trainingMetadata the trainingMetadata * @return the CreateClassifierOptions builder */ - public Builder metadata(InputStream metadata) { - this.metadata = metadata; + public Builder trainingMetadata(InputStream trainingMetadata) { + this.trainingMetadata = trainingMetadata; return this; } @@ -89,15 +88,15 @@ public Builder trainingData(InputStream trainingData) { } /** - * Set the metadata. + * Set the trainingMetadata. * - * @param metadata the metadata + * @param trainingMetadata the trainingMetadata * @return the CreateClassifierOptions builder * * @throws FileNotFoundException if the file could not be found */ - public Builder metadata(File metadata) throws FileNotFoundException { - this.metadata = new FileInputStream(metadata); + public Builder trainingMetadata(File trainingMetadata) throws FileNotFoundException { + this.trainingMetadata = new FileInputStream(trainingMetadata); return this; } @@ -116,9 +115,11 @@ public Builder trainingData(File trainingData) throws FileNotFoundException { } private CreateClassifierOptions(Builder builder) { - Validator.notNull(builder.metadata, "metadata cannot be null"); - Validator.notNull(builder.trainingData, "trainingData cannot be null"); - metadata = builder.metadata; + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.trainingMetadata, + "trainingMetadata cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.trainingData, + "trainingData cannot be null"); + trainingMetadata = builder.trainingMetadata; trainingData = builder.trainingData; } @@ -132,7 +133,7 @@ public Builder newBuilder() { } /** - * Gets the metadata. + * Gets the trainingMetadata. * * Metadata in JSON format. The metadata identifies the language of the data, and an optional name to identify the * classifier. Specify the language with the 2-letter primary language code as assigned in ISO standard 639. @@ -140,10 +141,10 @@ public Builder newBuilder() { * Supported languages are English (`en`), Arabic (`ar`), French (`fr`), German, (`de`), Italian (`it`), Japanese * (`ja`), Korean (`ko`), Brazilian Portuguese (`pt`), and Spanish (`es`). * - * @return the metadata + * @return the trainingMetadata */ - public InputStream metadata() { - return metadata; + public InputStream trainingMetadata() { + return trainingMetadata; } /** @@ -151,9 +152,7 @@ public InputStream metadata() { * * Training data in CSV format. Each text value must have at least one class. The data can include up to 3,000 classes * and 20,000 records. For details, see [Data - * preparation] - * (https://cloud.ibm.com/docs/services/natural-language-classifier - * ?topic=natural-language-classifier-using-your-data). + * preparation](https://cloud.ibm.com/docs/services/natural-language-classifier?topic=natural-language-classifier-using-your-data). * * @return the trainingData */ diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/DeleteClassifierOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/DeleteClassifierOptions.java index 8e11fbe609a..e5c22bfe6a7 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/DeleteClassifierOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/DeleteClassifierOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.natural_language_classifier.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteClassifier options. @@ -69,7 +68,8 @@ public Builder classifierId(String classifierId) { } private DeleteClassifierOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); classifierId = builder.classifierId; } diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/GetClassifierOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/GetClassifierOptions.java index 713c0af5cf1..d9ab75b06f8 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/GetClassifierOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/GetClassifierOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.natural_language_classifier.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getClassifier options. @@ -69,7 +68,8 @@ public Builder classifierId(String classifierId) { } private GetClassifierOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); classifierId = builder.classifierId; } diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java index deaf87da7b2..d5b23e04501 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/package-info.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/package-info.java index c7a62ba863c..098c3ed49ab 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/package-info.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java index e3749358ae7..dab26834e12 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,11 +16,9 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.natural_language_understanding.v1.model.AnalysisResults; import com.ibm.watson.natural_language_understanding.v1.model.AnalyzeOptions; @@ -37,13 +35,11 @@ * analysis by default, so the results can ignore most advertisements and other unwanted content. * * You can create [custom - * models] - * (https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) + * models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) * with Watson Knowledge Studio to detect custom entities, relations, and categories in Natural Language Understanding. * * @version v1 - * @see Natural Language - * Understanding + * @see Natural Language Understanding */ public class NaturalLanguageUnderstanding extends BaseService { @@ -53,54 +49,19 @@ public class NaturalLanguageUnderstanding extends BaseService { private String versionDate; /** - * Instantiates a new `NaturalLanguageUnderstanding`. + * Constructs a new `NaturalLanguageUnderstanding` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use NaturalLanguageUnderstanding(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public NaturalLanguageUnderstanding(String versionDate) { - super(SERVICE_NAME); + public NaturalLanguageUnderstanding(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `NaturalLanguageUnderstanding` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use NaturalLanguageUnderstanding(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public NaturalLanguageUnderstanding(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `NaturalLanguageUnderstanding` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public NaturalLanguageUnderstanding(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -123,7 +84,8 @@ public NaturalLanguageUnderstanding(String versionDate, AuthenticatorConfig auth * @return a {@link ServiceCall} with a response type of {@link AnalysisResults} */ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { - Validator.notNull(analyzeOptions, "analyzeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(analyzeOptions, + "analyzeOptions cannot be null"); String[] pathSegments = { "v1/analyze" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -133,7 +95,8 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("features", GsonSingleton.getGson().toJsonTree(analyzeOptions.features())); + contentJson.add("features", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(analyzeOptions + .features())); if (analyzeOptions.text() != null) { contentJson.addProperty("text", analyzeOptions.text()); } @@ -172,9 +135,7 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { * List models. * * Lists Watson Knowledge Studio [custom entities and relations - * models] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-customizing) + * models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) * that are deployed to your Natural Language Understanding service. * * @param listModelsOptions the {@link ListModelsOptions} containing the options for the call @@ -201,9 +162,7 @@ public ServiceCall listModels(ListModelsOptions listModelsOpt * List models. * * Lists Watson Knowledge Studio [custom entities and relations - * models] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-customizing) + * models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) * that are deployed to your Natural Language Understanding service. * * @return a {@link ServiceCall} with a response type of {@link ListModelsResults} @@ -221,7 +180,8 @@ public ServiceCall listModels() { * @return a {@link ServiceCall} with a response type of {@link DeleteModelResults} */ public ServiceCall deleteModel(DeleteModelOptions deleteModelOptions) { - Validator.notNull(deleteModelOptions, "deleteModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteModelOptions, + "deleteModelOptions cannot be null"); String[] pathSegments = { "v1/models" }; String[] pathParameters = { deleteModelOptions.modelId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResults.java index 4256c8a04fc..135b3c0f8e6 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsMetadata.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsMetadata.java index 1e2908455f3..2b33b95bb0c 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsMetadata.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsUsage.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsUsage.java index 5323fb2d5b6..b222df2b522 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsUsage.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalysisResultsUsage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java index ea12c5c4f4a..4d1d2c7d92c 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.natural_language_understanding.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The analyze options. @@ -195,7 +194,8 @@ public Builder limitTextCharacters(long limitTextCharacters) { } private AnalyzeOptions(Builder builder) { - Validator.notNull(builder.features, "features cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.features, + "features cannot be null"); features = builder.features; text = builder.text; html = builder.html; @@ -265,9 +265,7 @@ public String url() { * Gets the clean. * * Set this to `false` to disable webpage cleaning. To learn more about webpage cleaning, see the [Analyzing - * webpages] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-analyzing-webpages) + * webpages](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages) * documentation. * * @return the clean @@ -280,9 +278,7 @@ public Boolean clean() { * Gets the xpath. * * An [XPath - * query] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-analyzing-webpages#xpath) + * query](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages#xpath) * to perform on `html` or `url` input. Results of the query will be appended to the cleaned webpage text before it is * analyzed. To analyze only the results of the XPath query, set the `clean` parameter to `false`. * @@ -319,9 +315,7 @@ public Boolean returnAnalyzedText() { * * ISO 639-1 code that specifies the language of your text. This overrides automatic language detection. Language * support differs depending on the features you include in your analysis. See [Language - * support] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-language-support) + * support](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-language-support) * for more information. * * @return the language diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Author.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Author.java index 8c2cfa1a138..3d8c1ee9d12 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Author.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Author.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java index 1d3dc5dd865..e7515c41650 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -130,9 +130,7 @@ public Long limit() { * Gets the model. * * Enter a [custom - * model] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-customizing) + * model](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) * ID to override the standard categories model. * * @return the model diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesRelevantText.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesRelevantText.java index 310968c7e89..41a38489dc5 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesRelevantText.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesRelevantText.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java index 57ea3fb2724..7e4dc585ada 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -28,9 +28,7 @@ public class CategoriesResult extends GenericModel { * * The path to the category through the 5-level taxonomy hierarchy. For the complete list of categories, see the * [Categories - * hierarchy] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-categories#categories-hierarchy) + * hierarchy](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy) * documentation. * * @return the label diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResultExplanation.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResultExplanation.java index 1947931d0c1..dd2895bb220 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResultExplanation.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResultExplanation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsOptions.java index 0a18d637718..4adebc27834 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsResult.java index 46af521d75f..5b34adcdf82 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ConceptsResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelOptions.java index 661f383f892..318f5474938 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.natural_language_understanding.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteModel options. @@ -69,7 +68,8 @@ public Builder modelId(String modelId) { } private DeleteModelOptions(Builder builder) { - Validator.notEmpty(builder.modelId, "modelId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.modelId, + "modelId cannot be empty"); modelId = builder.modelId; } diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelResults.java index 8d3d2effbcd..b96b683d4a3 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DeleteModelResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DisambiguationResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DisambiguationResult.java index 874a8acf5d7..a129bd09342 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DisambiguationResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DisambiguationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentEmotionResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentEmotionResults.java index 4da701bd274..3bf761b1085 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentEmotionResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentEmotionResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentSentimentResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentSentimentResults.java index aa82f7214a6..9d6fa5611ae 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentSentimentResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/DocumentSentimentResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionOptions.java index 07276e8fa3b..90af98fedd0 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * Detects anger, disgust, fear, joy, or sadness that is conveyed in the content or by the context around target phrases @@ -64,7 +63,8 @@ public EmotionOptions build() { * @return the EmotionOptions builder */ public Builder addTargets(String targets) { - Validator.notNull(targets, "targets cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(targets, + "targets cannot be null"); if (this.targets == null) { this.targets = new ArrayList(); } diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionResult.java index 563bb77b1a2..8c0724844f1 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionScores.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionScores.java index be62317c23f..543b40950a0 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionScores.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EmotionScores.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java index f68d61e0332..720f9a267df 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,9 +16,7 @@ /** * Identifies people, cities, organizations, and other entities in the content. See [Entity types and - * subtypes] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-entity-types). + * subtypes](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-entity-types). * * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. * Arabic, Chinese, and Dutch are supported only through custom models. @@ -163,9 +161,7 @@ public Boolean mentions() { * Gets the model. * * Enter a [custom - * model] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-customizing) + * model](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) * ID to override the standard entity detection model. * * @return the model diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesResult.java index 3f04a697882..2a608080569 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntityMention.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntityMention.java index c62b095e926..f9075b9e19c 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntityMention.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntityMention.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/FeatureSentimentResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/FeatureSentimentResults.java index e07f8cd1a9e..103ac27b063 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/FeatureSentimentResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/FeatureSentimentResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java index 1c87e2a6ff8..8a7d76dde76 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -241,9 +241,7 @@ public EmotionOptions emotion() { * Gets the entities. * * Identifies people, cities, organizations, and other entities in the content. See [Entity types and - * subtypes] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-entity-types). + * subtypes](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-entity-types). * * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. * Arabic, Chinese, and Dutch are supported only through custom models. @@ -284,9 +282,7 @@ public MetadataOptions metadata() { * * Recognizes when two entities are related and identifies the type of relation. For example, an `awardedTo` relation * might connect the entities "Nobel Prize" and "Albert Einstein". See [Relation - * types] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-relations). + * types](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-relations). * * Supported languages: Arabic, English, German, Japanese, Korean, Spanish. Chinese, Dutch, French, Italian, and * Portuguese custom models are also supported. diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Feed.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Feed.java index dd7f7ac3b9e..4f6dda9d3c1 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Feed.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Feed.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsOptions.java index bf583d9b4c7..4a2296b9d3f 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsResult.java index 13e96ddce2c..b7bc9dd0a7f 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/KeywordsResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java index 19f0d216a02..e10e1bfbfe8 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsResults.java index 94c3e8a6ede..8e2f69ee5a5 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java index f6b60c8315c..97ad0ba785e 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -20,4 +20,39 @@ */ public class MetadataOptions extends GenericModel { + /** + * Builder. + */ + public static class Builder { + + private Builder(MetadataOptions metadataOptions) { + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MetadataOptions. + * + * @return the metadataOptions + */ + public MetadataOptions build() { + return new MetadataOptions(this); + } + } + + private MetadataOptions(Builder builder) { + } + + /** + * New builder. + * + * @return a MetadataOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } } diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java index 34d5798737d..2a83e3dc5f3 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationArgument.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationArgument.java index 6fc932e2765..dad3aaee53f 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationArgument.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationArgument.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationEntity.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationEntity.java index 01fad2931bf..7a4a35e6afd 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationEntity.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java index dc2cd026d8e..8a0efd7f432 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,8 +17,7 @@ /** * Recognizes when two entities are related and identifies the type of relation. For example, an `awardedTo` relation * might connect the entities "Nobel Prize" and "Albert Einstein". See [Relation - * types] - * (https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-relations). + * types](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-relations). * * Supported languages: Arabic, English, German, Japanese, Korean, Spanish. Chinese, Dutch, French, Italian, and * Portuguese custom models are also supported. @@ -81,9 +80,7 @@ public Builder newBuilder() { * Gets the model. * * Enter a [custom - * model] - * (https://cloud.ibm.com/docs/services/natural-language-understanding - * ?topic=natural-language-understanding-customizing) + * model](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) * ID to override the default model. * * @return the model diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsResult.java index 6084bba6830..6e95a29181a 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesEntity.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesEntity.java index c9a20947988..06912fc5e65 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesEntity.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesKeyword.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesKeyword.java index 72f45a98833..1bfa80511b7 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesKeyword.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesKeyword.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesOptions.java index ec0e2fbdbfe..b149012182d 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResult.java index 45f1bc04404..e1afff202c3 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultAction.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultAction.java index 031fdf0bda4..74a4fe2fce6 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultAction.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultObject.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultObject.java index dbc6a9c4bb7..dda782774d2 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultObject.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultObject.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultSubject.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultSubject.java index 4751d886028..eede1ce4ec2 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultSubject.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesResultSubject.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesVerb.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesVerb.java index 7846f726004..8f5e1d6fa5b 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesVerb.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SemanticRolesVerb.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentenceResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentenceResult.java index 6aae4c3e816..534996abad6 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentenceResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentenceResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentOptions.java index a7d1f28d62d..78a0d4c4258 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * Analyzes the general sentiment of your content or the sentiment toward specific target phrases. You can analyze @@ -63,7 +62,8 @@ public SentimentOptions build() { * @return the SentimentOptions builder */ public Builder addTargets(String targets) { - Validator.notNull(targets, "targets cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(targets, + "targets cannot be null"); if (this.targets == null) { this.targets = new ArrayList(); } diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentResult.java index 0ee179d65c1..9297fde2293 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SentimentResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptions.java index a38a28b16bc..6497f9ae659 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptionsTokens.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptionsTokens.java index 442afb82c90..7c5e3d93d0f 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptionsTokens.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxOptionsTokens.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -24,6 +24,70 @@ public class SyntaxOptionsTokens extends GenericModel { @SerializedName("part_of_speech") private Boolean partOfSpeech; + /** + * Builder. + */ + public static class Builder { + private Boolean lemma; + private Boolean partOfSpeech; + + private Builder(SyntaxOptionsTokens syntaxOptionsTokens) { + this.lemma = syntaxOptionsTokens.lemma; + this.partOfSpeech = syntaxOptionsTokens.partOfSpeech; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a SyntaxOptionsTokens. + * + * @return the syntaxOptionsTokens + */ + public SyntaxOptionsTokens build() { + return new SyntaxOptionsTokens(this); + } + + /** + * Set the lemma. + * + * @param lemma the lemma + * @return the SyntaxOptionsTokens builder + */ + public Builder lemma(Boolean lemma) { + this.lemma = lemma; + return this; + } + + /** + * Set the partOfSpeech. + * + * @param partOfSpeech the partOfSpeech + * @return the SyntaxOptionsTokens builder + */ + public Builder partOfSpeech(Boolean partOfSpeech) { + this.partOfSpeech = partOfSpeech; + return this; + } + } + + private SyntaxOptionsTokens(Builder builder) { + lemma = builder.lemma; + partOfSpeech = builder.partOfSpeech; + } + + /** + * New builder. + * + * @return a SyntaxOptionsTokens builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the lemma. * @@ -31,7 +95,7 @@ public class SyntaxOptionsTokens extends GenericModel { * * @return the lemma */ - public Boolean isLemma() { + public Boolean lemma() { return lemma; } @@ -42,7 +106,7 @@ public Boolean isLemma() { * * @return the partOfSpeech */ - public Boolean isPartOfSpeech() { + public Boolean partOfSpeech() { return partOfSpeech; } } diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxResult.java index 3c5f4c75652..e2417054c04 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/SyntaxResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedEmotionResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedEmotionResults.java index 44e32cb9974..98ab17fbe25 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedEmotionResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedEmotionResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedSentimentResults.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedSentimentResults.java index 18c1f12df6e..3a58e59beaf 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedSentimentResults.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TargetedSentimentResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java index fd97842c3bc..549a9984387 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/package-info.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/package-info.java index 0703fc1ce92..355236ae4cf 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/package-info.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java index 77eeb367adb..d8f185a4e77 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -15,14 +15,12 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.personality_insights.v3.model.Profile; import com.ibm.watson.personality_insights.v3.model.ProfileOptions; - import java.io.InputStream; import java.util.Map; import java.util.Map.Entry; @@ -40,15 +38,14 @@ * [Personality * models](https://cloud.ibm.com/docs/services/personality-insights?topic=personality-insights-models#models). * * For information about the meaning of the consumption preferences, see [Consumption - * preferences] - * (https://cloud.ibm.com/docs/services/personality-insights?topic=personality-insights-preferences#preferences). + * preferences](https://cloud.ibm.com/docs/services/personality-insights?topic=personality-insights-preferences#preferences). * * * **Note:** Request logging is disabled for the Personality Insights service. Regardless of whether you set the * `X-Watson-Learning-Opt-Out` request header, the service does not log or retain data from requests and responses. * * @version v3 - * @see Personality Insights + * @see Personality Insights */ public class PersonalityInsights extends BaseService { @@ -58,54 +55,19 @@ public class PersonalityInsights extends BaseService { private String versionDate; /** - * Instantiates a new `PersonalityInsights`. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @deprecated Use PersonalityInsights(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public PersonalityInsights(String versionDate) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `PersonalityInsights` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use PersonalityInsights(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public PersonalityInsights(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `PersonalityInsights` with the specified authentication configuration. + * Constructs a new `PersonalityInsights` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service + * @param authenticator the Authenticator instance to be configured for this service */ - public PersonalityInsights(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); + public PersonalityInsights(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -152,7 +114,8 @@ public PersonalityInsights(String versionDate, AuthenticatorConfig authenticator * @return a {@link ServiceCall} with a response type of {@link Profile} */ public ServiceCall profile(ProfileOptions profileOptions) { - Validator.notNull(profileOptions, "profileOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(profileOptions, + "profileOptions cannot be null"); String[] pathSegments = { "v3/profile" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -161,15 +124,15 @@ public ServiceCall profile(ProfileOptions profileOptions) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); + if (profileOptions.contentType() != null) { + builder.header("Content-Type", profileOptions.contentType()); + } if (profileOptions.contentLanguage() != null) { builder.header("Content-Language", profileOptions.contentLanguage()); } if (profileOptions.acceptLanguage() != null) { builder.header("Accept-Language", profileOptions.acceptLanguage()); } - if (profileOptions.contentType() != null) { - builder.header("Content-Type", profileOptions.contentType()); - } if (profileOptions.rawScores() != null) { builder.query("raw_scores", String.valueOf(profileOptions.rawScores())); } @@ -179,7 +142,8 @@ public ServiceCall profile(ProfileOptions profileOptions) { if (profileOptions.consumptionPreferences() != null) { builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences())); } - builder.bodyContent(profileOptions.contentType(), profileOptions.content(), null, profileOptions.body()); + builder.bodyContent(profileOptions.contentType(), profileOptions.content(), + null, profileOptions.body()); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { }.getType()); @@ -229,7 +193,8 @@ public ServiceCall profile(ProfileOptions profileOptions) { * @return a {@link ServiceCall} with a response type of {@link String} */ public ServiceCall profileAsCsv(ProfileOptions profileOptions) { - Validator.notNull(profileOptions, "profileOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(profileOptions, + "profileOptions cannot be null"); String[] pathSegments = { "v3/profile" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -238,15 +203,15 @@ public ServiceCall profileAsCsv(ProfileOptions profileOptions) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "text/csv"); + if (profileOptions.contentType() != null) { + builder.header("Content-Type", profileOptions.contentType()); + } if (profileOptions.contentLanguage() != null) { builder.header("Content-Language", profileOptions.contentLanguage()); } if (profileOptions.acceptLanguage() != null) { builder.header("Accept-Language", profileOptions.acceptLanguage()); } - if (profileOptions.contentType() != null) { - builder.header("Content-Type", profileOptions.contentType()); - } if (profileOptions.rawScores() != null) { builder.query("raw_scores", String.valueOf(profileOptions.rawScores())); } @@ -256,7 +221,8 @@ public ServiceCall profileAsCsv(ProfileOptions profileOptions) { if (profileOptions.consumptionPreferences() != null) { builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences())); } - builder.bodyContent(profileOptions.contentType(), profileOptions.content(), null, profileOptions.body()); + builder.bodyContent(profileOptions.contentType(), profileOptions.content(), + null, profileOptions.body()); ResponseConverter responseConverter = ResponseConverterUtils.getInputStream(); return createServiceCall(builder.build(), responseConverter); } diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Behavior.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Behavior.java index e0d12b13da6..c2ab427bed4 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Behavior.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Behavior.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferences.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferences.java index 2482ed95311..0728731a15f 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferences.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferences.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferencesCategory.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferencesCategory.java index 65fac525319..dfda3551505 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferencesCategory.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ConsumptionPreferencesCategory.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Content.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Content.java index 7d752f7f0f7..44c80ca77eb 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Content.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Content.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The full input content that the service is to analyze. @@ -66,7 +65,8 @@ public Content build() { * @return the Content builder */ public Builder addContentItem(ContentItem contentItem) { - Validator.notNull(contentItem, "contentItem cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(contentItem, + "contentItem cannot be null"); if (this.contentItems == null) { this.contentItems = new ArrayList(); } @@ -88,7 +88,8 @@ public Builder contentItems(List contentItems) { } private Content(Builder builder) { - Validator.notNull(builder.contentItems, "contentItems cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.contentItems, + "contentItems cannot be null"); contentItems = builder.contentItems; } diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ContentItem.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ContentItem.java index 521406a0bd7..0d4ebca5bb5 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ContentItem.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ContentItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.personality_insights.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * An input content item that the service is to analyze. @@ -213,7 +212,8 @@ public Builder forward(Boolean forward) { } private ContentItem(Builder builder) { - Validator.notNull(builder.content, "content cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.content, + "content cannot be null"); content = builder.content; id = builder.id; created = builder.created; diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Profile.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Profile.java index 2dbbec66891..dd35cce3bdc 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Profile.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Profile.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ProfileOptions.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ProfileOptions.java index f7ea79833dd..aef0de64492 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ProfileOptions.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/ProfileOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -19,6 +19,18 @@ */ public class ProfileOptions extends GenericModel { + /** + * The type of the input. For more information, see **Content types** in the method description. + */ + public interface ContentType { + /** application/json. */ + String APPLICATION_JSON = "application/json"; + /** text/html. */ + String TEXT_HTML = "text/html"; + /** text/plain. */ + String TEXT_PLAIN = "text/plain"; + } + /** * The language of the input text for the request: Arabic, English, Japanese, Korean, or Spanish. Regional variants * are treated as their parent language; for example, `en-US` is interpreted as `en`. @@ -73,28 +85,14 @@ public interface AcceptLanguage { String ZH_TW = "zh-tw"; } - /** - * The type of the input. For more information, see **Content types** in the method description. - * - * Default: `text/plain`. - */ - public interface ContentType { - /** application/json. */ - String APPLICATION_JSON = "application/json"; - /** text/html. */ - String TEXT_HTML = "text/html"; - /** text/plain. */ - String TEXT_PLAIN = "text/plain"; - } - private Content content; private String body; + private String contentType; private String contentLanguage; private String acceptLanguage; private Boolean rawScores; private Boolean csvHeaders; private Boolean consumptionPreferences; - private String contentType; /** * Builder. @@ -102,22 +100,22 @@ public interface ContentType { public static class Builder { private Content content; private String body; + private String contentType; private String contentLanguage; private String acceptLanguage; private Boolean rawScores; private Boolean csvHeaders; private Boolean consumptionPreferences; - private String contentType; private Builder(ProfileOptions profileOptions) { this.content = profileOptions.content; this.body = profileOptions.body; + this.contentType = profileOptions.contentType; this.contentLanguage = profileOptions.contentLanguage; this.acceptLanguage = profileOptions.acceptLanguage; this.rawScores = profileOptions.rawScores; this.csvHeaders = profileOptions.csvHeaders; this.consumptionPreferences = profileOptions.consumptionPreferences; - this.contentType = profileOptions.contentType; } /** @@ -198,7 +196,7 @@ public Builder consumptionPreferences(Boolean consumptionPreferences) { */ public Builder content(Content content) { this.content = content; - this.contentType = ProfileOptions.ContentType.APPLICATION_JSON; + this.contentType = "application/json"; return this; } @@ -210,7 +208,7 @@ public Builder content(Content content) { */ public Builder html(String html) { this.body = html; - this.contentType = ProfileOptions.ContentType.TEXT_HTML; + this.contentType = "text/html"; return this; } @@ -222,7 +220,7 @@ public Builder html(String html) { */ public Builder text(String text) { this.body = text; - this.contentType = ProfileOptions.ContentType.TEXT_PLAIN; + this.contentType = "text/plain"; return this; } } @@ -230,12 +228,12 @@ public Builder text(String text) { private ProfileOptions(Builder builder) { content = builder.content; body = builder.body; + contentType = builder.contentType; contentLanguage = builder.contentLanguage; acceptLanguage = builder.acceptLanguage; rawScores = builder.rawScores; csvHeaders = builder.csvHeaders; consumptionPreferences = builder.consumptionPreferences; - contentType = builder.contentType; } /** @@ -275,6 +273,17 @@ public String body() { return body; } + /** + * Gets the contentType. + * + * The type of the input. For more information, see **Content types** in the method description. + * + * @return the contentType + */ + public String contentType() { + return contentType; + } + /** * Gets the contentLanguage. * @@ -342,17 +351,4 @@ public Boolean csvHeaders() { public Boolean consumptionPreferences() { return consumptionPreferences; } - - /** - * Gets the contentType. - * - * The type of the input. For more information, see **Content types** in the method description. - * - * Default: `text/plain`. - * - * @return the contentType - */ - public String contentType() { - return contentType; - } } diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Trait.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Trait.java index 840f4391726..023d0e974ac 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Trait.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Trait.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Warning.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Warning.java index 4bb69f4a982..33842b0ede6 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Warning.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/model/Warning.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/package-info.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/package-info.java index ae349fee5bd..1a4984513b7 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/package-info.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index aa8ec7c8eb1..60214e2af8e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,12 +16,10 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.speech_to_text.v1.model.AcousticModel; import com.ibm.watson.speech_to_text.v1.model.AcousticModels; @@ -83,15 +81,9 @@ import com.ibm.watson.speech_to_text.v1.model.UpgradeLanguageModelOptions; import com.ibm.watson.speech_to_text.v1.model.Word; import com.ibm.watson.speech_to_text.v1.model.Words; -import com.ibm.watson.speech_to_text.v1.websocket.RecognizeCallback; -import com.ibm.watson.speech_to_text.v1.websocket.SpeechToTextWebSocketListener; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.WebSocket; - import java.util.Map; import java.util.Map.Entry; +import okhttp3.MultipartBody; /** * The IBM® Speech to Text service provides APIs that use IBM's speech-recognition capabilities to produce @@ -113,7 +105,7 @@ * customization is beta functionality that is available for all supported languages. * * @version v1 - * @see Speech to Text + * @see Speech to Text */ public class SpeechToText extends BaseService { @@ -121,44 +113,17 @@ public class SpeechToText extends BaseService { private static final String URL = "https://stream.watsonplatform.net/speech-to-text/api"; /** - * Instantiates a new `SpeechToText`. + * Constructs a new `SpeechToText` client with the specified Authenticator. * - * @deprecated Use SpeechToText(AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public SpeechToText() { - super(SERVICE_NAME); + public SpeechToText(Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } } - /** - * Instantiates a new `SpeechToText` with username and password. - * - * @param username the username - * @param password the password - * @deprecated Use SpeechToText(AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public SpeechToText(String username, String password) { - this(); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `SpeechToText` with the specified authentication configuration. - * - * @param authenticatorConfig the authentication configuration for this service - */ - public SpeechToText(AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - } - /** * List models. * @@ -215,7 +180,8 @@ public ServiceCall listModels() { * @return a {@link ServiceCall} with a response type of {@link SpeechModel} */ public ServiceCall getModel(GetModelOptions getModelOptions) { - Validator.notNull(getModelOptions, "getModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getModelOptions, + "getModelOptions cannot be null"); String[] pathSegments = { "v1/models" }; String[] pathParameters = { getModelOptions.modelId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -262,7 +228,7 @@ public ServiceCall getModel(GetModelOptions getModelOptions) { * format of the audio. * * For all other formats, you can omit the `Content-Type` header or specify `application/octet-stream` with the * header to have the service automatically detect the format of the audio. (With the `curl` command, you can specify - * either `\"Content-Type:\"` or `\"Content-Type: application/octet-stream\"`.) + * either `"Content-Type:"` or `"Content-Type: application/octet-stream"`.) * * Where indicated, the format that you specify must include the sampling rate and can optionally include the number * of channels and the endianness of the audio. @@ -311,7 +277,8 @@ public ServiceCall getModel(GetModelOptions getModelOptions) { * @return a {@link ServiceCall} with a response type of {@link SpeechRecognitionResults} */ public ServiceCall recognize(RecognizeOptions recognizeOptions) { - Validator.notNull(recognizeOptions, "recognizeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(recognizeOptions, + "recognizeOptions cannot be null"); String[] pathSegments = { "v1/recognize" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "recognize"); @@ -379,7 +346,8 @@ public ServiceCall recognize(RecognizeOptions recogniz if (recognizeOptions.audioMetrics() != null) { builder.query("audio_metrics", String.valueOf(recognizeOptions.audioMetrics())); } - builder.bodyContent(recognizeOptions.contentType(), null, null, recognizeOptions.audio()); + builder.bodyContent(recognizeOptions.contentType(), null, + null, recognizeOptions.audio()); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { }.getType()); @@ -421,7 +389,8 @@ public ServiceCall recognize(RecognizeOptions recogniz * @return a {@link ServiceCall} with a response type of {@link RegisterStatus} */ public ServiceCall registerCallback(RegisterCallbackOptions registerCallbackOptions) { - Validator.notNull(registerCallbackOptions, "registerCallbackOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(registerCallbackOptions, + "registerCallbackOptions cannot be null"); String[] pathSegments = { "v1/register_callback" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "registerCallback"); @@ -452,7 +421,8 @@ public ServiceCall registerCallback(RegisterCallbackOptions regi * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall unregisterCallback(UnregisterCallbackOptions unregisterCallbackOptions) { - Validator.notNull(unregisterCallbackOptions, "unregisterCallbackOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(unregisterCallbackOptions, + "unregisterCallbackOptions cannot be null"); String[] pathSegments = { "v1/unregister_callback" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "unregisterCallback"); @@ -518,7 +488,7 @@ public ServiceCall unregisterCallback(UnregisterCallbackOptions unregister * format of the audio. * * For all other formats, you can omit the `Content-Type` header or specify `application/octet-stream` with the * header to have the service automatically detect the format of the audio. (With the `curl` command, you can specify - * either `\"Content-Type:\"` or `\"Content-Type: application/octet-stream\"`.) + * either `"Content-Type:"` or `"Content-Type: application/octet-stream"`.) * * Where indicated, the format that you specify must include the sampling rate and can optionally include the number * of channels and the endianness of the audio. @@ -551,7 +521,8 @@ public ServiceCall unregisterCallback(UnregisterCallbackOptions unregister * @return a {@link ServiceCall} with a response type of {@link RecognitionJob} */ public ServiceCall createJob(CreateJobOptions createJobOptions) { - Validator.notNull(createJobOptions, "createJobOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createJobOptions, + "createJobOptions cannot be null"); String[] pathSegments = { "v1/recognitions" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createJob"); @@ -637,7 +608,8 @@ public ServiceCall createJob(CreateJobOptions createJobOptions) if (createJobOptions.audioMetrics() != null) { builder.query("audio_metrics", String.valueOf(createJobOptions.audioMetrics())); } - builder.bodyContent(createJobOptions.contentType(), null, null, createJobOptions.audio()); + builder.bodyContent(createJobOptions.contentType(), null, + null, createJobOptions.audio()); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { }.getType()); @@ -695,54 +667,6 @@ public ServiceCall checkJobs() { return checkJobs(null); } - /** - * Sends audio and returns transcription results for recognition requests over a WebSocket connection. Requests and - * responses are enabled over a single TCP connection that abstracts much of the complexity of the request to offer - * efficient implementation, low latency, high throughput, and an asynchronous response. By default, only final - * results are returned for any request; to enable interim results, set the interimResults parameter to true. - * - * The service imposes a data size limit of 100 MB per utterance (per recognition request). You can send multiple - * utterances over a single WebSocket connection. The service automatically detects the endianness of the incoming - * audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding. - * (For the audio/l16 format, you can specify the endianness.) - * - * @param recognizeOptions the recognize options - * @param callback the {@link RecognizeCallback} instance where results will be sent - * @return the {@link WebSocket} - */ - public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, RecognizeCallback callback) { - Validator.notNull(recognizeOptions, "recognizeOptions cannot be null"); - Validator.notNull(recognizeOptions.audio(), "audio cannot be null"); - Validator.notNull(callback, "callback cannot be null"); - - HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/recognize").newBuilder(); - - if (recognizeOptions.model() != null) { - urlBuilder.addQueryParameter("model", recognizeOptions.model()); - } - if (recognizeOptions.customizationId() != null) { - urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId()); - } - if (recognizeOptions.languageCustomizationId() != null) { - urlBuilder.addQueryParameter("language_customization_id", recognizeOptions.languageCustomizationId()); - } - if (recognizeOptions.acousticCustomizationId() != null) { - urlBuilder.addQueryParameter("acoustic_customization_id", recognizeOptions.acousticCustomizationId()); - } - if (recognizeOptions.baseModelVersion() != null) { - urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion()); - } - - String url = urlBuilder.toString().replace("https://", "wss://"); - Request.Builder builder = new Request.Builder().url(url); - - setAuthentication(builder); - setDefaultHeaders(builder); - - OkHttpClient client = configureHttpClient(); - return client.newWebSocket(builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback)); - } - /** * Check a job. * @@ -762,7 +686,8 @@ public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, Reco * @return a {@link ServiceCall} with a response type of {@link RecognitionJob} */ public ServiceCall checkJob(CheckJobOptions checkJobOptions) { - Validator.notNull(checkJobOptions, "checkJobOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(checkJobOptions, + "checkJobOptions cannot be null"); String[] pathSegments = { "v1/recognitions" }; String[] pathParameters = { checkJobOptions.id() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -792,7 +717,8 @@ public ServiceCall checkJob(CheckJobOptions checkJobOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteJob(DeleteJobOptions deleteJobOptions) { - Validator.notNull(deleteJobOptions, "deleteJobOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteJobOptions, + "deleteJobOptions cannot be null"); String[] pathSegments = { "v1/recognitions" }; String[] pathParameters = { deleteJobOptions.id() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -813,14 +739,14 @@ public ServiceCall deleteJob(DeleteJobOptions deleteJobOptions) { * create it. * * **See also:** [Create a custom language - * model] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#createModel-language). + * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#createModel-language). * * @param createLanguageModelOptions the {@link CreateLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LanguageModel} */ public ServiceCall createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions) { - Validator.notNull(createLanguageModelOptions, "createLanguageModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createLanguageModelOptions, + "createLanguageModelOptions cannot be null"); String[] pathSegments = { "v1/customizations" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createLanguageModel"); @@ -853,8 +779,7 @@ public ServiceCall createLanguageModel(CreateLanguageModelOptions * list information about it. * * **See also:** [Listing custom language - * models] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). + * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). * * @param listLanguageModelsOptions the {@link ListLanguageModelsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LanguageModels} @@ -887,8 +812,7 @@ public ServiceCall listLanguageModels(ListLanguageModelsOptions * list information about it. * * **See also:** [Listing custom language - * models] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). + * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). * * @return a {@link ServiceCall} with a response type of {@link LanguageModels} */ @@ -903,14 +827,14 @@ public ServiceCall listLanguageModels() { * that owns a model to list information about it. * * **See also:** [Listing custom language - * models] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). + * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). * * @param getLanguageModelOptions the {@link GetLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LanguageModel} */ public ServiceCall getLanguageModel(GetLanguageModelOptions getLanguageModelOptions) { - Validator.notNull(getLanguageModelOptions, "getLanguageModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getLanguageModelOptions, + "getLanguageModelOptions cannot be null"); String[] pathSegments = { "v1/customizations" }; String[] pathParameters = { getLanguageModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -934,15 +858,14 @@ public ServiceCall getLanguageModel(GetLanguageModelOptions getLa * service that owns a model to delete it. * * **See also:** [Deleting a custom language - * model] - * (https://cloud.ibm.com/docs/services/speech-to-text - * ?topic=speech-to-text-manageLanguageModels#deleteModel-language). + * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#deleteModel-language). * * @param deleteLanguageModelOptions the {@link DeleteLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteLanguageModel(DeleteLanguageModelOptions deleteLanguageModelOptions) { - Validator.notNull(deleteLanguageModelOptions, "deleteLanguageModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteLanguageModelOptions, + "deleteLanguageModelOptions cannot be null"); String[] pathSegments = { "v1/customizations" }; String[] pathParameters = { deleteLanguageModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -985,12 +908,17 @@ public ServiceCall deleteLanguageModel(DeleteLanguageModelOptions deleteLa * * The service is currently handling another request for the custom model, such as another training request or a * request to add a corpus or grammar to the model. * * No training data have been added to the custom model. + * * The custom model contains one or more invalid corpora, grammars, or words (for example, a custom word has an + * invalid sounds-like pronunciation). You can correct the invalid resources or set the `strict` parameter to `false` + * to exclude the invalid resources from the training. The model must contain at least one valid resource for training + * to succeed. * * @param trainLanguageModelOptions the {@link TrainLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingResponse} */ public ServiceCall trainLanguageModel(TrainLanguageModelOptions trainLanguageModelOptions) { - Validator.notNull(trainLanguageModelOptions, "trainLanguageModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(trainLanguageModelOptions, + "trainLanguageModelOptions cannot be null"); String[] pathSegments = { "v1/customizations", "train" }; String[] pathParameters = { trainLanguageModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1021,14 +949,14 @@ public ServiceCall trainLanguageModel(TrainLanguageModelOption * credentials for the instance of the service that owns a model to reset it. * * **See also:** [Resetting a custom language - * model] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#resetModel-language). + * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#resetModel-language). * * @param resetLanguageModelOptions the {@link ResetLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall resetLanguageModel(ResetLanguageModelOptions resetLanguageModelOptions) { - Validator.notNull(resetLanguageModelOptions, "resetLanguageModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(resetLanguageModelOptions, + "resetLanguageModelOptions cannot be null"); String[] pathSegments = { "v1/customizations", "reset" }; String[] pathParameters = { resetLanguageModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1064,7 +992,8 @@ public ServiceCall resetLanguageModel(ResetLanguageModelOptions resetLangu * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall upgradeLanguageModel(UpgradeLanguageModelOptions upgradeLanguageModelOptions) { - Validator.notNull(upgradeLanguageModelOptions, "upgradeLanguageModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(upgradeLanguageModelOptions, + "upgradeLanguageModelOptions cannot be null"); String[] pathSegments = { "v1/customizations", "upgrade_model" }; String[] pathParameters = { upgradeLanguageModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1092,7 +1021,8 @@ public ServiceCall upgradeLanguageModel(UpgradeLanguageModelOptions upgrad * @return a {@link ServiceCall} with a response type of {@link Corpora} */ public ServiceCall listCorpora(ListCorporaOptions listCorporaOptions) { - Validator.notNull(listCorporaOptions, "listCorporaOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listCorporaOptions, + "listCorporaOptions cannot be null"); String[] pathSegments = { "v1/customizations", "corpora" }; String[] pathParameters = { listCorporaOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1152,7 +1082,8 @@ public ServiceCall listCorpora(ListCorporaOptions listCorporaOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { - Validator.notNull(addCorpusOptions, "addCorpusOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addCorpusOptions, + "addCorpusOptions cannot be null"); String[] pathSegments = { "v1/customizations", "corpora" }; String[] pathParameters = { addCorpusOptions.customizationId(), addCorpusOptions.corpusName() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1165,7 +1096,11 @@ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { if (addCorpusOptions.allowOverwrite() != null) { builder.query("allow_overwrite", String.valueOf(addCorpusOptions.allowOverwrite())); } - builder.body(RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain")); + MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); + multipartBuilder.setType(MultipartBody.FORM); + okhttp3.RequestBody corpusFileBody = RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain"); + multipartBuilder.addFormDataPart("corpus_file", "filename", corpusFileBody); + builder.body(multipartBuilder.build()); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } @@ -1184,7 +1119,8 @@ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { * @return a {@link ServiceCall} with a response type of {@link Corpus} */ public ServiceCall getCorpus(GetCorpusOptions getCorpusOptions) { - Validator.notNull(getCorpusOptions, "getCorpusOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getCorpusOptions, + "getCorpusOptions cannot be null"); String[] pathSegments = { "v1/customizations", "corpora" }; String[] pathParameters = { getCorpusOptions.customizationId(), getCorpusOptions.corpusName() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1216,7 +1152,8 @@ public ServiceCall getCorpus(GetCorpusOptions getCorpusOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteCorpus(DeleteCorpusOptions deleteCorpusOptions) { - Validator.notNull(deleteCorpusOptions, "deleteCorpusOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCorpusOptions, + "deleteCorpusOptions cannot be null"); String[] pathSegments = { "v1/customizations", "corpora" }; String[] pathParameters = { deleteCorpusOptions.customizationId(), deleteCorpusOptions.corpusName() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1246,7 +1183,8 @@ public ServiceCall deleteCorpus(DeleteCorpusOptions deleteCorpusOptions) { * @return a {@link ServiceCall} with a response type of {@link Words} */ public ServiceCall listWords(ListWordsOptions listWordsOptions) { - Validator.notNull(listWordsOptions, "listWordsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listWordsOptions, + "listWordsOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { listWordsOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1319,7 +1257,8 @@ public ServiceCall listWords(ListWordsOptions listWordsOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall addWords(AddWordsOptions addWordsOptions) { - Validator.notNull(addWordsOptions, "addWordsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addWordsOptions, + "addWordsOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { addWordsOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1330,7 +1269,7 @@ public ServiceCall addWords(AddWordsOptions addWordsOptions) { } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("words", GsonSingleton.getGson().toJsonTree(addWordsOptions.words())); + contentJson.add("words", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(addWordsOptions.words())); builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); @@ -1373,7 +1312,8 @@ public ServiceCall addWords(AddWordsOptions addWordsOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall addWord(AddWordOptions addWordOptions) { - Validator.notNull(addWordOptions, "addWordOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addWordOptions, + "addWordOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { addWordOptions.customizationId(), addWordOptions.wordName() }; RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1388,7 +1328,8 @@ public ServiceCall addWord(AddWordOptions addWordOptions) { contentJson.addProperty("word", addWordOptions.word()); } if (addWordOptions.soundsLike() != null) { - contentJson.add("sounds_like", GsonSingleton.getGson().toJsonTree(addWordOptions.soundsLike())); + contentJson.add("sounds_like", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(addWordOptions + .soundsLike())); } if (addWordOptions.displayAs() != null) { contentJson.addProperty("display_as", addWordOptions.displayAs()); @@ -1411,7 +1352,8 @@ public ServiceCall addWord(AddWordOptions addWordOptions) { * @return a {@link ServiceCall} with a response type of {@link Word} */ public ServiceCall getWord(GetWordOptions getWordOptions) { - Validator.notNull(getWordOptions, "getWordOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getWordOptions, + "getWordOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { getWordOptions.customizationId(), getWordOptions.wordName() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1443,7 +1385,8 @@ public ServiceCall getWord(GetWordOptions getWordOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { - Validator.notNull(deleteWordOptions, "deleteWordOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteWordOptions, + "deleteWordOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { deleteWordOptions.customizationId(), deleteWordOptions.wordName() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1471,7 +1414,8 @@ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { * @return a {@link ServiceCall} with a response type of {@link Grammars} */ public ServiceCall listGrammars(ListGrammarsOptions listGrammarsOptions) { - Validator.notNull(listGrammarsOptions, "listGrammarsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listGrammarsOptions, + "listGrammarsOptions cannot be null"); String[] pathSegments = { "v1/customizations", "grammars" }; String[] pathParameters = { listGrammarsOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1518,8 +1462,7 @@ public ServiceCall listGrammars(ListGrammarsOptions listGrammarsOption * * **See also:** * * [Understanding - * grammars] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarUnderstand#grammarUnderstand) + * grammars](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarUnderstand#grammarUnderstand) * * [Add a grammar to the custom language * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarAdd#addGrammar). * @@ -1527,7 +1470,8 @@ public ServiceCall listGrammars(ListGrammarsOptions listGrammarsOption * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall addGrammar(AddGrammarOptions addGrammarOptions) { - Validator.notNull(addGrammarOptions, "addGrammarOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addGrammarOptions, + "addGrammarOptions cannot be null"); String[] pathSegments = { "v1/customizations", "grammars" }; String[] pathParameters = { addGrammarOptions.customizationId(), addGrammarOptions.grammarName() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1541,7 +1485,8 @@ public ServiceCall addGrammar(AddGrammarOptions addGrammarOptions) { if (addGrammarOptions.allowOverwrite() != null) { builder.query("allow_overwrite", String.valueOf(addGrammarOptions.allowOverwrite())); } - builder.bodyContent(addGrammarOptions.contentType(), null, null, addGrammarOptions.grammarFile()); + builder.bodyContent(addGrammarOptions.contentType(), null, + null, addGrammarOptions.grammarFile()); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } @@ -1560,7 +1505,8 @@ public ServiceCall addGrammar(AddGrammarOptions addGrammarOptions) { * @return a {@link ServiceCall} with a response type of {@link Grammar} */ public ServiceCall getGrammar(GetGrammarOptions getGrammarOptions) { - Validator.notNull(getGrammarOptions, "getGrammarOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getGrammarOptions, + "getGrammarOptions cannot be null"); String[] pathSegments = { "v1/customizations", "grammars" }; String[] pathParameters = { getGrammarOptions.customizationId(), getGrammarOptions.grammarName() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1592,7 +1538,8 @@ public ServiceCall getGrammar(GetGrammarOptions getGrammarOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteGrammar(DeleteGrammarOptions deleteGrammarOptions) { - Validator.notNull(deleteGrammarOptions, "deleteGrammarOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteGrammarOptions, + "deleteGrammarOptions cannot be null"); String[] pathSegments = { "v1/customizations", "grammars" }; String[] pathParameters = { deleteGrammarOptions.customizationId(), deleteGrammarOptions.grammarName() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1620,7 +1567,8 @@ public ServiceCall deleteGrammar(DeleteGrammarOptions deleteGrammarOptions * @return a {@link ServiceCall} with a response type of {@link AcousticModel} */ public ServiceCall createAcousticModel(CreateAcousticModelOptions createAcousticModelOptions) { - Validator.notNull(createAcousticModelOptions, "createAcousticModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createAcousticModelOptions, + "createAcousticModelOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createAcousticModel"); @@ -1650,8 +1598,7 @@ public ServiceCall createAcousticModel(CreateAcousticModelOptions * list information about it. * * **See also:** [Listing custom acoustic - * models] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). + * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). * * @param listAcousticModelsOptions the {@link ListAcousticModelsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link AcousticModels} @@ -1684,8 +1631,7 @@ public ServiceCall listAcousticModels(ListAcousticModelsOptions * list information about it. * * **See also:** [Listing custom acoustic - * models] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). + * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). * * @return a {@link ServiceCall} with a response type of {@link AcousticModels} */ @@ -1700,14 +1646,14 @@ public ServiceCall listAcousticModels() { * that owns a model to list information about it. * * **See also:** [Listing custom acoustic - * models] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). + * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). * * @param getAcousticModelOptions the {@link GetAcousticModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link AcousticModel} */ public ServiceCall getAcousticModel(GetAcousticModelOptions getAcousticModelOptions) { - Validator.notNull(getAcousticModelOptions, "getAcousticModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getAcousticModelOptions, + "getAcousticModelOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations" }; String[] pathParameters = { getAcousticModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1731,15 +1677,14 @@ public ServiceCall getAcousticModel(GetAcousticModelOptions getAc * that owns a model to delete it. * * **See also:** [Deleting a custom acoustic - * model] - * (https://cloud.ibm.com/docs/services/speech-to-text - * ?topic=speech-to-text-manageAcousticModels#deleteModel-acoustic). + * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#deleteModel-acoustic). * * @param deleteAcousticModelOptions the {@link DeleteAcousticModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteAcousticModel(DeleteAcousticModelOptions deleteAcousticModelOptions) { - Validator.notNull(deleteAcousticModelOptions, "deleteAcousticModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAcousticModelOptions, + "deleteAcousticModelOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations" }; String[] pathParameters = { deleteAcousticModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1794,12 +1739,16 @@ public ServiceCall deleteAcousticModel(DeleteAcousticModelOptions deleteAc * * The custom model contains less than 10 minutes or more than 200 hours of audio data. * * You passed an incompatible custom language model with the `custom_language_model_id` query parameter. Both custom * models must be based on the same version of the same base model. + * * The custom model contains one or more invalid audio resources. You can correct the invalid audio resources or set + * the `strict` parameter to `false` to exclude the invalid resources from the training. The model must contain at + * least one valid resource for training to succeed. * * @param trainAcousticModelOptions the {@link TrainAcousticModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingResponse} */ public ServiceCall trainAcousticModel(TrainAcousticModelOptions trainAcousticModelOptions) { - Validator.notNull(trainAcousticModelOptions, "trainAcousticModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(trainAcousticModelOptions, + "trainAcousticModelOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "train" }; String[] pathParameters = { trainAcousticModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1829,14 +1778,14 @@ public ServiceCall trainAcousticModel(TrainAcousticModelOption * model to reset it. * * **See also:** [Resetting a custom acoustic - * model] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#resetModel-acoustic). + * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#resetModel-acoustic). * * @param resetAcousticModelOptions the {@link ResetAcousticModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions) { - Validator.notNull(resetAcousticModelOptions, "resetAcousticModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(resetAcousticModelOptions, + "resetAcousticModelOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "reset" }; String[] pathParameters = { resetAcousticModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1879,7 +1828,8 @@ public ServiceCall resetAcousticModel(ResetAcousticModelOptions resetAcous * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall upgradeAcousticModel(UpgradeAcousticModelOptions upgradeAcousticModelOptions) { - Validator.notNull(upgradeAcousticModelOptions, "upgradeAcousticModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(upgradeAcousticModelOptions, + "upgradeAcousticModelOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "upgrade_model" }; String[] pathParameters = { upgradeAcousticModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1915,7 +1865,8 @@ public ServiceCall upgradeAcousticModel(UpgradeAcousticModelOptions upgrad * @return a {@link ServiceCall} with a response type of {@link AudioResources} */ public ServiceCall listAudio(ListAudioOptions listAudioOptions) { - Validator.notNull(listAudioOptions, "listAudioOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listAudioOptions, + "listAudioOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "audio" }; String[] pathParameters = { listAudioOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2024,7 +1975,8 @@ public ServiceCall listAudio(ListAudioOptions listAudioOptions) * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall addAudio(AddAudioOptions addAudioOptions) { - Validator.notNull(addAudioOptions, "addAudioOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addAudioOptions, + "addAudioOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "audio" }; String[] pathParameters = { addAudioOptions.customizationId(), addAudioOptions.audioName() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2034,16 +1986,17 @@ public ServiceCall addAudio(AddAudioOptions addAudioOptions) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (addAudioOptions.containedContentType() != null) { - builder.header("Contained-Content-Type", addAudioOptions.containedContentType()); - } if (addAudioOptions.contentType() != null) { builder.header("Content-Type", addAudioOptions.contentType()); } + if (addAudioOptions.containedContentType() != null) { + builder.header("Contained-Content-Type", addAudioOptions.containedContentType()); + } if (addAudioOptions.allowOverwrite() != null) { builder.query("allow_overwrite", String.valueOf(addAudioOptions.allowOverwrite())); } - builder.bodyContent(addAudioOptions.contentType(), null, null, addAudioOptions.audioResource()); + builder.bodyContent(addAudioOptions.contentType(), null, + null, addAudioOptions.audioResource()); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } @@ -2074,7 +2027,8 @@ public ServiceCall addAudio(AddAudioOptions addAudioOptions) { * @return a {@link ServiceCall} with a response type of {@link AudioListing} */ public ServiceCall getAudio(GetAudioOptions getAudioOptions) { - Validator.notNull(getAudioOptions, "getAudioOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getAudioOptions, + "getAudioOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "audio" }; String[] pathParameters = { getAudioOptions.customizationId(), getAudioOptions.audioName() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2108,7 +2062,8 @@ public ServiceCall getAudio(GetAudioOptions getAudioOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteAudio(DeleteAudioOptions deleteAudioOptions) { - Validator.notNull(deleteAudioOptions, "deleteAudioOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAudioOptions, + "deleteAudioOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "audio" }; String[] pathParameters = { deleteAudioOptions.customizationId(), deleteAudioOptions.audioName() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -2134,15 +2089,14 @@ public ServiceCall deleteAudio(DeleteAudioOptions deleteAudioOptions) { * data. * * **See also:** [Information - * security] - * (https://cloud.ibm.com/docs/services/speech-to-text - * ?topic=speech-to-text-information-security#information-security). + * security](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-information-security#information-security). * * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - Validator.notNull(deleteUserDataOptions, "deleteUserDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, + "deleteUserDataOptions cannot be null"); String[] pathSegments = { "v1/user_data" }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteUserData"); diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModel.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModel.java index d75d999975c..12d8d38c4a6 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModel.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModels.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModels.java index 6fa00a3a6ae..27dab1092d6 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModels.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AcousticModels.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddAudioOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddAudioOptions.java index a6f9ae8f5b2..41411876e70 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddAudioOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddAudioOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addAudio options. @@ -26,20 +25,17 @@ public class AddAudioOptions extends GenericModel { /** - * **For an archive-type resource,** specify the format of the audio files that are contained in the archive file if - * they are of type `audio/alaw`, `audio/basic`, `audio/l16`, or `audio/mulaw`. Include the `rate`, `channels`, and - * `endianness` parameters where necessary. In this case, all audio files that are contained in the archive file must - * be of the indicated type. - * - * For all other audio formats, you can omit the header. In this case, the audio files can be of multiple types as - * long as they are not of the types listed in the previous paragraph. - * - * The parameter accepts all of the audio formats that are supported for use with speech recognition. For more - * information, see **Content types for audio-type resources** in the method description. + * For an audio-type resource, the format (MIME type) of the audio. For more information, see **Content types for + * audio-type resources** in the method description. * - * **For an audio-type resource,** omit the header. + * For an archive-type resource, the media type of the archive file. For more information, see **Content types for + * archive-type resources** in the method description. */ - public interface ContainedContentType { + public interface ContentType { + /** application/zip. */ + String APPLICATION_ZIP = "application/zip"; + /** application/gzip. */ + String APPLICATION_GZIP = "application/gzip"; /** audio/alaw. */ String AUDIO_ALAW = "audio/alaw"; /** audio/basic. */ @@ -73,17 +69,20 @@ public interface ContainedContentType { } /** - * For an audio-type resource, the format (MIME type) of the audio. For more information, see **Content types for - * audio-type resources** in the method description. + * **For an archive-type resource,** specify the format of the audio files that are contained in the archive file if + * they are of type `audio/alaw`, `audio/basic`, `audio/l16`, or `audio/mulaw`. Include the `rate`, `channels`, and + * `endianness` parameters where necessary. In this case, all audio files that are contained in the archive file must + * be of the indicated type. * - * For an archive-type resource, the media type of the archive file. For more information, see **Content types for - * archive-type resources** in the method description. + * For all other audio formats, you can omit the header. In this case, the audio files can be of multiple types as + * long as they are not of the types listed in the previous paragraph. + * + * The parameter accepts all of the audio formats that are supported for use with speech recognition. For more + * information, see **Content types for audio-type resources** in the method description. + * + * **For an audio-type resource,** omit the header. */ - public interface ContentType { - /** application/zip. */ - String APPLICATION_ZIP = "application/zip"; - /** application/gzip. */ - String APPLICATION_GZIP = "application/gzip"; + public interface ContainedContentType { /** audio/alaw. */ String AUDIO_ALAW = "audio/alaw"; /** audio/basic. */ @@ -119,9 +118,9 @@ public interface ContentType { private String customizationId; private String audioName; private InputStream audioResource; + private String contentType; private String containedContentType; private Boolean allowOverwrite; - private String contentType; /** * Builder. @@ -130,17 +129,17 @@ public static class Builder { private String customizationId; private String audioName; private InputStream audioResource; + private String contentType; private String containedContentType; private Boolean allowOverwrite; - private String contentType; private Builder(AddAudioOptions addAudioOptions) { this.customizationId = addAudioOptions.customizationId; this.audioName = addAudioOptions.audioName; this.audioResource = addAudioOptions.audioResource; + this.contentType = addAudioOptions.contentType; this.containedContentType = addAudioOptions.containedContentType; this.allowOverwrite = addAudioOptions.allowOverwrite; - this.contentType = addAudioOptions.contentType; } /** @@ -204,6 +203,17 @@ public Builder audioResource(InputStream audioResource) { return this; } + /** + * Set the contentType. + * + * @param contentType the contentType + * @return the AddAudioOptions builder + */ + public Builder contentType(String contentType) { + this.contentType = contentType; + return this; + } + /** * Set the containedContentType. * @@ -226,17 +236,6 @@ public Builder allowOverwrite(Boolean allowOverwrite) { return this; } - /** - * Set the contentType. - * - * @param contentType the contentType - * @return the AddAudioOptions builder - */ - public Builder contentType(String contentType) { - this.contentType = contentType; - return this; - } - /** * Set the audioResource. * @@ -252,15 +251,18 @@ public Builder audioResource(File audioResource) throws FileNotFoundException { } private AddAudioOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.audioName, "audioName cannot be empty"); - Validator.notNull(builder.audioResource, "audioResource cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.audioName, + "audioName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.audioResource, + "audioResource cannot be null"); customizationId = builder.customizationId; audioName = builder.audioName; audioResource = builder.audioResource; + contentType = builder.contentType; containedContentType = builder.containedContentType; allowOverwrite = builder.allowOverwrite; - contentType = builder.contentType; } /** @@ -315,6 +317,21 @@ public InputStream audioResource() { return audioResource; } + /** + * Gets the contentType. + * + * For an audio-type resource, the format (MIME type) of the audio. For more information, see **Content types for + * audio-type resources** in the method description. + * + * For an archive-type resource, the media type of the archive file. For more information, see **Content types for + * archive-type resources** in the method description. + * + * @return the contentType + */ + public String contentType() { + return contentType; + } + /** * Gets the containedContentType. * @@ -349,19 +366,4 @@ public String containedContentType() { public Boolean allowOverwrite() { return allowOverwrite; } - - /** - * Gets the contentType. - * - * For an audio-type resource, the format (MIME type) of the audio. For more information, see **Content types for - * audio-type resources** in the method description. - * - * For an archive-type resource, the media type of the archive file. For more information, see **Content types for - * archive-type resources** in the method description. - * - * @return the contentType - */ - public String contentType() { - return contentType; - } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddCorpusOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddCorpusOptions.java index d78d82aff99..9baee92a450 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddCorpusOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddCorpusOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addCorpus options. @@ -133,9 +132,12 @@ public Builder corpusFile(File corpusFile) throws FileNotFoundException { } private AddCorpusOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.corpusName, "corpusName cannot be empty"); - Validator.notNull(builder.corpusFile, "corpusFile cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.corpusName, + "corpusName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.corpusFile, + "corpusFile cannot be null"); customizationId = builder.customizationId; corpusName = builder.corpusName; corpusFile = builder.corpusFile; diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddGrammarOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddGrammarOptions.java index 739b089e872..b43d16dcc76 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddGrammarOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddGrammarOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addGrammar options. @@ -162,10 +161,14 @@ public Builder grammarFile(File grammarFile) throws FileNotFoundException { } private AddGrammarOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.grammarName, "grammarName cannot be empty"); - Validator.notNull(builder.grammarFile, "grammarFile cannot be null"); - Validator.notNull(builder.contentType, "contentType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.grammarName, + "grammarName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grammarFile, + "grammarFile cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.contentType, + "contentType cannot be null"); customizationId = builder.customizationId; grammarName = builder.grammarName; grammarFile = builder.grammarFile; diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordOptions.java index 8f976c57a24..8cc615d15f3 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addWord options. @@ -80,7 +79,8 @@ public AddWordOptions build() { * @return the AddWordOptions builder */ public Builder addSoundsLike(String soundsLike) { - Validator.notNull(soundsLike, "soundsLike cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(soundsLike, + "soundsLike cannot be null"); if (this.soundsLike == null) { this.soundsLike = new ArrayList(); } @@ -146,8 +146,10 @@ public Builder displayAs(String displayAs) { } private AddWordOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.wordName, "wordName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.wordName, + "wordName cannot be empty"); customizationId = builder.customizationId; wordName = builder.wordName; word = builder.word; diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordsOptions.java index 7e6a870cc9f..b7fe98c95d9 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AddWordsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addWords options. @@ -71,7 +70,8 @@ public AddWordsOptions build() { * @return the AddWordsOptions builder */ public Builder addWords(CustomWord words) { - Validator.notNull(words, "words cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(words, + "words cannot be null"); if (this.words == null) { this.words = new ArrayList(); } @@ -104,8 +104,10 @@ public Builder words(List words) { } private AddWordsOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notNull(builder.words, "words cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.words, + "words cannot be null"); customizationId = builder.customizationId; words = builder.words; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioDetails.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioDetails.java index b83f6bc140f..c437f83963e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioDetails.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioListing.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioListing.java index 2885179f604..8edceacd1ea 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioListing.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioListing.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetrics.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetrics.java index b2e2d59e0ec..e89abcf793b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetrics.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java index a4640fdbe4e..c095e0de812 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsHistogramBin.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsHistogramBin.java index b4f453d5871..d883d59f39d 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsHistogramBin.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsHistogramBin.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResource.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResource.java index 3227fa7bf15..22c33a90bc4 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResource.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResources.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResources.java index e0d765b8852..20011df6f54 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResources.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioResources.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobOptions.java index 272c5339272..b83b7507ccc 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The checkJob options. @@ -69,7 +68,8 @@ public Builder id(String id) { } private CheckJobOptions(Builder builder) { - Validator.notEmpty(builder.id, "id cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); id = builder.id; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java index b7968558104..a5abc7a8181 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpora.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpora.java index afb2a43cc8e..93713d5ec89 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpora.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpora.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpus.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpus.java index 34c9cf87397..bb7449c1474 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpus.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Corpus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java index 00a4ff04191..f8b9f5f07d4 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createAcousticModel options. @@ -25,8 +24,7 @@ public class CreateAcousticModelOptions extends GenericModel { * can be used only with the base model that it customizes. * * To determine whether a base model supports acoustic model customization, refer to [Language support for - * customization] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). */ public interface BaseModelName { /** ar-AR_BroadbandModel. */ @@ -45,10 +43,30 @@ public interface BaseModelName { String EN_US_NARROWBANDMODEL = "en-US_NarrowbandModel"; /** en-US_ShortForm_NarrowbandModel. */ String EN_US_SHORTFORM_NARROWBANDMODEL = "en-US_ShortForm_NarrowbandModel"; + /** es-AR_BroadbandModel. */ + String ES_AR_BROADBANDMODEL = "es-AR_BroadbandModel"; + /** es-AR_NarrowbandModel. */ + String ES_AR_NARROWBANDMODEL = "es-AR_NarrowbandModel"; + /** es-CL_BroadbandModel. */ + String ES_CL_BROADBANDMODEL = "es-CL_BroadbandModel"; + /** es-CL_NarrowbandModel. */ + String ES_CL_NARROWBANDMODEL = "es-CL_NarrowbandModel"; + /** es-CO_BroadbandModel. */ + String ES_CO_BROADBANDMODEL = "es-CO_BroadbandModel"; + /** es-CO_NarrowbandModel. */ + String ES_CO_NARROWBANDMODEL = "es-CO_NarrowbandModel"; /** es-ES_BroadbandModel. */ String ES_ES_BROADBANDMODEL = "es-ES_BroadbandModel"; /** es-ES_NarrowbandModel. */ String ES_ES_NARROWBANDMODEL = "es-ES_NarrowbandModel"; + /** es-MX_BroadbandModel. */ + String ES_MX_BROADBANDMODEL = "es-MX_BroadbandModel"; + /** es-MX_NarrowbandModel. */ + String ES_MX_NARROWBANDMODEL = "es-MX_NarrowbandModel"; + /** es-PE_BroadbandModel. */ + String ES_PE_BROADBANDMODEL = "es-PE_BroadbandModel"; + /** es-PE_NarrowbandModel. */ + String ES_PE_NARROWBANDMODEL = "es-PE_NarrowbandModel"; /** fr-FR_BroadbandModel. */ String FR_FR_BROADBANDMODEL = "fr-FR_BroadbandModel"; /** fr-FR_NarrowbandModel. */ @@ -150,8 +168,10 @@ public Builder description(String description) { } private CreateAcousticModelOptions(Builder builder) { - Validator.notNull(builder.name, "name cannot be null"); - Validator.notNull(builder.baseModelName, "baseModelName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.baseModelName, + "baseModelName cannot be null"); name = builder.name; baseModelName = builder.baseModelName; description = builder.description; @@ -186,8 +206,7 @@ public String name() { * can be used only with the base model that it customizes. * * To determine whether a base model supports acoustic model customization, refer to [Language support for - * customization] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). * * @return the baseModelName */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java index 4f58a4cb5a6..7c8b9a7779f 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -20,13 +20,51 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createJob options. */ public class CreateJobOptions extends GenericModel { + /** + * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats + * (content types)** in the method description. + */ + public interface ContentType { + /** application/octet-stream. */ + String APPLICATION_OCTET_STREAM = "application/octet-stream"; + /** audio/alaw. */ + String AUDIO_ALAW = "audio/alaw"; + /** audio/basic. */ + String AUDIO_BASIC = "audio/basic"; + /** audio/flac. */ + String AUDIO_FLAC = "audio/flac"; + /** audio/g729. */ + String AUDIO_G729 = "audio/g729"; + /** audio/l16. */ + String AUDIO_L16 = "audio/l16"; + /** audio/mp3. */ + String AUDIO_MP3 = "audio/mp3"; + /** audio/mpeg. */ + String AUDIO_MPEG = "audio/mpeg"; + /** audio/mulaw. */ + String AUDIO_MULAW = "audio/mulaw"; + /** audio/ogg. */ + String AUDIO_OGG = "audio/ogg"; + /** audio/ogg;codecs=opus. */ + String AUDIO_OGG_CODECS_OPUS = "audio/ogg;codecs=opus"; + /** audio/ogg;codecs=vorbis. */ + String AUDIO_OGG_CODECS_VORBIS = "audio/ogg;codecs=vorbis"; + /** audio/wav. */ + String AUDIO_WAV = "audio/wav"; + /** audio/webm. */ + String AUDIO_WEBM = "audio/webm"; + /** audio/webm;codecs=opus. */ + String AUDIO_WEBM_CODECS_OPUS = "audio/webm;codecs=opus"; + /** audio/webm;codecs=vorbis. */ + String AUDIO_WEBM_CODECS_VORBIS = "audio/webm;codecs=vorbis"; + } + /** * The identifier of the model that is to be used for the recognition request. See [Languages and * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-models#models). @@ -48,10 +86,30 @@ public interface Model { String EN_US_NARROWBANDMODEL = "en-US_NarrowbandModel"; /** en-US_ShortForm_NarrowbandModel. */ String EN_US_SHORTFORM_NARROWBANDMODEL = "en-US_ShortForm_NarrowbandModel"; + /** es-AR_BroadbandModel. */ + String ES_AR_BROADBANDMODEL = "es-AR_BroadbandModel"; + /** es-AR_NarrowbandModel. */ + String ES_AR_NARROWBANDMODEL = "es-AR_NarrowbandModel"; + /** es-CL_BroadbandModel. */ + String ES_CL_BROADBANDMODEL = "es-CL_BroadbandModel"; + /** es-CL_NarrowbandModel. */ + String ES_CL_NARROWBANDMODEL = "es-CL_NarrowbandModel"; + /** es-CO_BroadbandModel. */ + String ES_CO_BROADBANDMODEL = "es-CO_BroadbandModel"; + /** es-CO_NarrowbandModel. */ + String ES_CO_NARROWBANDMODEL = "es-CO_NarrowbandModel"; /** es-ES_BroadbandModel. */ String ES_ES_BROADBANDMODEL = "es-ES_BroadbandModel"; /** es-ES_NarrowbandModel. */ String ES_ES_NARROWBANDMODEL = "es-ES_NarrowbandModel"; + /** es-MX_BroadbandModel. */ + String ES_MX_BROADBANDMODEL = "es-MX_BroadbandModel"; + /** es-MX_NarrowbandModel. */ + String ES_MX_NARROWBANDMODEL = "es-MX_NarrowbandModel"; + /** es-PE_BroadbandModel. */ + String ES_PE_BROADBANDMODEL = "es-PE_BroadbandModel"; + /** es-PE_NarrowbandModel. */ + String ES_PE_NARROWBANDMODEL = "es-PE_NarrowbandModel"; /** fr-FR_BroadbandModel. */ String FR_FR_BROADBANDMODEL = "fr-FR_BroadbandModel"; /** fr-FR_NarrowbandModel. */ @@ -103,46 +161,8 @@ public interface Events { String RECOGNITIONS_FAILED = "recognitions.failed"; } - /** - * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats - * (content types)** in the method description. - */ - public interface ContentType { - /** application/octet-stream. */ - String APPLICATION_OCTET_STREAM = "application/octet-stream"; - /** audio/alaw. */ - String AUDIO_ALAW = "audio/alaw"; - /** audio/basic. */ - String AUDIO_BASIC = "audio/basic"; - /** audio/flac. */ - String AUDIO_FLAC = "audio/flac"; - /** audio/g729. */ - String AUDIO_G729 = "audio/g729"; - /** audio/l16. */ - String AUDIO_L16 = "audio/l16"; - /** audio/mp3. */ - String AUDIO_MP3 = "audio/mp3"; - /** audio/mpeg. */ - String AUDIO_MPEG = "audio/mpeg"; - /** audio/mulaw. */ - String AUDIO_MULAW = "audio/mulaw"; - /** audio/ogg. */ - String AUDIO_OGG = "audio/ogg"; - /** audio/ogg;codecs=opus. */ - String AUDIO_OGG_CODECS_OPUS = "audio/ogg;codecs=opus"; - /** audio/ogg;codecs=vorbis. */ - String AUDIO_OGG_CODECS_VORBIS = "audio/ogg;codecs=vorbis"; - /** audio/wav. */ - String AUDIO_WAV = "audio/wav"; - /** audio/webm. */ - String AUDIO_WEBM = "audio/webm"; - /** audio/webm;codecs=opus. */ - String AUDIO_WEBM_CODECS_OPUS = "audio/webm;codecs=opus"; - /** audio/webm;codecs=vorbis. */ - String AUDIO_WEBM_CODECS_VORBIS = "audio/webm;codecs=vorbis"; - } - private InputStream audio; + private String contentType; private String model; private String callbackUrl; private String events; @@ -168,13 +188,13 @@ public interface ContentType { private Boolean processingMetrics; private Float processingMetricsInterval; private Boolean audioMetrics; - private String contentType; /** * Builder. */ public static class Builder { private InputStream audio; + private String contentType; private String model; private String callbackUrl; private String events; @@ -200,10 +220,10 @@ public static class Builder { private Boolean processingMetrics; private Float processingMetricsInterval; private Boolean audioMetrics; - private String contentType; private Builder(CreateJobOptions createJobOptions) { this.audio = createJobOptions.audio; + this.contentType = createJobOptions.contentType; this.model = createJobOptions.model; this.callbackUrl = createJobOptions.callbackUrl; this.events = createJobOptions.events; @@ -229,7 +249,6 @@ private Builder(CreateJobOptions createJobOptions) { this.processingMetrics = createJobOptions.processingMetrics; this.processingMetricsInterval = createJobOptions.processingMetricsInterval; this.audioMetrics = createJobOptions.audioMetrics; - this.contentType = createJobOptions.contentType; } /** @@ -263,7 +282,8 @@ public CreateJobOptions build() { * @return the CreateJobOptions builder */ public Builder addKeyword(String keyword) { - Validator.notNull(keyword, "keyword cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(keyword, + "keyword cannot be null"); if (this.keywords == null) { this.keywords = new ArrayList(); } @@ -282,6 +302,17 @@ public Builder audio(InputStream audio) { return this; } + /** + * Set the contentType. + * + * @param contentType the contentType + * @return the CreateJobOptions builder + */ + public Builder contentType(String contentType) { + this.contentType = contentType; + return this; + } + /** * Set the model. * @@ -558,17 +589,6 @@ public Builder audioMetrics(Boolean audioMetrics) { return this; } - /** - * Set the contentType. - * - * @param contentType the contentType - * @return the CreateJobOptions builder - */ - public Builder contentType(String contentType) { - this.contentType = contentType; - return this; - } - /** * Set the audio. * @@ -584,8 +604,10 @@ public Builder audio(File audio) throws FileNotFoundException { } private CreateJobOptions(Builder builder) { - Validator.notNull(builder.audio, "audio cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.audio, + "audio cannot be null"); audio = builder.audio; + contentType = builder.contentType; model = builder.model; callbackUrl = builder.callbackUrl; events = builder.events; @@ -611,7 +633,6 @@ private CreateJobOptions(Builder builder) { processingMetrics = builder.processingMetrics; processingMetricsInterval = builder.processingMetricsInterval; audioMetrics = builder.audioMetrics; - contentType = builder.contentType; } /** @@ -634,6 +655,18 @@ public InputStream audio() { return audio; } + /** + * Gets the contentType. + * + * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats + * (content types)** in the method description. + * + * @return the contentType + */ + public String contentType() { + return contentType; + } + /** * Gets the model. * @@ -921,9 +954,9 @@ public Boolean smartFormatting() { * multi-person exchange. By default, the service returns no speaker labels. Setting `speaker_labels` to `true` forces * the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter. * - * **Note:** Applies to US English, Japanese, and Spanish transcription only. To determine whether a language model - * supports speaker labels, you can also use the **Get a model** method and check that the attribute `speaker_labels` - * is set to `true`. + * **Note:** Applies to US English, Japanese, and Spanish (both broadband and narrowband models) and UK English + * (narrowband model) transcription only. To determine whether a language model supports speaker labels, you can also + * use the **Get a model** method and check that the attribute `speaker_labels` is set to `true`. * * See [Speaker * labels](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#speaker_labels). @@ -1027,16 +1060,4 @@ public Float processingMetricsInterval() { public Boolean audioMetrics() { return audioMetrics; } - - /** - * Gets the contentType. - * - * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats - * (content types)** in the method description. - * - * @return the contentType - */ - public String contentType() { - return contentType; - } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java index a64d97818f8..79d21e2d2ca 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createLanguageModel options. @@ -26,8 +25,7 @@ public class CreateLanguageModelOptions extends GenericModel { * * To determine whether a base model supports language model customization, use the **Get a model** method and check * that the attribute `custom_language_model` is set to `true`. You can also refer to [Language support for - * customization] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). */ public interface BaseModelName { /** de-DE_BroadbandModel. */ @@ -44,10 +42,30 @@ public interface BaseModelName { String EN_US_NARROWBANDMODEL = "en-US_NarrowbandModel"; /** en-US_ShortForm_NarrowbandModel. */ String EN_US_SHORTFORM_NARROWBANDMODEL = "en-US_ShortForm_NarrowbandModel"; + /** es-AR_BroadbandModel. */ + String ES_AR_BROADBANDMODEL = "es-AR_BroadbandModel"; + /** es-AR_NarrowbandModel. */ + String ES_AR_NARROWBANDMODEL = "es-AR_NarrowbandModel"; + /** es-CL_BroadbandModel. */ + String ES_CL_BROADBANDMODEL = "es-CL_BroadbandModel"; + /** es-CL_NarrowbandModel. */ + String ES_CL_NARROWBANDMODEL = "es-CL_NarrowbandModel"; + /** es-CO_BroadbandModel. */ + String ES_CO_BROADBANDMODEL = "es-CO_BroadbandModel"; + /** es-CO_NarrowbandModel. */ + String ES_CO_NARROWBANDMODEL = "es-CO_NarrowbandModel"; /** es-ES_BroadbandModel. */ String ES_ES_BROADBANDMODEL = "es-ES_BroadbandModel"; /** es-ES_NarrowbandModel. */ String ES_ES_NARROWBANDMODEL = "es-ES_NarrowbandModel"; + /** es-MX_BroadbandModel. */ + String ES_MX_BROADBANDMODEL = "es-MX_BroadbandModel"; + /** es-MX_NarrowbandModel. */ + String ES_MX_NARROWBANDMODEL = "es-MX_NarrowbandModel"; + /** es-PE_BroadbandModel. */ + String ES_PE_BROADBANDMODEL = "es-PE_BroadbandModel"; + /** es-PE_NarrowbandModel. */ + String ES_PE_NARROWBANDMODEL = "es-PE_NarrowbandModel"; /** fr-FR_BroadbandModel. */ String FR_FR_BROADBANDMODEL = "fr-FR_BroadbandModel"; /** fr-FR_NarrowbandModel. */ @@ -159,8 +177,10 @@ public Builder description(String description) { } private CreateLanguageModelOptions(Builder builder) { - Validator.notNull(builder.name, "name cannot be null"); - Validator.notNull(builder.baseModelName, "baseModelName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.baseModelName, + "baseModelName cannot be null"); name = builder.name; baseModelName = builder.baseModelName; dialect = builder.dialect; @@ -197,8 +217,7 @@ public String name() { * * To determine whether a base model supports language model customization, use the **Get a model** method and check * that the attribute `custom_language_model` is set to `true`. You can also refer to [Language support for - * customization] - * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). * * @return the baseModelName */ @@ -209,15 +228,22 @@ public String baseModelName() { /** * Gets the dialect. * - * The dialect of the specified language that is to be used with the custom language model. The parameter is - * meaningful only for Spanish models, for which the service creates a custom language model that is suited for speech - * in one of the following dialects: - * * `es-ES` for Castilian Spanish (the default) - * * `es-LA` for Latin American Spanish - * * `es-US` for North American (Mexican) Spanish + * The dialect of the specified language that is to be used with the custom language model. For most languages, the + * dialect matches the language of the base model by default. For example, `en-US` is used for either of the US + * English language models. * - * A specified dialect must be valid for the base model. By default, the dialect matches the language of the base - * model; for example, `en-US` for either of the US English language models. + * For a Spanish language, the service creates a custom language model that is suited for speech in one of the + * following dialects: + * * `es-ES` for Castilian Spanish (`es-ES` models) + * * `es-LA` for Latin American Spanish (`es-AR`, `es-CL`, `es-CO`, and `es-PE` models) + * * `es-US` for Mexican (North American) Spanish (`es-MX` models) + * + * The parameter is meaningful only for Spanish models, for which you can always safely omit the parameter to have the + * service create the correct mapping. + * + * If you specify the `dialect` parameter for non-Spanish language models, its value must match the language of the + * base model. If you specify the `dialect` for Spanish language models, its value must match one of the defined + * mappings as indicated (`es-ES`, `es-LA`, or `es-MX`). All dialect values are case-insensitive. * * @return the dialect */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CustomWord.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CustomWord.java index 135f1397fc7..2b55f68dbbc 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CustomWord.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CustomWord.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.speech_to_text.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -28,6 +29,101 @@ public class CustomWord extends GenericModel { @SerializedName("display_as") private String displayAs; + /** + * Builder. + */ + public static class Builder { + private String word; + private List soundsLike; + private String displayAs; + + private Builder(CustomWord customWord) { + this.word = customWord.word; + this.soundsLike = customWord.soundsLike; + this.displayAs = customWord.displayAs; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CustomWord. + * + * @return the customWord + */ + public CustomWord build() { + return new CustomWord(this); + } + + /** + * Adds an soundsLike to soundsLike. + * + * @param soundsLike the new soundsLike + * @return the CustomWord builder + */ + public Builder addSoundsLike(String soundsLike) { + com.ibm.cloud.sdk.core.util.Validator.notNull(soundsLike, + "soundsLike cannot be null"); + if (this.soundsLike == null) { + this.soundsLike = new ArrayList(); + } + this.soundsLike.add(soundsLike); + return this; + } + + /** + * Set the word. + * + * @param word the word + * @return the CustomWord builder + */ + public Builder word(String word) { + this.word = word; + return this; + } + + /** + * Set the soundsLike. + * Existing soundsLike will be replaced. + * + * @param soundsLike the soundsLike + * @return the CustomWord builder + */ + public Builder soundsLike(List soundsLike) { + this.soundsLike = soundsLike; + return this; + } + + /** + * Set the displayAs. + * + * @param displayAs the displayAs + * @return the CustomWord builder + */ + public Builder displayAs(String displayAs) { + this.displayAs = displayAs; + return this; + } + } + + private CustomWord(Builder builder) { + word = builder.word; + soundsLike = builder.soundsLike; + displayAs = builder.displayAs; + } + + /** + * New builder. + * + * @return a CustomWord builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the word. * @@ -39,7 +135,7 @@ public class CustomWord extends GenericModel { * * @return the word */ - public String getWord() { + public String word() { return word; } @@ -59,7 +155,7 @@ public String getWord() { * * @return the soundsLike */ - public List getSoundsLike() { + public List soundsLike() { return soundsLike; } @@ -72,34 +168,7 @@ public List getSoundsLike() { * * @return the displayAs */ - public String getDisplayAs() { + public String displayAs() { return displayAs; } - - /** - * Sets the word. - * - * @param word the new word - */ - public void setWord(final String word) { - this.word = word; - } - - /** - * Sets the soundsLike. - * - * @param soundsLike the new soundsLike - */ - public void setSoundsLike(final List soundsLike) { - this.soundsLike = soundsLike; - } - - /** - * Sets the displayAs. - * - * @param displayAs the new displayAs - */ - public void setDisplayAs(final String displayAs) { - this.displayAs = displayAs; - } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAcousticModelOptions.java index d1ba2a1ef5c..f929a4687cf 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAcousticModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteAcousticModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private DeleteAcousticModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAudioOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAudioOptions.java index ecdac701c2a..f6068ae7f13 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAudioOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAudioOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteAudio options. @@ -85,8 +84,10 @@ public Builder audioName(String audioName) { } private DeleteAudioOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.audioName, "audioName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.audioName, + "audioName cannot be empty"); customizationId = builder.customizationId; audioName = builder.audioName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteCorpusOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteCorpusOptions.java index a4e0a329852..933ad009463 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteCorpusOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteCorpusOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteCorpus options. @@ -85,8 +84,10 @@ public Builder corpusName(String corpusName) { } private DeleteCorpusOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.corpusName, "corpusName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.corpusName, + "corpusName cannot be empty"); customizationId = builder.customizationId; corpusName = builder.corpusName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteGrammarOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteGrammarOptions.java index 4e687e24331..165c7353880 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteGrammarOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteGrammarOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteGrammar options. @@ -85,8 +84,10 @@ public Builder grammarName(String grammarName) { } private DeleteGrammarOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.grammarName, "grammarName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.grammarName, + "grammarName cannot be empty"); customizationId = builder.customizationId; grammarName = builder.grammarName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteJobOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteJobOptions.java index aaafe759e1b..aa5244c41da 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteJobOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteJobOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteJob options. @@ -69,7 +68,8 @@ public Builder id(String id) { } private DeleteJobOptions(Builder builder) { - Validator.notEmpty(builder.id, "id cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); id = builder.id; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteLanguageModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteLanguageModelOptions.java index 159035b8c5a..2c8019a575c 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteLanguageModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteLanguageModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteLanguageModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private DeleteLanguageModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteUserDataOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteUserDataOptions.java index 2b85df4ce1f..f49b32fb9d5 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteUserDataOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteUserDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteUserData options. @@ -69,7 +68,8 @@ public Builder customerId(String customerId) { } private DeleteUserDataOptions(Builder builder) { - Validator.notNull(builder.customerId, "customerId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, + "customerId cannot be null"); customerId = builder.customerId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteWordOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteWordOptions.java index 5137778682d..a17ecf06740 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteWordOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteWordOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteWord options. @@ -85,8 +84,10 @@ public Builder wordName(String wordName) { } private DeleteWordOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.wordName, "wordName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.wordName, + "wordName cannot be empty"); customizationId = builder.customizationId; wordName = builder.wordName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAcousticModelOptions.java index 159d7cd7c43..c05104a2c54 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAcousticModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getAcousticModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private GetAcousticModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAudioOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAudioOptions.java index 35a6f4b3110..f82c4893581 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAudioOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetAudioOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getAudio options. @@ -85,8 +84,10 @@ public Builder audioName(String audioName) { } private GetAudioOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.audioName, "audioName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.audioName, + "audioName cannot be empty"); customizationId = builder.customizationId; audioName = builder.audioName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetCorpusOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetCorpusOptions.java index 09f1cfc83f4..e20d38363d7 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetCorpusOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetCorpusOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getCorpus options. @@ -85,8 +84,10 @@ public Builder corpusName(String corpusName) { } private GetCorpusOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.corpusName, "corpusName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.corpusName, + "corpusName cannot be empty"); customizationId = builder.customizationId; corpusName = builder.corpusName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetGrammarOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetGrammarOptions.java index 8bf5d15813d..b27c3bd2710 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetGrammarOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetGrammarOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getGrammar options. @@ -85,8 +84,10 @@ public Builder grammarName(String grammarName) { } private GetGrammarOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.grammarName, "grammarName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.grammarName, + "grammarName cannot be empty"); customizationId = builder.customizationId; grammarName = builder.grammarName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetLanguageModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetLanguageModelOptions.java index 58a8d883cb9..277efca285b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetLanguageModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetLanguageModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getLanguageModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private GetLanguageModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java index 678e044ba80..9c8d23df986 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getModel options. @@ -40,10 +39,30 @@ public interface ModelId { String EN_US_NARROWBANDMODEL = "en-US_NarrowbandModel"; /** en-US_ShortForm_NarrowbandModel. */ String EN_US_SHORTFORM_NARROWBANDMODEL = "en-US_ShortForm_NarrowbandModel"; + /** es-AR_BroadbandModel. */ + String ES_AR_BROADBANDMODEL = "es-AR_BroadbandModel"; + /** es-AR_NarrowbandModel. */ + String ES_AR_NARROWBANDMODEL = "es-AR_NarrowbandModel"; + /** es-CL_BroadbandModel. */ + String ES_CL_BROADBANDMODEL = "es-CL_BroadbandModel"; + /** es-CL_NarrowbandModel. */ + String ES_CL_NARROWBANDMODEL = "es-CL_NarrowbandModel"; + /** es-CO_BroadbandModel. */ + String ES_CO_BROADBANDMODEL = "es-CO_BroadbandModel"; + /** es-CO_NarrowbandModel. */ + String ES_CO_NARROWBANDMODEL = "es-CO_NarrowbandModel"; /** es-ES_BroadbandModel. */ String ES_ES_BROADBANDMODEL = "es-ES_BroadbandModel"; /** es-ES_NarrowbandModel. */ String ES_ES_NARROWBANDMODEL = "es-ES_NarrowbandModel"; + /** es-MX_BroadbandModel. */ + String ES_MX_BROADBANDMODEL = "es-MX_BroadbandModel"; + /** es-MX_NarrowbandModel. */ + String ES_MX_NARROWBANDMODEL = "es-MX_NarrowbandModel"; + /** es-PE_BroadbandModel. */ + String ES_PE_BROADBANDMODEL = "es-PE_BroadbandModel"; + /** es-PE_NarrowbandModel. */ + String ES_PE_NARROWBANDMODEL = "es-PE_NarrowbandModel"; /** fr-FR_BroadbandModel. */ String FR_FR_BROADBANDMODEL = "fr-FR_BroadbandModel"; /** fr-FR_NarrowbandModel. */ @@ -115,7 +134,8 @@ public Builder modelId(String modelId) { } private GetModelOptions(Builder builder) { - Validator.notEmpty(builder.modelId, "modelId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.modelId, + "modelId cannot be empty"); modelId = builder.modelId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetWordOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetWordOptions.java index 0ec5e1fdee5..f0c0bdb721d 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetWordOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetWordOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getWord options. @@ -85,8 +84,10 @@ public Builder wordName(String wordName) { } private GetWordOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.wordName, "wordName cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.wordName, + "wordName cannot be empty"); customizationId = builder.customizationId; wordName = builder.wordName; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammar.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammar.java index 9dcb4c16f32..927b01c5ae3 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammar.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammar.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammars.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammars.java index 11c868c6ffa..045f9f36bca 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammars.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Grammars.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/KeywordResult.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/KeywordResult.java index ebe2b9d6e5e..6d69d9e347f 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/KeywordResult.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/KeywordResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModel.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModel.java index 9c00bee92b9..c23c902c524 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModel.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -116,12 +116,14 @@ public String getLanguage() { /** * Gets the dialect. * - * The dialect of the language for the custom language model. By default, the dialect matches the language of the base - * model; for example, `en-US` for either of the US English language models. For Spanish models, the field indicates - * the dialect for which the model was created: - * * `es-ES` for Castilian Spanish (the default) - * * `es-LA` for Latin American Spanish - * * `es-US` for North American (Mexican) Spanish. + * The dialect of the language for the custom language model. For non-Spanish models, the field matches the language + * of the base model; for example, `en-US` for either of the US English language models. For Spanish models, the field + * indicates the dialect for which the model was created: + * * `es-ES` for Castilian Spanish (`es-ES` models) + * * `es-LA` for Latin American Spanish (`es-AR`, `es-CL`, `es-CO`, and `es-PE` models) + * * `es-US` for Mexican (North American) Spanish (`es-MX` models) + * + * Dialect values are case-insensitive. * * @return the dialect */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModels.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModels.java index 05047db3291..77077c26af2 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModels.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/LanguageModels.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java index 9bb84520643..be08e3c99c8 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAudioOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAudioOptions.java index 81e9ff34b53..a2de6b3da09 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAudioOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAudioOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listAudio options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private ListAudioOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListCorporaOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListCorporaOptions.java index c68ebe4a76c..cc1872b1fb8 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListCorporaOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListCorporaOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listCorpora options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private ListCorporaOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListGrammarsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListGrammarsOptions.java index 33ff6a4cd40..4ba378de610 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListGrammarsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListGrammarsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listGrammars options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private ListGrammarsOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java index 60579a008b7..dbf5780bb6e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java index a892bba0f3b..552bf01d2bd 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListWordsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListWordsOptions.java index f7118cc2cf6..fa88cea5b33 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListWordsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListWordsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listWords options. @@ -129,7 +128,8 @@ public Builder sort(String sort) { } private ListWordsOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; wordType = builder.wordType; sort = builder.sort; diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessedAudio.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessedAudio.java index 9195f869382..5b4e1c237c8 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessedAudio.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessedAudio.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessingMetrics.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessingMetrics.java index 0dbef0691f4..468d2da63a5 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessingMetrics.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ProcessingMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJob.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJob.java index 761a707648b..807c400c79c 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJob.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJob.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJobs.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJobs.java index 17d904624ed..98d3fefcae8 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJobs.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognitionJobs.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java index d8e021f9110..12e808b58db 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -19,15 +19,52 @@ import java.util.ArrayList; import java.util.List; -import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The recognize options. */ public class RecognizeOptions extends GenericModel { + /** + * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats + * (content types)** in the method description. + */ + public interface ContentType { + /** application/octet-stream. */ + String APPLICATION_OCTET_STREAM = "application/octet-stream"; + /** audio/alaw. */ + String AUDIO_ALAW = "audio/alaw"; + /** audio/basic. */ + String AUDIO_BASIC = "audio/basic"; + /** audio/flac. */ + String AUDIO_FLAC = "audio/flac"; + /** audio/g729. */ + String AUDIO_G729 = "audio/g729"; + /** audio/l16. */ + String AUDIO_L16 = "audio/l16"; + /** audio/mp3. */ + String AUDIO_MP3 = "audio/mp3"; + /** audio/mpeg. */ + String AUDIO_MPEG = "audio/mpeg"; + /** audio/mulaw. */ + String AUDIO_MULAW = "audio/mulaw"; + /** audio/ogg. */ + String AUDIO_OGG = "audio/ogg"; + /** audio/ogg;codecs=opus. */ + String AUDIO_OGG_CODECS_OPUS = "audio/ogg;codecs=opus"; + /** audio/ogg;codecs=vorbis. */ + String AUDIO_OGG_CODECS_VORBIS = "audio/ogg;codecs=vorbis"; + /** audio/wav. */ + String AUDIO_WAV = "audio/wav"; + /** audio/webm. */ + String AUDIO_WEBM = "audio/webm"; + /** audio/webm;codecs=opus. */ + String AUDIO_WEBM_CODECS_OPUS = "audio/webm;codecs=opus"; + /** audio/webm;codecs=vorbis. */ + String AUDIO_WEBM_CODECS_VORBIS = "audio/webm;codecs=vorbis"; + } + /** * The identifier of the model that is to be used for the recognition request. See [Languages and * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-models#models). @@ -49,10 +86,30 @@ public interface Model { String EN_US_NARROWBANDMODEL = "en-US_NarrowbandModel"; /** en-US_ShortForm_NarrowbandModel. */ String EN_US_SHORTFORM_NARROWBANDMODEL = "en-US_ShortForm_NarrowbandModel"; + /** es-AR_BroadbandModel. */ + String ES_AR_BROADBANDMODEL = "es-AR_BroadbandModel"; + /** es-AR_NarrowbandModel. */ + String ES_AR_NARROWBANDMODEL = "es-AR_NarrowbandModel"; + /** es-CL_BroadbandModel. */ + String ES_CL_BROADBANDMODEL = "es-CL_BroadbandModel"; + /** es-CL_NarrowbandModel. */ + String ES_CL_NARROWBANDMODEL = "es-CL_NarrowbandModel"; + /** es-CO_BroadbandModel. */ + String ES_CO_BROADBANDMODEL = "es-CO_BroadbandModel"; + /** es-CO_NarrowbandModel. */ + String ES_CO_NARROWBANDMODEL = "es-CO_NarrowbandModel"; /** es-ES_BroadbandModel. */ String ES_ES_BROADBANDMODEL = "es-ES_BroadbandModel"; /** es-ES_NarrowbandModel. */ String ES_ES_NARROWBANDMODEL = "es-ES_NarrowbandModel"; + /** es-MX_BroadbandModel. */ + String ES_MX_BROADBANDMODEL = "es-MX_BroadbandModel"; + /** es-MX_NarrowbandModel. */ + String ES_MX_NARROWBANDMODEL = "es-MX_NarrowbandModel"; + /** es-PE_BroadbandModel. */ + String ES_PE_BROADBANDMODEL = "es-PE_BroadbandModel"; + /** es-PE_NarrowbandModel. */ + String ES_PE_NARROWBANDMODEL = "es-PE_NarrowbandModel"; /** fr-FR_BroadbandModel. */ String FR_FR_BROADBANDMODEL = "fr-FR_BroadbandModel"; /** fr-FR_NarrowbandModel. */ @@ -75,46 +132,8 @@ public interface Model { String ZH_CN_NARROWBANDMODEL = "zh-CN_NarrowbandModel"; } - /** - * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats - * (content types)** in the method description. - */ - public interface ContentType { - /** application/octet-stream. */ - String APPLICATION_OCTET_STREAM = "application/octet-stream"; - /** audio/alaw. */ - String AUDIO_ALAW = "audio/alaw"; - /** audio/basic. */ - String AUDIO_BASIC = "audio/basic"; - /** audio/flac. */ - String AUDIO_FLAC = "audio/flac"; - /** audio/g729. */ - String AUDIO_G729 = "audio/g729"; - /** audio/l16. */ - String AUDIO_L16 = "audio/l16"; - /** audio/mp3. */ - String AUDIO_MP3 = "audio/mp3"; - /** audio/mpeg. */ - String AUDIO_MPEG = "audio/mpeg"; - /** audio/mulaw. */ - String AUDIO_MULAW = "audio/mulaw"; - /** audio/ogg. */ - String AUDIO_OGG = "audio/ogg"; - /** audio/ogg;codecs=opus. */ - String AUDIO_OGG_CODECS_OPUS = "audio/ogg;codecs=opus"; - /** audio/ogg;codecs=vorbis. */ - String AUDIO_OGG_CODECS_VORBIS = "audio/ogg;codecs=vorbis"; - /** audio/wav. */ - String AUDIO_WAV = "audio/wav"; - /** audio/webm. */ - String AUDIO_WEBM = "audio/webm"; - /** audio/webm;codecs=opus. */ - String AUDIO_WEBM_CODECS_OPUS = "audio/webm;codecs=opus"; - /** audio/webm;codecs=vorbis. */ - String AUDIO_WEBM_CODECS_VORBIS = "audio/webm;codecs=vorbis"; - } - - private transient InputStream audio; + private InputStream audio; + private String contentType; private String model; private String languageCustomizationId; private String acousticCustomizationId; @@ -134,17 +153,13 @@ public interface ContentType { private String grammarName; private Boolean redaction; private Boolean audioMetrics; - @SerializedName("content-type") - private String contentType; - private Boolean interimResults; - private Boolean processingMetrics; - private Float processingMetricsInterval; /** * Builder. */ public static class Builder { private InputStream audio; + private String contentType; private String model; private String languageCustomizationId; private String acousticCustomizationId; @@ -164,13 +179,10 @@ public static class Builder { private String grammarName; private Boolean redaction; private Boolean audioMetrics; - private String contentType; - private Boolean interimResults; - private Boolean processingMetrics; - private Float processingMetricsInterval; private Builder(RecognizeOptions recognizeOptions) { this.audio = recognizeOptions.audio; + this.contentType = recognizeOptions.contentType; this.model = recognizeOptions.model; this.languageCustomizationId = recognizeOptions.languageCustomizationId; this.acousticCustomizationId = recognizeOptions.acousticCustomizationId; @@ -190,10 +202,6 @@ private Builder(RecognizeOptions recognizeOptions) { this.grammarName = recognizeOptions.grammarName; this.redaction = recognizeOptions.redaction; this.audioMetrics = recognizeOptions.audioMetrics; - this.contentType = recognizeOptions.contentType; - this.interimResults = recognizeOptions.interimResults; - this.processingMetrics = recognizeOptions.processingMetrics; - this.processingMetricsInterval = recognizeOptions.processingMetricsInterval; } /** @@ -227,7 +235,8 @@ public RecognizeOptions build() { * @return the RecognizeOptions builder */ public Builder addKeyword(String keyword) { - Validator.notNull(keyword, "keyword cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(keyword, + "keyword cannot be null"); if (this.keywords == null) { this.keywords = new ArrayList(); } @@ -246,6 +255,17 @@ public Builder audio(InputStream audio) { return this; } + /** + * Set the contentType. + * + * @param contentType the contentType + * @return the RecognizeOptions builder + */ + public Builder contentType(String contentType) { + this.contentType = contentType; + return this; + } + /** * Set the model. * @@ -456,17 +476,6 @@ public Builder audioMetrics(Boolean audioMetrics) { return this; } - /** - * Set the contentType. - * - * @param contentType the contentType - * @return the RecognizeOptions builder - */ - public Builder contentType(String contentType) { - this.contentType = contentType; - return this; - } - /** * Set the audio. * @@ -479,50 +488,13 @@ public Builder audio(File audio) throws FileNotFoundException { this.audio = new FileInputStream(audio); return this; } - - /** - * Set the interimResults. - * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param interimResults the interimResults - * @return the interimResults - */ - public Builder interimResults(Boolean interimResults) { - this.interimResults = interimResults; - return this; - } - - /** - * Set the processingMetrics. - * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param processingMetrics the processingMetrics - * @return the processingMetrics - */ - public Builder processingMetrics(Boolean processingMetrics) { - this.processingMetrics = processingMetrics; - return this; - } - - /** - * Set the processingMetricsInterval. - * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param processingMetricsInterval the processingMetricsInterval - * @return the processingMetricsInterval - */ - public Builder processingMetricsInterval(Float processingMetricsInterval) { - this.processingMetricsInterval = processingMetricsInterval; - return this; - } } private RecognizeOptions(Builder builder) { - Validator.notNull(builder.audio, "audio cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.audio, + "audio cannot be null"); audio = builder.audio; + contentType = builder.contentType; model = builder.model; languageCustomizationId = builder.languageCustomizationId; acousticCustomizationId = builder.acousticCustomizationId; @@ -542,10 +514,6 @@ private RecognizeOptions(Builder builder) { grammarName = builder.grammarName; redaction = builder.redaction; audioMetrics = builder.audioMetrics; - contentType = builder.contentType; - interimResults = builder.interimResults; - processingMetrics = builder.processingMetrics; - processingMetricsInterval = builder.processingMetricsInterval; } /** @@ -568,6 +536,18 @@ public InputStream audio() { return audio; } + /** + * Gets the contentType. + * + * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats + * (content types)** in the method description. + * + * @return the contentType + */ + public String contentType() { + return contentType; + } + /** * Gets the model. * @@ -787,9 +767,9 @@ public Boolean smartFormatting() { * multi-person exchange. By default, the service returns no speaker labels. Setting `speaker_labels` to `true` forces * the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter. * - * **Note:** Applies to US English, Japanese, and Spanish transcription only. To determine whether a language model - * supports speaker labels, you can also use the **Get a model** method and check that the attribute `speaker_labels` - * is set to `true`. + * **Note:** Applies to US English, Japanese, and Spanish (both broadband and narrowband models) and UK English + * (narrowband model) transcription only. To determine whether a language model supports speaker labels, you can also + * use the **Get a model** method and check that the attribute `speaker_labels` is set to `true`. * * See [Speaker * labels](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#speaker_labels). @@ -860,67 +840,4 @@ public Boolean redaction() { public Boolean audioMetrics() { return audioMetrics; } - - /** - * Gets the contentType. - * - * The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats - * (content types)** in the method description. - * - * @return the contentType - */ - public String contentType() { - return contentType; - } - - /** - * Gets the interimResults. - * - * If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` objects. By default, - * the service returns a single `SpeechRecognitionResults` object with final results only. - * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the interimResults - */ - public Boolean interimResults() { - return interimResults; - } - - /** - * Gets the processingMetrics. - * - * If `true`, requests processing metrics about the service's transcription of the input audio. The service returns - * processing metrics at the interval specified by the `processing_metrics_interval` parameter. It also returns - * processing metrics for transcription events, for example, for final and interim results. By default, the service - * returns no processing metrics. - * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the processingMetrics - */ - public Boolean processingMetrics() { - return processingMetrics; - } - - /** - * Gets the processingMetricsInterval. - * - * Specifies the interval in real wall-clock seconds at which the service is to return processing metrics. The - * parameter is ignored unless the `processing_metrics` parameter is set to `true`. - * - * The parameter accepts a minimum value of 0.1 seconds. The level of precision is not restricted, so you can - * specify values such as 0.25 and 0.125. - * - * The service does not impose a maximum value. If you want to receive processing metrics only for transcription - * events instead of at periodic intervals, set the value to a large number. If the value is larger than the - * duration of the audio, the service returns processing metrics only for transcription events. - * - * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the processingMetricsInterval - */ - public Float processingMetricsInterval() { - return processingMetricsInterval; - } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java index debe4e4da04..8a42ff51a7e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The registerCallback options. @@ -83,7 +82,8 @@ public Builder userSecret(String userSecret) { } private RegisterCallbackOptions(Builder builder) { - Validator.notNull(builder.callbackUrl, "callbackUrl cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.callbackUrl, + "callbackUrl cannot be null"); callbackUrl = builder.callbackUrl; userSecret = builder.userSecret; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java index 1da842b0481..1cdfd40c30d 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetAcousticModelOptions.java index a279f60f5ce..67b49b0666e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetAcousticModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The resetAcousticModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private ResetAcousticModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetLanguageModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetLanguageModelOptions.java index 6103b1ebb82..f461211b51e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetLanguageModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ResetLanguageModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The resetLanguageModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private ResetLanguageModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java index ca14099f47f..0cb5ae2d903 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -25,7 +25,7 @@ public class SpeakerLabelsResult extends GenericModel { private Long speaker; private Float confidence; @SerializedName("final") - private Boolean finalResults; + private Boolean xfinal; /** * Gets the from. @@ -75,15 +75,15 @@ public Float getConfidence() { } /** - * Gets the finalResults. + * Gets the xfinal. * * An indication of whether the service might further change word and speaker-label results. A value of `true` means * that the service guarantees not to send any further updates for the current or any preceding results; `false` means * that the service might send further updates to the results. * - * @return the finalResults + * @return the xfinal */ - public Boolean isFinalResults() { - return finalResults; + public Boolean isXfinal() { + return xfinal; } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModel.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModel.java index 2c65b90d329..1d86e1f3563 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModel.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModels.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModels.java index 9e90ed41d85..5ec3957fd75 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModels.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechModels.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java index bea01551b18..c6682596831 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -24,9 +24,9 @@ public class SpeechRecognitionAlternative extends GenericModel { private String transcript; private Double confidence; - private List timestamps; + private List timestamps; @SerializedName("word_confidence") - private List wordConfidence; + private List wordConfidence; /** * Gets the transcript. @@ -60,7 +60,7 @@ public Double getConfidence() { * * @return the timestamps */ - public List getTimestamps() { + public List getTimestamps() { return timestamps; } @@ -73,7 +73,7 @@ public List getTimestamps() { * * @return the wordConfidence */ - public List getWordConfidence() { + public List getWordConfidence() { return wordConfidence; } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java index d4e2c0573ea..74a98d9bbae 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -24,7 +24,7 @@ public class SpeechRecognitionResult extends GenericModel { @SerializedName("final") - private Boolean finalResults; + private Boolean xfinal; private List alternatives; @SerializedName("keywords_result") private Map> keywordsResult; @@ -32,15 +32,15 @@ public class SpeechRecognitionResult extends GenericModel { private List wordAlternatives; /** - * Gets the finalResults. + * Gets the xfinal. * * An indication of whether the transcription results are final. If `true`, the results for this utterance are not * updated further; no additional results are sent for a `result_index` once its results are indicated as final. * - * @return the finalResults + * @return the xfinal */ - public Boolean isFinalResults() { - return finalResults; + public Boolean isXfinal() { + return xfinal; } /** diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResults.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResults.java index 063ef6c84c6..7b84244f2aa 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResults.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java index e0334254e73..7ce4897c553 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainAcousticModelOptions.java index 3761b6e0fd2..14bdc85a500 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainAcousticModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The trainAcousticModel options. @@ -83,7 +82,8 @@ public Builder customLanguageModelId(String customLanguageModelId) { } private TrainAcousticModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; customLanguageModelId = builder.customLanguageModelId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainLanguageModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainLanguageModelOptions.java index 56ca2be0ca1..c0cf4eb6ec2 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainLanguageModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainLanguageModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The trainLanguageModel options. @@ -111,7 +110,8 @@ public Builder customizationWeight(Double customizationWeight) { } private TrainLanguageModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; wordTypeToAdd = builder.wordTypeToAdd; customizationWeight = builder.customizationWeight; diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingResponse.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingResponse.java index 283da004109..6dd1b0a8c06 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingResponse.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingWarning.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingWarning.java index 65adf0748d6..2cdf5afe98b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingWarning.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/TrainingWarning.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UnregisterCallbackOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UnregisterCallbackOptions.java index 7cbbd4170e2..57e18b4c90e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UnregisterCallbackOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UnregisterCallbackOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The unregisterCallback options. @@ -69,7 +68,8 @@ public Builder callbackUrl(String callbackUrl) { } private UnregisterCallbackOptions(Builder builder) { - Validator.notNull(builder.callbackUrl, "callbackUrl cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.callbackUrl, + "callbackUrl cannot be null"); callbackUrl = builder.callbackUrl; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeAcousticModelOptions.java index 05ad726bcd1..e769738ef06 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeAcousticModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The upgradeAcousticModel options. @@ -97,7 +96,8 @@ public Builder force(Boolean force) { } private UpgradeAcousticModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; customLanguageModelId = builder.customLanguageModelId; force = builder.force; diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeLanguageModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeLanguageModelOptions.java index 815279946c7..f94a16e5a02 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeLanguageModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/UpgradeLanguageModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The upgradeLanguageModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private UpgradeLanguageModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Word.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Word.java index 947b846cca4..b3dd975497b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Word.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Word.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResult.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResult.java index dd85a1909ef..0d947a24bc1 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResult.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResults.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResults.java index b84a9e4ffa9..a8d36f5d702 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResults.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordAlternativeResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordError.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordError.java index 0ee53e79a73..229f07a5ba1 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordError.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/WordError.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Words.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Words.java index 1257f4820e9..816fc20fcdb 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Words.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/Words.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/package-info.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/package-info.java index d4b3c70c38d..895036e15b6 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/package-info.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index ef27b14ec73..deef07e60a3 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,11 +16,9 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.text_to_speech.v1.model.AddWordOptions; import com.ibm.watson.text_to_speech.v1.model.AddWordsOptions; @@ -44,13 +42,6 @@ import com.ibm.watson.text_to_speech.v1.model.VoiceModels; import com.ibm.watson.text_to_speech.v1.model.Voices; import com.ibm.watson.text_to_speech.v1.model.Words; -import com.ibm.watson.text_to_speech.v1.websocket.SynthesizeCallback; -import com.ibm.watson.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.WebSocket; - import java.io.InputStream; import java.util.Map; import java.util.Map.Entry; @@ -72,7 +63,7 @@ * Phonetic Representation (SPR). * * @version v1 - * @see Text to Speech + * @see Text to Speech */ public class TextToSpeech extends BaseService { @@ -80,44 +71,17 @@ public class TextToSpeech extends BaseService { private static final String URL = "https://stream.watsonplatform.net/text-to-speech/api"; /** - * Instantiates a new `TextToSpeech`. + * Constructs a new `TextToSpeech` client with the specified Authenticator. * - * @deprecated Use TextToSpeech(AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public TextToSpeech() { - super(SERVICE_NAME); + public TextToSpeech(Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } } - /** - * Instantiates a new `TextToSpeech` with username and password. - * - * @param username the username - * @param password the password - * @deprecated Use TextToSpeech(AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public TextToSpeech(String username, String password) { - this(); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `TextToSpeech` with the specified authentication configuration. - * - * @param authenticatorConfig the authentication configuration for this service - */ - public TextToSpeech(AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - } - /** * List voices. * @@ -165,8 +129,8 @@ public ServiceCall listVoices() { * Get a voice. * * Gets information about the specified voice. The information includes the name, language, gender, and other details - * about the voice. Specify a customization ID to obtain information for that custom voice model of the specified - * voice. To list information about all available voices, use the **List voices** method. + * about the voice. Specify a customization ID to obtain information for a custom voice model that is defined for the + * language of the specified voice. To list information about all available voices, use the **List voices** method. * * **See also:** [Listing a specific * voice](https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-voices#listVoice). @@ -175,7 +139,8 @@ public ServiceCall listVoices() { * @return a {@link ServiceCall} with a response type of {@link Voice} */ public ServiceCall getVoice(GetVoiceOptions getVoiceOptions) { - Validator.notNull(getVoiceOptions, "getVoiceOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getVoiceOptions, + "getVoiceOptions cannot be null"); String[] pathSegments = { "v1/voices" }; String[] pathParameters = { getVoiceOptions.voice() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -269,14 +234,15 @@ public ServiceCall getVoice(GetVoiceOptions getVoiceOptions) { * * If a request includes invalid query parameters, the service returns a `Warnings` response header that provides * messages about the invalid parameters. The warning includes a descriptive message and a list of invalid argument - * strings. For example, a message such as `\"Unknown arguments:\"` or `\"Unknown url query arguments:\"` followed by - * a list of the form `\"{invalid_arg_1}, {invalid_arg_2}.\"` The request succeeds despite the warnings. + * strings. For example, a message such as `"Unknown arguments:"` or `"Unknown url query arguments:"` followed by a + * list of the form `"{invalid_arg_1}, {invalid_arg_2}."` The request succeeds despite the warnings. * * @param synthesizeOptions the {@link SynthesizeOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link InputStream} */ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) { - Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(synthesizeOptions, + "synthesizeOptions cannot be null"); String[] pathSegments = { "v1/synthesize" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "synthesize"); @@ -299,29 +265,6 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) return createServiceCall(builder.build(), responseConverter); } - public WebSocket synthesizeUsingWebSocket(SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { - Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null"); - Validator.notNull(callback, "callback cannot be null"); - - HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/synthesize").newBuilder(); - - if (synthesizeOptions.voice() != null) { - urlBuilder.addQueryParameter("voice", synthesizeOptions.voice()); - } - if (synthesizeOptions.customizationId() != null) { - urlBuilder.addQueryParameter("customization_id", synthesizeOptions.customizationId()); - } - - String url = urlBuilder.toString().replace("https://", "wss://"); - Request.Builder builder = new Request.Builder().url(url); - - setAuthentication(builder); - setDefaultHeaders(builder); - - OkHttpClient client = configureHttpClient(); - return client.newWebSocket(builder.build(), new TextToSpeechWebSocketListener(synthesizeOptions, callback)); - } - /** * Get pronunciation. * @@ -332,14 +275,14 @@ public WebSocket synthesizeUsingWebSocket(SynthesizeOptions synthesizeOptions, S * **Note:** This method is currently a beta release. * * **See also:** [Querying a word from a - * language] - * (https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-customWords#cuWordsQueryLanguage). + * language](https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-customWords#cuWordsQueryLanguage). * * @param getPronunciationOptions the {@link GetPronunciationOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Pronunciation} */ public ServiceCall getPronunciation(GetPronunciationOptions getPronunciationOptions) { - Validator.notNull(getPronunciationOptions, "getPronunciationOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getPronunciationOptions, + "getPronunciationOptions cannot be null"); String[] pathSegments = { "v1/pronunciation" }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "getPronunciation"); @@ -379,7 +322,8 @@ public ServiceCall getPronunciation(GetPronunciationOptions getPr * @return a {@link ServiceCall} with a response type of {@link VoiceModel} */ public ServiceCall createVoiceModel(CreateVoiceModelOptions createVoiceModelOptions) { - Validator.notNull(createVoiceModelOptions, "createVoiceModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createVoiceModelOptions, + "createVoiceModelOptions cannot be null"); String[] pathSegments = { "v1/customizations" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "createVoiceModel"); @@ -469,11 +413,11 @@ public ServiceCall listVoiceModels() { * words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for * representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation * - * <phoneme alphabet=\"ipa\" ph=\"təmˈɑto\"></phoneme> + * <phoneme alphabet="ipa" ph="təmˈɑto"></phoneme> * * or in the proprietary IBM Symbolic Phonetic Representation (SPR) * - * <phoneme alphabet=\"ibm\" ph=\"1gAstroEntxrYFXs\"></phoneme> + * <phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme> * * **Note:** This method is currently a beta release. * @@ -489,7 +433,8 @@ public ServiceCall listVoiceModels() { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall updateVoiceModel(UpdateVoiceModelOptions updateVoiceModelOptions) { - Validator.notNull(updateVoiceModelOptions, "updateVoiceModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateVoiceModelOptions, + "updateVoiceModelOptions cannot be null"); String[] pathSegments = { "v1/customizations" }; String[] pathParameters = { updateVoiceModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -507,7 +452,8 @@ public ServiceCall updateVoiceModel(UpdateVoiceModelOptions updateVoiceMod contentJson.addProperty("description", updateVoiceModelOptions.description()); } if (updateVoiceModelOptions.words() != null) { - contentJson.add("words", GsonSingleton.getGson().toJsonTree(updateVoiceModelOptions.words())); + contentJson.add("words", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateVoiceModelOptions + .words())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); @@ -530,7 +476,8 @@ public ServiceCall updateVoiceModel(UpdateVoiceModelOptions updateVoiceMod * @return a {@link ServiceCall} with a response type of {@link VoiceModel} */ public ServiceCall getVoiceModel(GetVoiceModelOptions getVoiceModelOptions) { - Validator.notNull(getVoiceModelOptions, "getVoiceModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getVoiceModelOptions, + "getVoiceModelOptions cannot be null"); String[] pathSegments = { "v1/customizations" }; String[] pathParameters = { getVoiceModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -561,7 +508,8 @@ public ServiceCall getVoiceModel(GetVoiceModelOptions getVoiceModelO * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteVoiceModel(DeleteVoiceModelOptions deleteVoiceModelOptions) { - Validator.notNull(deleteVoiceModelOptions, "deleteVoiceModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteVoiceModelOptions, + "deleteVoiceModelOptions cannot be null"); String[] pathSegments = { "v1/customizations" }; String[] pathParameters = { deleteVoiceModelOptions.customizationId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -586,11 +534,11 @@ public ServiceCall deleteVoiceModel(DeleteVoiceModelOptions deleteVoiceMod * words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for * representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation * - * <phoneme alphabet=\"ipa\" ph=\"təmˈɑto\"></phoneme> + * <phoneme alphabet="ipa" ph="təmˈɑto"></phoneme> * * or in the proprietary IBM Symbolic Phonetic Representation (SPR) * - * <phoneme alphabet=\"ibm\" ph=\"1gAstroEntxrYFXs\"></phoneme> + * <phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme> * * **Note:** This method is currently a beta release. * @@ -606,7 +554,8 @@ public ServiceCall deleteVoiceModel(DeleteVoiceModelOptions deleteVoiceMod * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall addWords(AddWordsOptions addWordsOptions) { - Validator.notNull(addWordsOptions, "addWordsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addWordsOptions, + "addWordsOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { addWordsOptions.customizationId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -617,7 +566,7 @@ public ServiceCall addWords(AddWordsOptions addWordsOptions) { } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("words", GsonSingleton.getGson().toJsonTree(addWordsOptions.words())); + contentJson.add("words", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(addWordsOptions.words())); builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); @@ -639,7 +588,8 @@ public ServiceCall addWords(AddWordsOptions addWordsOptions) { * @return a {@link ServiceCall} with a response type of {@link Words} */ public ServiceCall listWords(ListWordsOptions listWordsOptions) { - Validator.notNull(listWordsOptions, "listWordsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listWordsOptions, + "listWordsOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { listWordsOptions.customizationId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -667,11 +617,11 @@ public ServiceCall listWords(ListWordsOptions listWordsOptions) { * words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for * representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation * - * <phoneme alphabet=\"ipa\" ph=\"təmˈɑto\"></phoneme> + * <phoneme alphabet="ipa" ph="təmˈɑto"></phoneme> * * or in the proprietary IBM Symbolic Phonetic Representation (SPR) * - * <phoneme alphabet=\"ibm\" ph=\"1gAstroEntxrYFXs\"></phoneme> + * <phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme> * * **Note:** This method is currently a beta release. * @@ -687,7 +637,8 @@ public ServiceCall listWords(ListWordsOptions listWordsOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall addWord(AddWordOptions addWordOptions) { - Validator.notNull(addWordOptions, "addWordOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(addWordOptions, + "addWordOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { addWordOptions.customizationId(), addWordOptions.word() }; RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -722,7 +673,8 @@ public ServiceCall addWord(AddWordOptions addWordOptions) { * @return a {@link ServiceCall} with a response type of {@link Translation} */ public ServiceCall getWord(GetWordOptions getWordOptions) { - Validator.notNull(getWordOptions, "getWordOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getWordOptions, + "getWordOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { getWordOptions.customizationId(), getWordOptions.word() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -753,7 +705,8 @@ public ServiceCall getWord(GetWordOptions getWordOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { - Validator.notNull(deleteWordOptions, "deleteWordOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteWordOptions, + "deleteWordOptions cannot be null"); String[] pathSegments = { "v1/customizations", "words" }; String[] pathParameters = { deleteWordOptions.customizationId(), deleteWordOptions.word() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -778,15 +731,14 @@ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { * data. * * **See also:** [Information - * security] - * (https://cloud.ibm.com/docs/services/text-to-speech - * ?topic=text-to-speech-information-security#information-security). + * security](https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-information-security#information-security). * * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - Validator.notNull(deleteUserDataOptions, "deleteUserDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, + "deleteUserDataOptions cannot be null"); String[] pathSegments = { "v1/user_data" }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "deleteUserData"); diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordOptions.java index d69aed9c017..60ededcabb3 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addWord options. @@ -163,16 +162,19 @@ public Builder partOfSpeech(String partOfSpeech) { * @return the AddWordOptions builder */ public Builder translation(Translation translation) { - this.translation = translation.getTranslation(); - this.partOfSpeech = translation.getPartOfSpeech(); + this.translation = translation.translation(); + this.partOfSpeech = translation.partOfSpeech(); return this; } } private AddWordOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.word, "word cannot be empty"); - Validator.notNull(builder.translation, "translation cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.word, + "word cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.translation, + "translation cannot be null"); customizationId = builder.customizationId; word = builder.word; translation = builder.translation; @@ -191,8 +193,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordsOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordsOptions.java index 5e6eb203635..4ca7dcd9dce 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordsOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/AddWordsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The addWords options. @@ -71,7 +70,8 @@ public AddWordsOptions build() { * @return the AddWordsOptions builder */ public Builder addWord(Word word) { - Validator.notNull(word, "word cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(word, + "word cannot be null"); if (this.words == null) { this.words = new ArrayList(); } @@ -109,14 +109,16 @@ public Builder words(List words) { * @return the AddWordsOptions builder */ public Builder words(Words words) { - this.words = words.getWords(); + this.words = words.words(); return this; } } private AddWordsOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notNull(builder.words, "words cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.words, + "words cannot be null"); customizationId = builder.customizationId; words = builder.words; } @@ -133,8 +135,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/CreateVoiceModelOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/CreateVoiceModelOptions.java index d61eb6f382b..b2c26ba6c1a 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/CreateVoiceModelOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/CreateVoiceModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createVoiceModel options. @@ -123,7 +122,8 @@ public Builder description(String description) { } private CreateVoiceModelOptions(Builder builder) { - Validator.notNull(builder.name, "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); name = builder.name; language = builder.language; description = builder.description; diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteUserDataOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteUserDataOptions.java index 266c9b49491..b5f78e443b6 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteUserDataOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteUserDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteUserData options. @@ -69,7 +68,8 @@ public Builder customerId(String customerId) { } private DeleteUserDataOptions(Builder builder) { - Validator.notNull(builder.customerId, "customerId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, + "customerId cannot be null"); customerId = builder.customerId; } diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteVoiceModelOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteVoiceModelOptions.java index 2e62c76f955..6958a35bde9 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteVoiceModelOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteVoiceModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteVoiceModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private DeleteVoiceModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } @@ -85,8 +85,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteWordOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteWordOptions.java index 4a0a6221940..f33d679752f 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteWordOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/DeleteWordOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteWord options. @@ -85,8 +84,10 @@ public Builder word(String word) { } private DeleteWordOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.word, "word cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.word, + "word cannot be empty"); customizationId = builder.customizationId; word = builder.word; } @@ -103,8 +104,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java index 8a9e19ed26b..29d8e3de44c 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getPronunciation options. @@ -27,44 +26,60 @@ public class GetPronunciationOptions extends GenericModel { public interface Voice { /** de-DE_BirgitVoice. */ String DE_DE_BIRGITVOICE = "de-DE_BirgitVoice"; - /** de-DE_BirgitV2Voice. */ - String DE_DE_BIRGITV2VOICE = "de-DE_BirgitV2Voice"; + /** de-DE_BirgitV3Voice. */ + String DE_DE_BIRGITV3VOICE = "de-DE_BirgitV3Voice"; /** de-DE_DieterVoice. */ String DE_DE_DIETERVOICE = "de-DE_DieterVoice"; - /** de-DE_DieterV2Voice. */ - String DE_DE_DIETERV2VOICE = "de-DE_DieterV2Voice"; + /** de-DE_DieterV3Voice. */ + String DE_DE_DIETERV3VOICE = "de-DE_DieterV3Voice"; /** en-GB_KateVoice. */ String EN_GB_KATEVOICE = "en-GB_KateVoice"; + /** en-GB_KateV3Voice. */ + String EN_GB_KATEV3VOICE = "en-GB_KateV3Voice"; /** en-US_AllisonVoice. */ String EN_US_ALLISONVOICE = "en-US_AllisonVoice"; - /** en-US_AllisonV2Voice. */ - String EN_US_ALLISONV2VOICE = "en-US_AllisonV2Voice"; + /** en-US_AllisonV3Voice. */ + String EN_US_ALLISONV3VOICE = "en-US_AllisonV3Voice"; /** en-US_LisaVoice. */ String EN_US_LISAVOICE = "en-US_LisaVoice"; - /** en-US_LisaV2Voice. */ - String EN_US_LISAV2VOICE = "en-US_LisaV2Voice"; + /** en-US_LisaV3Voice. */ + String EN_US_LISAV3VOICE = "en-US_LisaV3Voice"; /** en-US_MichaelVoice. */ String EN_US_MICHAELVOICE = "en-US_MichaelVoice"; - /** en-US_MichaelV2Voice. */ - String EN_US_MICHAELV2VOICE = "en-US_MichaelV2Voice"; + /** en-US_MichaelV3Voice. */ + String EN_US_MICHAELV3VOICE = "en-US_MichaelV3Voice"; /** es-ES_EnriqueVoice. */ String ES_ES_ENRIQUEVOICE = "es-ES_EnriqueVoice"; + /** es-ES_EnriqueV3Voice. */ + String ES_ES_ENRIQUEV3VOICE = "es-ES_EnriqueV3Voice"; /** es-ES_LauraVoice. */ String ES_ES_LAURAVOICE = "es-ES_LauraVoice"; + /** es-ES_LauraV3Voice. */ + String ES_ES_LAURAV3VOICE = "es-ES_LauraV3Voice"; /** es-LA_SofiaVoice. */ String ES_LA_SOFIAVOICE = "es-LA_SofiaVoice"; + /** es-LA_SofiaV3Voice. */ + String ES_LA_SOFIAV3VOICE = "es-LA_SofiaV3Voice"; /** es-US_SofiaVoice. */ String ES_US_SOFIAVOICE = "es-US_SofiaVoice"; + /** es-US_SofiaV3Voice. */ + String ES_US_SOFIAV3VOICE = "es-US_SofiaV3Voice"; /** fr-FR_ReneeVoice. */ String FR_FR_RENEEVOICE = "fr-FR_ReneeVoice"; + /** fr-FR_ReneeV3Voice. */ + String FR_FR_RENEEV3VOICE = "fr-FR_ReneeV3Voice"; /** it-IT_FrancescaVoice. */ String IT_IT_FRANCESCAVOICE = "it-IT_FrancescaVoice"; - /** it-IT_FrancescaV2Voice. */ - String IT_IT_FRANCESCAV2VOICE = "it-IT_FrancescaV2Voice"; + /** it-IT_FrancescaV3Voice. */ + String IT_IT_FRANCESCAV3VOICE = "it-IT_FrancescaV3Voice"; /** ja-JP_EmiVoice. */ String JA_JP_EMIVOICE = "ja-JP_EmiVoice"; + /** ja-JP_EmiV3Voice. */ + String JA_JP_EMIV3VOICE = "ja-JP_EmiV3Voice"; /** pt-BR_IsabelaVoice. */ String PT_BR_ISABELAVOICE = "pt-BR_IsabelaVoice"; + /** pt-BR_IsabelaV3Voice. */ + String PT_BR_ISABELAV3VOICE = "pt-BR_IsabelaV3Voice"; } /** @@ -169,7 +184,8 @@ public Builder customizationId(String customizationId) { } private GetPronunciationOptions(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; voice = builder.voice; format = builder.format; @@ -226,8 +242,8 @@ public String format() { * The customization ID (GUID) of a custom voice model for which the pronunciation is to be returned. The language of * a specified custom model must match the language of the specified voice. If the word is not defined in the * specified custom model, the service returns the default translation for the custom model's language. You must make - * the request with service credentials created for the instance of the service that owns the custom model. Omit the - * parameter to see the translation for the specified voice with no customization. + * the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see + * the translation for the specified voice with no customization. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceModelOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceModelOptions.java index e3039f75e98..0439ab711d6 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceModelOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getVoiceModel options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private GetVoiceModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } @@ -85,8 +85,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java index 185aa94e847..4ec9194fb75 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getVoice options. @@ -26,44 +25,60 @@ public class GetVoiceOptions extends GenericModel { public interface Voice { /** de-DE_BirgitVoice. */ String DE_DE_BIRGITVOICE = "de-DE_BirgitVoice"; - /** de-DE_BirgitV2Voice. */ - String DE_DE_BIRGITV2VOICE = "de-DE_BirgitV2Voice"; + /** de-DE_BirgitV3Voice. */ + String DE_DE_BIRGITV3VOICE = "de-DE_BirgitV3Voice"; /** de-DE_DieterVoice. */ String DE_DE_DIETERVOICE = "de-DE_DieterVoice"; - /** de-DE_DieterV2Voice. */ - String DE_DE_DIETERV2VOICE = "de-DE_DieterV2Voice"; + /** de-DE_DieterV3Voice. */ + String DE_DE_DIETERV3VOICE = "de-DE_DieterV3Voice"; /** en-GB_KateVoice. */ String EN_GB_KATEVOICE = "en-GB_KateVoice"; + /** en-GB_KateV3Voice. */ + String EN_GB_KATEV3VOICE = "en-GB_KateV3Voice"; /** en-US_AllisonVoice. */ String EN_US_ALLISONVOICE = "en-US_AllisonVoice"; - /** en-US_AllisonV2Voice. */ - String EN_US_ALLISONV2VOICE = "en-US_AllisonV2Voice"; + /** en-US_AllisonV3Voice. */ + String EN_US_ALLISONV3VOICE = "en-US_AllisonV3Voice"; /** en-US_LisaVoice. */ String EN_US_LISAVOICE = "en-US_LisaVoice"; - /** en-US_LisaV2Voice. */ - String EN_US_LISAV2VOICE = "en-US_LisaV2Voice"; + /** en-US_LisaV3Voice. */ + String EN_US_LISAV3VOICE = "en-US_LisaV3Voice"; /** en-US_MichaelVoice. */ String EN_US_MICHAELVOICE = "en-US_MichaelVoice"; - /** en-US_MichaelV2Voice. */ - String EN_US_MICHAELV2VOICE = "en-US_MichaelV2Voice"; + /** en-US_MichaelV3Voice. */ + String EN_US_MICHAELV3VOICE = "en-US_MichaelV3Voice"; /** es-ES_EnriqueVoice. */ String ES_ES_ENRIQUEVOICE = "es-ES_EnriqueVoice"; + /** es-ES_EnriqueV3Voice. */ + String ES_ES_ENRIQUEV3VOICE = "es-ES_EnriqueV3Voice"; /** es-ES_LauraVoice. */ String ES_ES_LAURAVOICE = "es-ES_LauraVoice"; + /** es-ES_LauraV3Voice. */ + String ES_ES_LAURAV3VOICE = "es-ES_LauraV3Voice"; /** es-LA_SofiaVoice. */ String ES_LA_SOFIAVOICE = "es-LA_SofiaVoice"; + /** es-LA_SofiaV3Voice. */ + String ES_LA_SOFIAV3VOICE = "es-LA_SofiaV3Voice"; /** es-US_SofiaVoice. */ String ES_US_SOFIAVOICE = "es-US_SofiaVoice"; + /** es-US_SofiaV3Voice. */ + String ES_US_SOFIAV3VOICE = "es-US_SofiaV3Voice"; /** fr-FR_ReneeVoice. */ String FR_FR_RENEEVOICE = "fr-FR_ReneeVoice"; + /** fr-FR_ReneeV3Voice. */ + String FR_FR_RENEEV3VOICE = "fr-FR_ReneeV3Voice"; /** it-IT_FrancescaVoice. */ String IT_IT_FRANCESCAVOICE = "it-IT_FrancescaVoice"; - /** it-IT_FrancescaV2Voice. */ - String IT_IT_FRANCESCAV2VOICE = "it-IT_FrancescaV2Voice"; + /** it-IT_FrancescaV3Voice. */ + String IT_IT_FRANCESCAV3VOICE = "it-IT_FrancescaV3Voice"; /** ja-JP_EmiVoice. */ String JA_JP_EMIVOICE = "ja-JP_EmiVoice"; + /** ja-JP_EmiV3Voice. */ + String JA_JP_EMIV3VOICE = "ja-JP_EmiV3Voice"; /** pt-BR_IsabelaVoice. */ String PT_BR_ISABELAVOICE = "pt-BR_IsabelaVoice"; + /** pt-BR_IsabelaV3Voice. */ + String PT_BR_ISABELAV3VOICE = "pt-BR_IsabelaV3Voice"; } private String voice; @@ -129,7 +144,8 @@ public Builder customizationId(String customizationId) { } private GetVoiceOptions(Builder builder) { - Validator.notEmpty(builder.voice, "voice cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.voice, + "voice cannot be empty"); voice = builder.voice; customizationId = builder.customizationId; } @@ -158,8 +174,8 @@ public String voice() { * Gets the customizationId. * * The customization ID (GUID) of a custom voice model for which information is to be returned. You must make the - * request with service credentials created for the instance of the service that owns the custom model. Omit the - * parameter to see information about the specified voice with no customization. + * request with credentials for the instance of the service that owns the custom model. Omit the parameter to see + * information about the specified voice with no customization. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetWordOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetWordOptions.java index f6bc6bf9721..fdba0b74b42 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetWordOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetWordOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getWord options. @@ -85,8 +84,10 @@ public Builder word(String word) { } private GetWordOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); - Validator.notEmpty(builder.word, "word cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.word, + "word cannot be empty"); customizationId = builder.customizationId; word = builder.word; } @@ -103,8 +104,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoiceModelsOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoiceModelsOptions.java index f7b795491f9..9c4ee47659a 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoiceModelsOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoiceModelsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -20,8 +20,8 @@ public class ListVoiceModelsOptions extends GenericModel { /** - * The language for which custom voice models that are owned by the requesting service credentials are to be returned. - * Omit the parameter to see all custom voice models that are owned by the requester. + * The language for which custom voice models that are owned by the requesting credentials are to be returned. Omit + * the parameter to see all custom voice models that are owned by the requester. */ public interface Language { /** de-DE. */ @@ -101,8 +101,8 @@ public Builder newBuilder() { /** * Gets the language. * - * The language for which custom voice models that are owned by the requesting service credentials are to be returned. - * Omit the parameter to see all custom voice models that are owned by the requester. + * The language for which custom voice models that are owned by the requesting credentials are to be returned. Omit + * the parameter to see all custom voice models that are owned by the requester. * * @return the language */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java index e5cb6b92db3..16fd1717754 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListWordsOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListWordsOptions.java index cd145db5a68..8cdea82023d 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListWordsOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListWordsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listWords options. @@ -69,7 +68,8 @@ public Builder customizationId(String customizationId) { } private ListWordsOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; } @@ -85,8 +85,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Pronunciation.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Pronunciation.java index e6b12f6efaa..6cd493df410 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Pronunciation.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Pronunciation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SupportedFeatures.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SupportedFeatures.java index c1549b3db56..47061cabb05 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SupportedFeatures.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SupportedFeatures.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java index 6c47223439a..d2dd5894c67 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,67 +13,16 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; - -import java.util.List; /** * The synthesize options. */ public class SynthesizeOptions extends GenericModel { - /** - * The voice to use for synthesis. - */ - public interface Voice { - /** de-DE_BirgitVoice. */ - String DE_DE_BIRGITVOICE = "de-DE_BirgitVoice"; - /** de-DE_BirgitV2Voice. */ - String DE_DE_BIRGITV2VOICE = "de-DE_BirgitV2Voice"; - /** de-DE_DieterVoice. */ - String DE_DE_DIETERVOICE = "de-DE_DieterVoice"; - /** de-DE_DieterV2Voice. */ - String DE_DE_DIETERV2VOICE = "de-DE_DieterV2Voice"; - /** en-GB_KateVoice. */ - String EN_GB_KATEVOICE = "en-GB_KateVoice"; - /** en-US_AllisonVoice. */ - String EN_US_ALLISONVOICE = "en-US_AllisonVoice"; - /** en-US_AllisonV2Voice. */ - String EN_US_ALLISONV2VOICE = "en-US_AllisonV2Voice"; - /** en-US_LisaVoice. */ - String EN_US_LISAVOICE = "en-US_LisaVoice"; - /** en-US_LisaV2Voice. */ - String EN_US_LISAV2VOICE = "en-US_LisaV2Voice"; - /** en-US_MichaelVoice. */ - String EN_US_MICHAELVOICE = "en-US_MichaelVoice"; - /** en-US_MichaelV2Voice. */ - String EN_US_MICHAELV2VOICE = "en-US_MichaelV2Voice"; - /** es-ES_EnriqueVoice. */ - String ES_ES_ENRIQUEVOICE = "es-ES_EnriqueVoice"; - /** es-ES_LauraVoice. */ - String ES_ES_LAURAVOICE = "es-ES_LauraVoice"; - /** es-LA_SofiaVoice. */ - String ES_LA_SOFIAVOICE = "es-LA_SofiaVoice"; - /** es-US_SofiaVoice. */ - String ES_US_SOFIAVOICE = "es-US_SofiaVoice"; - /** fr-FR_ReneeVoice. */ - String FR_FR_RENEEVOICE = "fr-FR_ReneeVoice"; - /** it-IT_FrancescaVoice. */ - String IT_IT_FRANCESCAVOICE = "it-IT_FrancescaVoice"; - /** it-IT_FrancescaV2Voice. */ - String IT_IT_FRANCESCAV2VOICE = "it-IT_FrancescaV2Voice"; - /** ja-JP_EmiVoice. */ - String JA_JP_EMIVOICE = "ja-JP_EmiVoice"; - /** pt-BR_IsabelaVoice. */ - String PT_BR_ISABELAVOICE = "pt-BR_IsabelaVoice"; - } - /** * The requested format (MIME type) of the audio. You can use the `Accept` header or the `accept` parameter to specify * the audio format. For more information about specifying an audio format, see **Audio formats (accept types)** in * the method description. - * - * Default: `audio/ogg;codecs=opus`. */ public interface Accept { /** audio/basic. */ @@ -104,28 +53,87 @@ public interface Accept { String AUDIO_WEBM_CODECS_VORBIS = "audio/webm;codecs=vorbis"; } + /** + * The voice to use for synthesis. + */ + public interface Voice { + /** de-DE_BirgitVoice. */ + String DE_DE_BIRGITVOICE = "de-DE_BirgitVoice"; + /** de-DE_BirgitV3Voice. */ + String DE_DE_BIRGITV3VOICE = "de-DE_BirgitV3Voice"; + /** de-DE_DieterVoice. */ + String DE_DE_DIETERVOICE = "de-DE_DieterVoice"; + /** de-DE_DieterV3Voice. */ + String DE_DE_DIETERV3VOICE = "de-DE_DieterV3Voice"; + /** en-GB_KateVoice. */ + String EN_GB_KATEVOICE = "en-GB_KateVoice"; + /** en-GB_KateV3Voice. */ + String EN_GB_KATEV3VOICE = "en-GB_KateV3Voice"; + /** en-US_AllisonVoice. */ + String EN_US_ALLISONVOICE = "en-US_AllisonVoice"; + /** en-US_AllisonV3Voice. */ + String EN_US_ALLISONV3VOICE = "en-US_AllisonV3Voice"; + /** en-US_LisaVoice. */ + String EN_US_LISAVOICE = "en-US_LisaVoice"; + /** en-US_LisaV3Voice. */ + String EN_US_LISAV3VOICE = "en-US_LisaV3Voice"; + /** en-US_MichaelVoice. */ + String EN_US_MICHAELVOICE = "en-US_MichaelVoice"; + /** en-US_MichaelV3Voice. */ + String EN_US_MICHAELV3VOICE = "en-US_MichaelV3Voice"; + /** es-ES_EnriqueVoice. */ + String ES_ES_ENRIQUEVOICE = "es-ES_EnriqueVoice"; + /** es-ES_EnriqueV3Voice. */ + String ES_ES_ENRIQUEV3VOICE = "es-ES_EnriqueV3Voice"; + /** es-ES_LauraVoice. */ + String ES_ES_LAURAVOICE = "es-ES_LauraVoice"; + /** es-ES_LauraV3Voice. */ + String ES_ES_LAURAV3VOICE = "es-ES_LauraV3Voice"; + /** es-LA_SofiaVoice. */ + String ES_LA_SOFIAVOICE = "es-LA_SofiaVoice"; + /** es-LA_SofiaV3Voice. */ + String ES_LA_SOFIAV3VOICE = "es-LA_SofiaV3Voice"; + /** es-US_SofiaVoice. */ + String ES_US_SOFIAVOICE = "es-US_SofiaVoice"; + /** es-US_SofiaV3Voice. */ + String ES_US_SOFIAV3VOICE = "es-US_SofiaV3Voice"; + /** fr-FR_ReneeVoice. */ + String FR_FR_RENEEVOICE = "fr-FR_ReneeVoice"; + /** fr-FR_ReneeV3Voice. */ + String FR_FR_RENEEV3VOICE = "fr-FR_ReneeV3Voice"; + /** it-IT_FrancescaVoice. */ + String IT_IT_FRANCESCAVOICE = "it-IT_FrancescaVoice"; + /** it-IT_FrancescaV3Voice. */ + String IT_IT_FRANCESCAV3VOICE = "it-IT_FrancescaV3Voice"; + /** ja-JP_EmiVoice. */ + String JA_JP_EMIVOICE = "ja-JP_EmiVoice"; + /** ja-JP_EmiV3Voice. */ + String JA_JP_EMIV3VOICE = "ja-JP_EmiV3Voice"; + /** pt-BR_IsabelaVoice. */ + String PT_BR_ISABELAVOICE = "pt-BR_IsabelaVoice"; + /** pt-BR_IsabelaV3Voice. */ + String PT_BR_ISABELAV3VOICE = "pt-BR_IsabelaV3Voice"; + } + private String text; + private String accept; private String voice; private String customizationId; - private List timings; - private String accept; /** * Builder. */ public static class Builder { private String text; + private String accept; private String voice; private String customizationId; - private List timings; - private String accept; private Builder(SynthesizeOptions synthesizeOptions) { this.text = synthesizeOptions.text; + this.accept = synthesizeOptions.accept; this.voice = synthesizeOptions.voice; this.customizationId = synthesizeOptions.customizationId; - this.timings = synthesizeOptions.timings; - this.accept = synthesizeOptions.accept; } /** @@ -163,6 +171,17 @@ public Builder text(String text) { return this; } + /** + * Set the accept. + * + * @param accept the accept + * @return the SynthesizeOptions builder + */ + public Builder accept(String accept) { + this.accept = accept; + return this; + } + /** * Set the voice. * @@ -184,37 +203,15 @@ public Builder customizationId(String customizationId) { this.customizationId = customizationId; return this; } - - /** - * Set the timings. - * - * @param timings the timings - * @return the SynthesizeOptions builder - */ - public Builder timings(List timings) { - this.timings = timings; - return this; - } - - /** - * Set the accept. - * - * @param accept the accept - * @return the SynthesizeOptions builder - */ - public Builder accept(String accept) { - this.accept = accept; - return this; - } } private SynthesizeOptions(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; + accept = builder.accept; voice = builder.voice; customizationId = builder.customizationId; - timings = builder.timings; - accept = builder.accept; } /** @@ -237,6 +234,19 @@ public String text() { return text; } + /** + * Gets the accept. + * + * The requested format (MIME type) of the audio. You can use the `Accept` header or the `accept` parameter to specify + * the audio format. For more information about specifying an audio format, see **Audio formats (accept types)** in + * the method description. + * + * @return the accept + */ + public String accept() { + return accept; + } + /** * Gets the voice. * @@ -253,43 +263,12 @@ public String voice() { * * The customization ID (GUID) of a custom voice model to use for the synthesis. If a custom voice model is specified, * it is guaranteed to work only if it matches the language of the indicated voice. You must make the request with - * service credentials created for the instance of the service that owns the custom model. Omit the parameter to use - * the specified voice with no customization. + * credentials for the instance of the service that owns the custom model. Omit the parameter to use the specified + * voice with no customization. * * @return the customizationId */ public String customizationId() { return customizationId; } - - /** - * Gets the timings. - * - * An array that specifies whether the service is to return word timing information for all strings of the input - * text. Specify `words` as the element of the array to request word timing information. The service returns the - * start and end time of each word of the input. Specify an empty array or omit the parameter to receive no word - * timing information. Not supported for Japanese input text. - * - * NOTE: This parameter only works for the `synthesizeUsingWebSocket` method. - * - * @return the timings - */ - public List timings() { - return timings; - } - - /** - * Gets the accept. - * - * The requested format (MIME type) of the audio. You can use the `Accept` header or the `accept` parameter to specify - * the audio format. For more information about specifying an audio format, see **Audio formats (accept types)** in - * the method description. - * - * Default: `audio/ogg;codecs=opus`. - * - * @return the accept - */ - public String accept() { - return accept; - } } diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Translation.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Translation.java index 47e837043de..c03a3630882 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Translation.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Translation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -67,6 +67,81 @@ public interface PartOfSpeech { @SerializedName("part_of_speech") private String partOfSpeech; + /** + * Builder. + */ + public static class Builder { + private String translation; + private String partOfSpeech; + + private Builder(Translation translation) { + this.translation = translation.translation; + this.partOfSpeech = translation.partOfSpeech; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param translation the translation + */ + public Builder(String translation) { + this.translation = translation; + } + + /** + * Builds a Translation. + * + * @return the translation + */ + public Translation build() { + return new Translation(this); + } + + /** + * Set the translation. + * + * @param translation the translation + * @return the Translation builder + */ + public Builder translation(String translation) { + this.translation = translation; + return this; + } + + /** + * Set the partOfSpeech. + * + * @param partOfSpeech the partOfSpeech + * @return the Translation builder + */ + public Builder partOfSpeech(String partOfSpeech) { + this.partOfSpeech = partOfSpeech; + return this; + } + } + + private Translation(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.translation, + "translation cannot be null"); + translation = builder.translation; + partOfSpeech = builder.partOfSpeech; + } + + /** + * New builder. + * + * @return a Translation builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the translation. * @@ -76,7 +151,7 @@ public interface PartOfSpeech { * * @return the translation */ - public String getTranslation() { + public String translation() { return translation; } @@ -90,25 +165,7 @@ public String getTranslation() { * * @return the partOfSpeech */ - public String getPartOfSpeech() { + public String partOfSpeech() { return partOfSpeech; } - - /** - * Sets the translation. - * - * @param translation the new translation - */ - public void setTranslation(final String translation) { - this.translation = translation; - } - - /** - * Sets the partOfSpeech. - * - * @param partOfSpeech the new partOfSpeech - */ - public void setPartOfSpeech(final String partOfSpeech) { - this.partOfSpeech = partOfSpeech; - } } diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/UpdateVoiceModelOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/UpdateVoiceModelOptions.java index fa2b4d75071..5c5e0932ab8 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/UpdateVoiceModelOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/UpdateVoiceModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateVoiceModel options. @@ -75,7 +74,8 @@ public UpdateVoiceModelOptions build() { * @return the UpdateVoiceModelOptions builder */ public Builder addWord(Word word) { - Validator.notNull(word, "word cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(word, + "word cannot be null"); if (this.words == null) { this.words = new ArrayList(); } @@ -130,7 +130,8 @@ public Builder words(List words) { } private UpdateVoiceModelOptions(Builder builder) { - Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.customizationId, + "customizationId cannot be empty"); customizationId = builder.customizationId; name = builder.name; description = builder.description; @@ -149,8 +150,8 @@ public Builder newBuilder() { /** * Gets the customizationId. * - * The customization ID (GUID) of the custom voice model. You must make the request with service credentials created - * for the instance of the service that owns the custom model. + * The customization ID (GUID) of the custom voice model. You must make the request with credentials for the instance + * of the service that owns the custom model. * * @return the customizationId */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voice.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voice.java index 18407b024e4..57e16711427 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voice.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voice.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModel.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModel.java index a18d5f25dfe..ed2626f7091 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModel.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -70,7 +70,7 @@ public String getLanguage() { /** * Gets the owner. * - * The GUID of the service credentials for the instance of the service that owns the custom voice model. + * The GUID of the credentials for the instance of the service that owns the custom voice model. * * @return the owner */ @@ -93,9 +93,9 @@ public String getCreated() { /** * Gets the lastModified. * - * The date and time in Coordinated Universal Time (UTC) at which the custom voice model was last modified. Equals - * `created` when a new voice model is first added but has yet to be updated. The value is provided in full ISO 8601 - * format (`YYYY-MM-DDThh:mm:ss.sTZD`). + * The date and time in Coordinated Universal Time (UTC) at which the custom voice model was last modified. The + * `created` and `updated` fields are equal when a voice model is first added but has yet to be updated. The value is + * provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`). * * @return the lastModified */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModels.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModels.java index 9e05bbd35fa..cc534746027 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModels.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/VoiceModels.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -27,8 +27,8 @@ public class VoiceModels extends GenericModel { * Gets the customizations. * * An array of `VoiceModel` objects that provides information about each available custom voice model. The array is - * empty if the requesting service credentials own no custom voice models (if no language is specified) or own no - * custom voice models for the specified language. + * empty if the requesting credentials own no custom voice models (if no language is specified) or own no custom voice + * models for the specified language. * * @return the customizations */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voices.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voices.java index 0a7b9134d97..2b4e892fb49 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voices.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Voices.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Word.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Word.java index 8b178537ea2..8f7e56680d9 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Word.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Word.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -68,6 +68,99 @@ public interface PartOfSpeech { @SerializedName("part_of_speech") private String partOfSpeech; + /** + * Builder. + */ + public static class Builder { + private String word; + private String translation; + private String partOfSpeech; + + private Builder(Word word) { + this.word = word.word; + this.translation = word.translation; + this.partOfSpeech = word.partOfSpeech; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param word the word + * @param translation the translation + */ + public Builder(String word, String translation) { + this.word = word; + this.translation = translation; + } + + /** + * Builds a Word. + * + * @return the word + */ + public Word build() { + return new Word(this); + } + + /** + * Set the word. + * + * @param word the word + * @return the Word builder + */ + public Builder word(String word) { + this.word = word; + return this; + } + + /** + * Set the translation. + * + * @param translation the translation + * @return the Word builder + */ + public Builder translation(String translation) { + this.translation = translation; + return this; + } + + /** + * Set the partOfSpeech. + * + * @param partOfSpeech the partOfSpeech + * @return the Word builder + */ + public Builder partOfSpeech(String partOfSpeech) { + this.partOfSpeech = partOfSpeech; + return this; + } + } + + private Word(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.word, + "word cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.translation, + "translation cannot be null"); + word = builder.word; + translation = builder.translation; + partOfSpeech = builder.partOfSpeech; + } + + /** + * New builder. + * + * @return a Word builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the word. * @@ -75,7 +168,7 @@ public interface PartOfSpeech { * * @return the word */ - public String getWord() { + public String word() { return word; } @@ -88,7 +181,7 @@ public String getWord() { * * @return the translation */ - public String getTranslation() { + public String translation() { return translation; } @@ -102,34 +195,7 @@ public String getTranslation() { * * @return the partOfSpeech */ - public String getPartOfSpeech() { + public String partOfSpeech() { return partOfSpeech; } - - /** - * Sets the word. - * - * @param word the new word - */ - public void setWord(final String word) { - this.word = word; - } - - /** - * Sets the translation. - * - * @param translation the new translation - */ - public void setTranslation(final String translation) { - this.translation = translation; - } - - /** - * Sets the partOfSpeech. - * - * @param partOfSpeech the new partOfSpeech - */ - public void setPartOfSpeech(final String partOfSpeech) { - this.partOfSpeech = partOfSpeech; - } } diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Words.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Words.java index e261270f723..9026eaa8c2f 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Words.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/Words.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.text_to_speech.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -26,6 +27,84 @@ public class Words extends GenericModel { private List words; + /** + * Builder. + */ + public static class Builder { + private List words; + + private Builder(Words words) { + this.words = words.words; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param words the words + */ + public Builder(List words) { + this.words = words; + } + + /** + * Builds a Words. + * + * @return the words + */ + public Words build() { + return new Words(this); + } + + /** + * Adds an word to words. + * + * @param word the new word + * @return the Words builder + */ + public Builder addWord(Word word) { + com.ibm.cloud.sdk.core.util.Validator.notNull(word, + "word cannot be null"); + if (this.words == null) { + this.words = new ArrayList(); + } + this.words.add(word); + return this; + } + + /** + * Set the words. + * Existing words will be replaced. + * + * @param words the words + * @return the Words builder + */ + public Builder words(List words) { + this.words = words; + return this; + } + } + + private Words(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.words, + "words cannot be null"); + words = builder.words; + } + + /** + * New builder. + * + * @return a Words builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the words. * @@ -38,16 +117,7 @@ public class Words extends GenericModel { * * @return the words */ - public List getWords() { + public List words() { return words; } - - /** - * Sets the words. - * - * @param words the new words - */ - public void setWords(final List words) { - this.words = words; - } } diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/package-info.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/package-info.java index 1e13bc762fe..e4bf11a05ae 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/package-info.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java index af80d93e2c6..eb3896ff773 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,12 +16,10 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.tone_analyzer.v3.model.ToneAnalysis; import com.ibm.watson.tone_analyzer.v3.model.ToneChatOptions; @@ -41,7 +39,7 @@ * `X-Watson-Learning-Opt-Out` request header, the service does not log or retain data from requests and responses. * * @version v3 - * @see Tone Analyzer + * @see Tone Analyzer */ public class ToneAnalyzer extends BaseService { @@ -51,54 +49,19 @@ public class ToneAnalyzer extends BaseService { private String versionDate; /** - * Instantiates a new `ToneAnalyzer`. + * Constructs a new `ToneAnalyzer` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use ToneAnalyzer(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public ToneAnalyzer(String versionDate) { - super(SERVICE_NAME); + public ToneAnalyzer(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `ToneAnalyzer` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use ToneAnalyzer(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public ToneAnalyzer(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `ToneAnalyzer` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public ToneAnalyzer(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -126,7 +89,8 @@ public ToneAnalyzer(String versionDate, AuthenticatorConfig authenticatorConfig) * @return a {@link ServiceCall} with a response type of {@link ToneAnalysis} */ public ServiceCall tone(ToneOptions toneOptions) { - Validator.notNull(toneOptions, "toneOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(toneOptions, + "toneOptions cannot be null"); String[] pathSegments = { "v3/tone" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -135,22 +99,23 @@ public ServiceCall tone(ToneOptions toneOptions) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); + if (toneOptions.contentType() != null) { + builder.header("Content-Type", toneOptions.contentType()); + } if (toneOptions.contentLanguage() != null) { builder.header("Content-Language", toneOptions.contentLanguage()); } if (toneOptions.acceptLanguage() != null) { builder.header("Accept-Language", toneOptions.acceptLanguage()); } - if (toneOptions.contentType() != null) { - builder.header("Content-Type", toneOptions.contentType()); - } if (toneOptions.sentences() != null) { builder.query("sentences", String.valueOf(toneOptions.sentences())); } if (toneOptions.tones() != null) { builder.query("tones", RequestUtils.join(toneOptions.tones(), ",")); } - builder.bodyContent(toneOptions.contentType(), toneOptions.toneInput(), null, toneOptions.body()); + builder.bodyContent(toneOptions.contentType(), toneOptions.toneInput(), + null, toneOptions.body()); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { }.getType()); @@ -177,7 +142,8 @@ public ServiceCall tone(ToneOptions toneOptions) { * @return a {@link ServiceCall} with a response type of {@link UtteranceAnalyses} */ public ServiceCall toneChat(ToneChatOptions toneChatOptions) { - Validator.notNull(toneChatOptions, "toneChatOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(toneChatOptions, + "toneChatOptions cannot be null"); String[] pathSegments = { "v3/tone_chat" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -193,7 +159,8 @@ public ServiceCall toneChat(ToneChatOptions toneChatOptions) builder.header("Accept-Language", toneChatOptions.acceptLanguage()); } final JsonObject contentJson = new JsonObject(); - contentJson.add("utterances", GsonSingleton.getGson().toJsonTree(toneChatOptions.utterances())); + contentJson.add("utterances", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(toneChatOptions + .utterances())); builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken() { diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/DocumentAnalysis.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/DocumentAnalysis.java index 5fc40806abe..92a3db1f58b 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/DocumentAnalysis.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/DocumentAnalysis.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/SentenceAnalysis.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/SentenceAnalysis.java index 7ec24807438..bed3cc2cfbc 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/SentenceAnalysis.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/SentenceAnalysis.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneAnalysis.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneAnalysis.java index 5af6ecf448c..e2fddcb777c 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneAnalysis.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneAnalysis.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneCategory.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneCategory.java index b8f4ba27bb5..6c83d6c4543 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneCategory.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneCategory.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatOptions.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatOptions.java index 36455cd685c..9faab8e8392 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatOptions.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The toneChat options. @@ -117,7 +116,8 @@ public ToneChatOptions build() { * @return the ToneChatOptions builder */ public Builder addUtterances(Utterance utterances) { - Validator.notNull(utterances, "utterances cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(utterances, + "utterances cannot be null"); if (this.utterances == null) { this.utterances = new ArrayList(); } @@ -161,7 +161,8 @@ public Builder acceptLanguage(String acceptLanguage) { } private ToneChatOptions(Builder builder) { - Validator.notNull(builder.utterances, "utterances cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.utterances, + "utterances cannot be null"); utterances = builder.utterances; contentLanguage = builder.contentLanguage; acceptLanguage = builder.acceptLanguage; diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatScore.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatScore.java index 3f4f7a8f63b..007e5aa97ca 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatScore.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneChatScore.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneInput.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneInput.java index 9d6de1e41f1..4759a22d07b 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneInput.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneInput.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.tone_analyzer.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * Input for the general-purpose endpoint. @@ -69,7 +68,8 @@ public Builder text(String text) { } private ToneInput(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; } diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneOptions.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneOptions.java index 4da2d560551..eda5579efca 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneOptions.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,13 +16,25 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The tone options. */ public class ToneOptions extends GenericModel { + /** + * The type of the input. A character encoding can be specified by including a `charset` parameter. For example, + * 'text/plain;charset=utf-8'. + */ + public interface ContentType { + /** application/json. */ + String APPLICATION_JSON = "application/json"; + /** text/plain. */ + String TEXT_PLAIN = "text/plain"; + /** text/html. */ + String TEXT_HTML = "text/html"; + } + public interface Tone { /** emotion. */ String EMOTION = "emotion"; @@ -77,26 +89,13 @@ public interface AcceptLanguage { String ZH_TW = "zh-tw"; } - /** - * The type of the input. A character encoding can be specified by including a `charset` parameter. For example, - * 'text/plain;charset=utf-8'. - */ - public interface ContentType { - /** application/json. */ - String APPLICATION_JSON = "application/json"; - /** text/plain. */ - String TEXT_PLAIN = "text/plain"; - /** text/html. */ - String TEXT_HTML = "text/html"; - } - private ToneInput toneInput; private String body; + private String contentType; private Boolean sentences; private List tones; private String contentLanguage; private String acceptLanguage; - private String contentType; /** * Builder. @@ -104,20 +103,20 @@ public interface ContentType { public static class Builder { private ToneInput toneInput; private String body; + private String contentType; private Boolean sentences; private List tones; private String contentLanguage; private String acceptLanguage; - private String contentType; private Builder(ToneOptions toneOptions) { this.toneInput = toneOptions.toneInput; this.body = toneOptions.body; + this.contentType = toneOptions.contentType; this.sentences = toneOptions.sentences; this.tones = toneOptions.tones; this.contentLanguage = toneOptions.contentLanguage; this.acceptLanguage = toneOptions.acceptLanguage; - this.contentType = toneOptions.contentType; } /** @@ -142,7 +141,8 @@ public ToneOptions build() { * @return the ToneOptions builder */ public Builder addTone(String tone) { - Validator.notNull(tone, "tone cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(tone, + "tone cannot be null"); if (this.tones == null) { this.tones = new ArrayList(); } @@ -203,7 +203,7 @@ public Builder acceptLanguage(String acceptLanguage) { */ public Builder toneInput(ToneInput toneInput) { this.toneInput = toneInput; - this.contentType = ToneOptions.ContentType.APPLICATION_JSON; + this.contentType = "application/json"; return this; } @@ -215,7 +215,7 @@ public Builder toneInput(ToneInput toneInput) { */ public Builder text(String text) { this.body = text; - this.contentType = ToneOptions.ContentType.TEXT_PLAIN; + this.contentType = "text/plain"; return this; } @@ -227,7 +227,7 @@ public Builder text(String text) { */ public Builder html(String html) { this.body = html; - this.contentType = ToneOptions.ContentType.TEXT_HTML; + this.contentType = "text/html"; return this; } } @@ -235,11 +235,11 @@ public Builder html(String html) { private ToneOptions(Builder builder) { toneInput = builder.toneInput; body = builder.body; + contentType = builder.contentType; sentences = builder.sentences; tones = builder.tones; contentLanguage = builder.contentLanguage; acceptLanguage = builder.acceptLanguage; - contentType = builder.contentType; } /** @@ -275,6 +275,18 @@ public String body() { return body; } + /** + * Gets the contentType. + * + * The type of the input. A character encoding can be specified by including a `charset` parameter. For example, + * 'text/plain;charset=utf-8'. + * + * @return the contentType + */ + public String contentType() { + return contentType; + } + /** * Gets the sentences. * @@ -331,16 +343,4 @@ public String contentLanguage() { public String acceptLanguage() { return acceptLanguage; } - - /** - * Gets the contentType. - * - * The type of the input. A character encoding can be specified by including a `charset` parameter. For example, - * 'text/plain;charset=utf-8'. - * - * @return the contentType - */ - public String contentType() { - return contentType; - } } diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneScore.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneScore.java index ca04ca9d70d..42ae3db97b5 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneScore.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/ToneScore.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/Utterance.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/Utterance.java index 6187db1b36e..3b92dc9b24a 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/Utterance.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/Utterance.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.tone_analyzer.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * An utterance for the input of the general-purpose endpoint. @@ -83,7 +82,8 @@ public Builder user(String user) { } private Utterance(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; user = builder.user; } diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalyses.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalyses.java index 5d87cfe60bb..feae647ec14 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalyses.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalyses.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalysis.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalysis.java index bb31687153f..62dc5632366 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalysis.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/model/UtteranceAnalysis.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/package-info.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/package-info.java index f3bc7f1df7f..240abaea91a 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/package-info.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java index a1672261900..d34aa4c7191 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -15,11 +15,10 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.visual_recognition.v3.model.ClassifiedImages; import com.ibm.watson.visual_recognition.v3.model.Classifier; @@ -38,7 +37,6 @@ import java.util.Map; import java.util.Map.Entry; import okhttp3.MultipartBody; -import okhttp3.RequestBody; /** * The IBM Watson™ Visual Recognition service uses deep learning algorithms to identify scenes, objects, and faces @@ -46,7 +44,7 @@ * your needs. * * @version v3 - * @see Visual Recognition + * @see Visual Recognition */ public class VisualRecognition extends BaseService { @@ -56,39 +54,19 @@ public class VisualRecognition extends BaseService { private String versionDate; /** - * Instantiates a new `VisualRecognition`. + * Constructs a new `VisualRecognition` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use VisualRecognition(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public VisualRecognition(String versionDate) { - super(SERVICE_NAME); + public VisualRecognition(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `VisualRecognition` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public VisualRecognition(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -101,9 +79,11 @@ public VisualRecognition(String versionDate, AuthenticatorConfig authenticatorCo * @return a {@link ServiceCall} with a response type of {@link ClassifiedImages} */ public ServiceCall classify(ClassifyOptions classifyOptions) { - Validator.notNull(classifyOptions, "classifyOptions cannot be null"); - Validator.isTrue((classifyOptions.imagesFile() != null) || (classifyOptions.url() != null) || (classifyOptions - .threshold() != null) || (classifyOptions.owners() != null) || (classifyOptions.classifierIds() != null), + com.ibm.cloud.sdk.core.util.Validator.notNull(classifyOptions, + "classifyOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((classifyOptions.imagesFile() != null) || (classifyOptions + .url() != null) || (classifyOptions.threshold() != null) || (classifyOptions.owners() != null) + || (classifyOptions.classifierIds() != null), "At least one of imagesFile, url, threshold, owners, or classifierIds must be supplied."); String[] pathSegments = { "v3/classify" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); @@ -119,7 +99,7 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (classifyOptions.imagesFile() != null) { - RequestBody imagesFileBody = RequestUtils.inputStreamBody(classifyOptions.imagesFile(), classifyOptions + okhttp3.RequestBody imagesFileBody = RequestUtils.inputStreamBody(classifyOptions.imagesFile(), classifyOptions .imagesFileContentType()); multipartBuilder.addFormDataPart("images_file", classifyOptions.imagesFilename(), imagesFileBody); } @@ -173,9 +153,10 @@ public ServiceCall classify() { * @return a {@link ServiceCall} with a response type of {@link DetectedFaces} */ public ServiceCall detectFaces(DetectFacesOptions detectFacesOptions) { - Validator.notNull(detectFacesOptions, "detectFacesOptions cannot be null"); - Validator.isTrue((detectFacesOptions.imagesFile() != null) || (detectFacesOptions.url() != null), - "At least one of imagesFile or url must be supplied."); + com.ibm.cloud.sdk.core.util.Validator.notNull(detectFacesOptions, + "detectFacesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((detectFacesOptions.imagesFile() != null) || (detectFacesOptions + .url() != null), "At least one of imagesFile or url must be supplied."); String[] pathSegments = { "v3/detect_faces" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -190,8 +171,8 @@ public ServiceCall detectFaces(DetectFacesOptions detectFacesOpti MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (detectFacesOptions.imagesFile() != null) { - RequestBody imagesFileBody = RequestUtils.inputStreamBody(detectFacesOptions.imagesFile(), detectFacesOptions - .imagesFileContentType()); + okhttp3.RequestBody imagesFileBody = RequestUtils.inputStreamBody(detectFacesOptions.imagesFile(), + detectFacesOptions.imagesFileContentType()); multipartBuilder.addFormDataPart("images_file", detectFacesOptions.imagesFilename(), imagesFileBody); } if (detectFacesOptions.url() != null) { @@ -230,17 +211,24 @@ public ServiceCall detectFaces() { * Create a classifier. * * Train a new multi-faceted classifier on the uploaded image data. Create your custom classifier with positive or - * negative examples. Include at least two sets of examples, either two positive example files or one positive and one - * negative file. You can upload a maximum of 256 MB per call. + * negative example training images. Include at least two sets of examples, either two positive example files or one + * positive and one negative file. You can upload a maximum of 256 MB per call. * - * Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image file names, and classifier and class - * names). The service assumes UTF-8 encoding if it encounters non-ASCII characters. + * **Tips when creating:** + * + * - If you set the **X-Watson-Learning-Opt-Out** header parameter to `true` when you create a classifier, the example + * training images are not stored. Save your training images locally. For more information, see [Data + * collection](#data-collection). + * + * - Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image file names, and classifier and + * class names). The service assumes UTF-8 encoding if it encounters non-ASCII characters. * * @param createClassifierOptions the {@link CreateClassifierOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Classifier} */ public ServiceCall createClassifier(CreateClassifierOptions createClassifierOptions) { - Validator.notNull(createClassifierOptions, "createClassifierOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createClassifierOptions, + "createClassifierOptions cannot be null"); String[] pathSegments = { "v3/classifiers" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -254,12 +242,12 @@ public ServiceCall createClassifier(CreateClassifierOptions createCl multipartBuilder.addFormDataPart("name", createClassifierOptions.name()); for (Map.Entry entry : createClassifierOptions.positiveExamples().entrySet()) { String partName = String.format("%s_positive_examples", entry.getKey()); - RequestBody part = RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); + okhttp3.RequestBody part = RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); multipartBuilder.addFormDataPart(partName, entry.getKey(), part); } if (createClassifierOptions.negativeExamples() != null) { - RequestBody negativeExamplesBody = RequestUtils.inputStreamBody(createClassifierOptions.negativeExamples(), - "application/octet-stream"); + okhttp3.RequestBody negativeExamplesBody = RequestUtils.inputStreamBody(createClassifierOptions + .negativeExamples(), "application/octet-stream"); multipartBuilder.addFormDataPart("negative_examples", createClassifierOptions.negativeExamplesFilename(), negativeExamplesBody); } @@ -314,7 +302,8 @@ public ServiceCall listClassifiers() { * @return a {@link ServiceCall} with a response type of {@link Classifier} */ public ServiceCall getClassifier(GetClassifierOptions getClassifierOptions) { - Validator.notNull(getClassifierOptions, "getClassifierOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getClassifierOptions, + "getClassifierOptions cannot be null"); String[] pathSegments = { "v3/classifiers" }; String[] pathParameters = { getClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -336,24 +325,30 @@ public ServiceCall getClassifier(GetClassifierOptions getClassifierO * * Update a custom classifier by adding new positive or negative classes or by adding new images to existing classes. * You must supply at least one set of positive or negative examples. For details, see [Updating custom - * classifiers] - * (https://cloud.ibm.com/docs/services/visual-recognition - * ?topic=visual-recognition-customizing#updating-custom-classifiers). + * classifiers](https://cloud.ibm.com/docs/services/visual-recognition?topic=visual-recognition-customizing#updating-custom-classifiers). * * Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image file names, and classifier and class * names). The service assumes UTF-8 encoding if it encounters non-ASCII characters. * - * **Tip:** Don't make retraining calls on a classifier until the status is ready. When you submit retraining requests - * in parallel, the last request overwrites the previous requests. The retrained property shows the last time the + * **Tips about retraining:** + * + * - You can't update the classifier if the **X-Watson-Learning-Opt-Out** header parameter was set to `true` when the + * classifier was created. Training images are not stored in that case. Instead, create another classifier. For more + * information, see [Data collection](#data-collection). + * + * - Don't make retraining calls on a classifier until the status is ready. When you submit retraining requests in + * parallel, the last request overwrites the previous requests. The `retrained` property shows the last time the * classifier retraining finished. * * @param updateClassifierOptions the {@link UpdateClassifierOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Classifier} */ public ServiceCall updateClassifier(UpdateClassifierOptions updateClassifierOptions) { - Validator.notNull(updateClassifierOptions, "updateClassifierOptions cannot be null"); - Validator.isTrue((updateClassifierOptions.positiveExamples() != null) || (updateClassifierOptions - .negativeExamples() != null), "At least one of positiveExamples or negativeExamples must be supplied."); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateClassifierOptions, + "updateClassifierOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((updateClassifierOptions.positiveExamples() != null) + || (updateClassifierOptions.negativeExamples() != null), + "At least one of positiveExamples or negativeExamples must be supplied."); String[] pathSegments = { "v3/classifiers" }; String[] pathParameters = { updateClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -369,13 +364,13 @@ public ServiceCall updateClassifier(UpdateClassifierOptions updateCl if (updateClassifierOptions.positiveExamples() != null) { for (Map.Entry entry : updateClassifierOptions.positiveExamples().entrySet()) { String partName = String.format("%s_positive_examples", entry.getKey()); - RequestBody part = RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); + okhttp3.RequestBody part = RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); multipartBuilder.addFormDataPart(partName, entry.getKey(), part); } } if (updateClassifierOptions.negativeExamples() != null) { - RequestBody negativeExamplesBody = RequestUtils.inputStreamBody(updateClassifierOptions.negativeExamples(), - "application/octet-stream"); + okhttp3.RequestBody negativeExamplesBody = RequestUtils.inputStreamBody(updateClassifierOptions + .negativeExamples(), "application/octet-stream"); multipartBuilder.addFormDataPart("negative_examples", updateClassifierOptions.negativeExamplesFilename(), negativeExamplesBody); } @@ -393,7 +388,8 @@ public ServiceCall updateClassifier(UpdateClassifierOptions updateCl * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteClassifier(DeleteClassifierOptions deleteClassifierOptions) { - Validator.notNull(deleteClassifierOptions, "deleteClassifierOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteClassifierOptions, + "deleteClassifierOptions cannot be null"); String[] pathSegments = { "v3/classifiers" }; String[] pathParameters = { deleteClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -411,14 +407,15 @@ public ServiceCall deleteClassifier(DeleteClassifierOptions deleteClassifi /** * Retrieve a Core ML model of a classifier. * - * Download a Core ML model file (.mlmodel) of a custom classifier that returns \"core_ml_enabled\": true in + * Download a Core ML model file (.mlmodel) of a custom classifier that returns "core_ml_enabled": true in * the classifier details. * * @param getCoreMlModelOptions the {@link GetCoreMlModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link InputStream} */ public ServiceCall getCoreMlModel(GetCoreMlModelOptions getCoreMlModelOptions) { - Validator.notNull(getCoreMlModelOptions, "getCoreMlModelOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getCoreMlModelOptions, + "getCoreMlModelOptions cannot be null"); String[] pathSegments = { "v3/classifiers", "core_ml_model" }; String[] pathParameters = { getCoreMlModelOptions.classifierId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -447,7 +444,8 @@ public ServiceCall getCoreMlModel(GetCoreMlModelOptions getCoreMlMo * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - Validator.notNull(deleteUserDataOptions, "deleteUserDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, + "deleteUserDataOptions cannot be null"); String[] pathSegments = { "v3/user_data" }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java index 98407260d8c..187ef6d543e 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -21,16 +21,16 @@ public class Class extends GenericModel { @SerializedName("class") - private String className; + private String xclass; /** - * Gets the className. + * Gets the xclass. * * The name of the class. * - * @return the className + * @return the xclass */ - public String getClassName() { - return className; + public String getXclass() { + return xclass; } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java index 44852c0d975..0491609f071 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -21,13 +21,13 @@ public class ClassResult extends GenericModel { @SerializedName("class") - private String className; + private String xclass; private Float score; @SerializedName("type_hierarchy") private String typeHierarchy; /** - * Gets the className. + * Gets the xclass. * * Name of the class. * @@ -36,10 +36,10 @@ public class ClassResult extends GenericModel { * response might not be in the specified language when the requested language is not supported or when there is no * translation for the class name. * - * @return the className + * @return the xclass */ - public String getClassName() { - return className; + public String getXclass() { + return xclass; } /** diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImage.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImage.java index bdf2cac6a76..132a5076ae1 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImage.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImages.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImages.java index d1bfa7e5945..15beb4365e8 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImages.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifiedImages.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifier.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifier.java index 7d24161b410..18558dfdae5 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifier.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifierResult.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifierResult.java index d12a5aaf1ed..9a3195e2e29 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifierResult.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifierResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifiers.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifiers.java index 2ec4f465e7c..8a65e2782ad 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifiers.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Classifiers.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifyOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifyOptions.java index a76bda27e71..8f60c9e941f 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifyOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassifyOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -20,7 +20,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The classify options. @@ -110,7 +109,8 @@ public ClassifyOptions build() { * @return the ClassifyOptions builder */ public Builder addOwner(String owner) { - Validator.notNull(owner, "owner cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(owner, + "owner cannot be null"); if (this.owners == null) { this.owners = new ArrayList(); } @@ -125,7 +125,8 @@ public Builder addOwner(String owner) { * @return the ClassifyOptions builder */ public Builder addClassifierId(String classifierId) { - Validator.notNull(classifierId, "classifierId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(classifierId, + "classifierId cannot be null"); if (this.classifierIds == null) { this.classifierIds = new ArrayList(); } @@ -239,7 +240,7 @@ public Builder imagesFile(File imagesFile) throws FileNotFoundException { } private ClassifyOptions(Builder builder) { - Validator.isTrue((builder.imagesFile == null) || (builder.imagesFilename != null), + com.ibm.cloud.sdk.core.util.Validator.isTrue((builder.imagesFile == null) || (builder.imagesFilename != null), "imagesFilename cannot be null if imagesFile is not null."); imagesFile = builder.imagesFile; imagesFilename = builder.imagesFilename; diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/CreateClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/CreateClassifierOptions.java index 8efad2219eb..84628d45b53 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/CreateClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/CreateClassifierOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -20,7 +20,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createClassifier options. @@ -80,8 +79,10 @@ public CreateClassifierOptions build() { * @return the CreateClassifierOptions builder */ public Builder addPositiveExamples(String classname, InputStream positiveExamples) { - Validator.notNull(classname, "classname cannot be null"); - Validator.notNull(positiveExamples, "positiveExamples cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(classname, + "classname cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(positiveExamples, + "positiveExamples cannot be null"); if (this.positiveExamples == null) { this.positiveExamples = new HashMap(); } @@ -164,10 +165,13 @@ public Builder negativeExamples(File negativeExamples) throws FileNotFoundExcept } private CreateClassifierOptions(Builder builder) { - Validator.notNull(builder.name, "name cannot be null"); - Validator.isTrue((builder.negativeExamples == null) || (builder.negativeExamplesFilename != null), + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((builder.negativeExamples == null) + || (builder.negativeExamplesFilename != null), "negativeExamplesFilename cannot be null if negativeExamples is not null."); - Validator.isTrue(builder.positiveExamples != null && !builder.positiveExamples.isEmpty(), + com.ibm.cloud.sdk.core.util.Validator.isTrue(builder.positiveExamples != null && !builder.positiveExamples + .isEmpty(), "positiveExamples cannot be null or empty"); name = builder.name; positiveExamples = builder.positiveExamples; diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteClassifierOptions.java index 186c6fbf618..63363791b05 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteClassifierOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.visual_recognition.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteClassifier options. @@ -69,7 +68,8 @@ public Builder classifierId(String classifierId) { } private DeleteClassifierOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); classifierId = builder.classifierId; } diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteUserDataOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteUserDataOptions.java index 1277285880d..bc46d587881 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteUserDataOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DeleteUserDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.visual_recognition.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteUserData options. @@ -69,7 +68,8 @@ public Builder customerId(String customerId) { } private DeleteUserDataOptions(Builder builder) { - Validator.notNull(builder.customerId, "customerId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, + "customerId cannot be null"); customerId = builder.customerId; } diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectFacesOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectFacesOptions.java index b51eacca31c..065bbecc16b 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectFacesOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectFacesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -18,7 +18,6 @@ import java.io.InputStream; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The detectFaces options. @@ -163,7 +162,7 @@ public Builder imagesFile(File imagesFile) throws FileNotFoundException { } private DetectFacesOptions(Builder builder) { - Validator.isTrue((builder.imagesFile == null) || (builder.imagesFilename != null), + com.ibm.cloud.sdk.core.util.Validator.isTrue((builder.imagesFile == null) || (builder.imagesFilename != null), "imagesFilename cannot be null if imagesFile is not null."); imagesFile = builder.imagesFile; imagesFilename = builder.imagesFilename; diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectedFaces.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectedFaces.java index 3ff6c5c6085..f2ba1680f82 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectedFaces.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/DetectedFaces.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ErrorInfo.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ErrorInfo.java index 33a2e6c345a..4c710b1af7c 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ErrorInfo.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ErrorInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Face.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Face.java index 8e87bed5210..a6534a208f0 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Face.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Face.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceAge.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceAge.java index 1e5d69dc638..e963d14ad0a 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceAge.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceAge.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceGender.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceGender.java index 23cc4fa5795..1eb9c083430 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceGender.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceGender.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceLocation.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceLocation.java index f1610e35430..66b9ca80726 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceLocation.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/FaceLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetClassifierOptions.java index c51dfdd25b9..916fac53de9 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetClassifierOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.visual_recognition.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getClassifier options. @@ -69,7 +68,8 @@ public Builder classifierId(String classifierId) { } private GetClassifierOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); classifierId = builder.classifierId; } diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetCoreMlModelOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetCoreMlModelOptions.java index ccc81e0b153..7d11b2b82aa 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetCoreMlModelOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/GetCoreMlModelOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.visual_recognition.v3.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getCoreMlModel options. @@ -69,7 +68,8 @@ public Builder classifierId(String classifierId) { } private GetCoreMlModelOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); classifierId = builder.classifierId; } diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ImageWithFaces.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ImageWithFaces.java index 3c1bad9433a..83a2990e82a 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ImageWithFaces.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ImageWithFaces.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ListClassifiersOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ListClassifiersOptions.java index e43a6f1f72f..deb4ccdbd0f 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ListClassifiersOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ListClassifiersOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/UpdateClassifierOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/UpdateClassifierOptions.java index e63bd298137..3e0132da36c 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/UpdateClassifierOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/UpdateClassifierOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -20,7 +20,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateClassifier options. @@ -80,8 +79,10 @@ public UpdateClassifierOptions build() { * @return the UpdateClassifierOptions builder */ public Builder addPositiveExamples(String classname, InputStream positiveExamples) { - Validator.notNull(classname, "classname cannot be null"); - Validator.notNull(positiveExamples, "positiveExamples cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(classname, + "classname cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(positiveExamples, + "positiveExamples cannot be null"); if (this.positiveExamples == null) { this.positiveExamples = new HashMap(); } @@ -164,8 +165,10 @@ public Builder negativeExamples(File negativeExamples) throws FileNotFoundExcept } private UpdateClassifierOptions(Builder builder) { - Validator.notEmpty(builder.classifierId, "classifierId cannot be empty"); - Validator.isTrue((builder.negativeExamples == null) || (builder.negativeExamplesFilename != null), + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.classifierId, + "classifierId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((builder.negativeExamples == null) + || (builder.negativeExamplesFilename != null), "negativeExamplesFilename cannot be null if negativeExamples is not null."); classifierId = builder.classifierId; positiveExamples = builder.positiveExamples; diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/WarningInfo.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/WarningInfo.java index 468a84c6b51..d215621d758 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/WarningInfo.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/WarningInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/package-info.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/package-info.java index 2cb4740d422..4fd8dfa691d 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/package-info.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 From ccbd5da43bc66791c5d4ced16f30438a754ac3a2 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:37:57 -0400 Subject: [PATCH 03/28] feat(Assistant v1): Regenerate service --- .../ibm/watson/assistant/v1/Assistant.java | 347 +++++++------ .../assistant/v1/model/CaptureGroup.java | 117 ++++- .../watson/assistant/v1/model/Context.java | 2 +- .../assistant/v1/model/Counterexample.java | 6 +- .../v1/model/CounterexampleCollection.java | 2 +- .../v1/model/CreateCounterexampleOptions.java | 9 +- .../v1/model/CreateDialogNodeOptions.java | 43 +- .../assistant/v1/model/CreateEntity.java | 17 +- .../v1/model/CreateEntityOptions.java | 12 +- .../v1/model/CreateExampleOptions.java | 15 +- .../assistant/v1/model/CreateIntent.java | 9 +- .../v1/model/CreateIntentOptions.java | 12 +- .../v1/model/CreateSynonymOptions.java | 15 +- .../assistant/v1/model/CreateValue.java | 51 +- .../v1/model/CreateValueOptions.java | 62 +-- .../v1/model/CreateWorkspaceOptions.java | 15 +- .../v1/model/DeleteCounterexampleOptions.java | 9 +- .../v1/model/DeleteDialogNodeOptions.java | 9 +- .../v1/model/DeleteEntityOptions.java | 9 +- .../v1/model/DeleteExampleOptions.java | 12 +- .../v1/model/DeleteIntentOptions.java | 9 +- .../v1/model/DeleteSynonymOptions.java | 15 +- .../v1/model/DeleteUserDataOptions.java | 6 +- .../v1/model/DeleteValueOptions.java | 12 +- .../v1/model/DeleteWorkspaceOptions.java | 6 +- .../watson/assistant/v1/model/DialogNode.java | 55 +- .../assistant/v1/model/DialogNodeAction.java | 196 ++++--- .../v1/model/DialogNodeCollection.java | 2 +- .../v1/model/DialogNodeNextStep.java | 126 +++-- .../assistant/v1/model/DialogNodeOutput.java | 5 +- .../v1/model/DialogNodeOutputGeneric.java | 465 +++++++++++++---- .../v1/model/DialogNodeOutputModifiers.java | 63 ++- .../model/DialogNodeOutputOptionsElement.java | 103 +++- .../DialogNodeOutputOptionsElementValue.java | 148 ++++-- .../DialogNodeOutputTextValuesElement.java | 65 ++- .../v1/model/DialogNodeVisitedDetails.java | 113 ++-- .../model/DialogRuntimeResponseGeneric.java | 332 ------------ .../assistant/v1/model/DialogSuggestion.java | 157 ++++-- .../v1/model/DialogSuggestionOutput.java | 123 +++++ .../DialogSuggestionResponseGeneric.java | 444 ++++++++++++++++ .../v1/model/DialogSuggestionValue.java | 148 ++++-- .../ibm/watson/assistant/v1/model/Entity.java | 6 +- .../assistant/v1/model/EntityCollection.java | 2 +- .../assistant/v1/model/EntityMention.java | 2 +- .../v1/model/EntityMentionCollection.java | 2 +- .../watson/assistant/v1/model/Example.java | 9 +- .../assistant/v1/model/ExampleCollection.java | 2 +- .../v1/model/GetCounterexampleOptions.java | 9 +- .../v1/model/GetDialogNodeOptions.java | 9 +- .../assistant/v1/model/GetEntityOptions.java | 9 +- .../assistant/v1/model/GetExampleOptions.java | 12 +- .../assistant/v1/model/GetIntentOptions.java | 9 +- .../assistant/v1/model/GetSynonymOptions.java | 15 +- .../assistant/v1/model/GetValueOptions.java | 12 +- .../v1/model/GetWorkspaceOptions.java | 6 +- .../ibm/watson/assistant/v1/model/Intent.java | 2 +- .../assistant/v1/model/IntentCollection.java | 2 +- .../v1/model/ListAllLogsOptions.java | 6 +- .../v1/model/ListCounterexamplesOptions.java | 32 +- .../v1/model/ListDialogNodesOptions.java | 32 +- .../v1/model/ListEntitiesOptions.java | 32 +- .../v1/model/ListExamplesOptions.java | 35 +- .../v1/model/ListIntentsOptions.java | 32 +- .../assistant/v1/model/ListLogsOptions.java | 6 +- .../v1/model/ListMentionsOptions.java | 9 +- .../v1/model/ListSynonymsOptions.java | 38 +- .../assistant/v1/model/ListValuesOptions.java | 35 +- .../v1/model/ListWorkspacesOptions.java | 28 +- .../ibm/watson/assistant/v1/model/Log.java | 2 +- .../assistant/v1/model/LogCollection.java | 2 +- .../watson/assistant/v1/model/LogMessage.java | 115 +++-- .../assistant/v1/model/LogPagination.java | 2 +- .../watson/assistant/v1/model/Mention.java | 121 ++++- .../v1/model/MessageContextMetadata.java | 88 +++- .../assistant/v1/model/MessageInput.java | 2 +- .../assistant/v1/model/MessageOptions.java | 24 +- .../assistant/v1/model/MessageRequest.java | 256 ++++++--- .../assistant/v1/model/MessageResponse.java | 2 +- .../watson/assistant/v1/model/OutputData.java | 102 ++-- .../watson/assistant/v1/model/Pagination.java | 2 +- .../assistant/v1/model/RuntimeEntity.java | 268 +++++++--- .../assistant/v1/model/RuntimeIntent.java | 115 +++-- .../v1/model/RuntimeResponseGeneric.java | 488 ++++++++++++++++++ .../watson/assistant/v1/model/Synonym.java | 6 +- .../assistant/v1/model/SynonymCollection.java | 2 +- .../assistant/v1/model/SystemResponse.java | 3 +- .../v1/model/UpdateCounterexampleOptions.java | 9 +- .../v1/model/UpdateDialogNodeOptions.java | 41 +- .../v1/model/UpdateEntityOptions.java | 12 +- .../v1/model/UpdateExampleOptions.java | 15 +- .../v1/model/UpdateIntentOptions.java | 12 +- .../v1/model/UpdateSynonymOptions.java | 15 +- .../v1/model/UpdateValueOptions.java | 47 +- .../v1/model/UpdateWorkspaceOptions.java | 18 +- .../ibm/watson/assistant/v1/model/Value.java | 60 +-- .../assistant/v1/model/ValueCollection.java | 2 +- .../watson/assistant/v1/model/Workspace.java | 6 +- .../v1/model/WorkspaceCollection.java | 2 +- .../v1/model/WorkspaceSystemSettings.java | 120 +++-- ...WorkspaceSystemSettingsDisambiguation.java | 138 +++-- .../model/WorkspaceSystemSettingsTooling.java | 63 ++- .../ibm/watson/assistant/v1/package-info.java | 2 +- 102 files changed, 4023 insertions(+), 1898 deletions(-) delete mode 100644 assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogRuntimeResponseGeneric.java create mode 100644 assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionOutput.java create mode 100644 assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java create mode 100644 assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java index d6015ad2f24..e0a36641fc9 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,11 +16,9 @@ import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.AuthenticatorConfig; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.sdk.core.util.Validator; import com.ibm.watson.assistant.v1.model.Counterexample; import com.ibm.watson.assistant.v1.model.CounterexampleCollection; import com.ibm.watson.assistant.v1.model.CreateCounterexampleOptions; @@ -94,7 +92,7 @@ * dialog editor to create conversation flows between your apps and your users. * * @version v1 - * @see Assistant + * @see Assistant */ public class Assistant extends BaseService { @@ -104,54 +102,19 @@ public class Assistant extends BaseService { private String versionDate; /** - * Instantiates a new `Assistant`. + * Constructs a new `Assistant` client with the specified Authenticator. * * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API * calls from failing when the service introduces breaking changes. - * @deprecated Use Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) instead + * @param authenticator the Authenticator instance to be configured for this service */ - @Deprecated - public Assistant(String versionDate) { - super(SERVICE_NAME); + public Assistant(String versionDate, Authenticator authenticator) { + super(SERVICE_NAME, authenticator); if ((getEndPoint() == null) || getEndPoint().isEmpty()) { setEndPoint(URL); } - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); - - this.versionDate = versionDate; - } - - /** - * Instantiates a new `Assistant` with username and password. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param username the username - * @param password the password - * @deprecated Use Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) instead - */ - @Deprecated - public Assistant(String versionDate, String username, String password) { - this(versionDate); - setUsernameAndPassword(username, password); - } - - /** - * Instantiates a new `Assistant` with the specified authentication configuration. - * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticatorConfig the authentication configuration for this service - */ - public Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) { - super(SERVICE_NAME); - if ((getEndPoint() == null) || getEndPoint().isEmpty()) { - setEndPoint(URL); - } - setAuthenticator(authenticatorConfig); - - Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), + "version cannot be null."); this.versionDate = versionDate; } @@ -170,7 +133,8 @@ public Assistant(String versionDate, AuthenticatorConfig authenticatorConfig) { * @return a {@link ServiceCall} with a response type of {@link MessageResponse} */ public ServiceCall message(MessageOptions messageOptions) { - Validator.notNull(messageOptions, "messageOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(messageOptions, + "messageOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "message" }; String[] pathParameters = { messageOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -186,22 +150,26 @@ public ServiceCall message(MessageOptions messageOptions) { } final JsonObject contentJson = new JsonObject(); if (messageOptions.input() != null) { - contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input())); + contentJson.add("input", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions.input())); } if (messageOptions.intents() != null) { - contentJson.add("intents", GsonSingleton.getGson().toJsonTree(messageOptions.intents())); + contentJson.add("intents", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions + .intents())); } if (messageOptions.entities() != null) { - contentJson.add("entities", GsonSingleton.getGson().toJsonTree(messageOptions.entities())); + contentJson.add("entities", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions + .entities())); } if (messageOptions.alternateIntents() != null) { contentJson.addProperty("alternate_intents", messageOptions.alternateIntents()); } if (messageOptions.context() != null) { - contentJson.add("context", GsonSingleton.getGson().toJsonTree(messageOptions.context())); + contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions + .context())); } if (messageOptions.output() != null) { - contentJson.add("output", GsonSingleton.getGson().toJsonTree(messageOptions.output())); + contentJson.add("output", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions + .output())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -233,9 +201,6 @@ public ServiceCall listWorkspaces(ListWorkspacesOptions lis if (listWorkspacesOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listWorkspacesOptions.pageLimit())); } - if (listWorkspacesOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listWorkspacesOptions.includeCount())); - } if (listWorkspacesOptions.sort() != null) { builder.query("sort", listWorkspacesOptions.sort()); } @@ -297,26 +262,31 @@ public ServiceCall createWorkspace(CreateWorkspaceOptions createWorks contentJson.addProperty("language", createWorkspaceOptions.language()); } if (createWorkspaceOptions.metadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.metadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createWorkspaceOptions.metadata())); } if (createWorkspaceOptions.learningOptOut() != null) { contentJson.addProperty("learning_opt_out", createWorkspaceOptions.learningOptOut()); } if (createWorkspaceOptions.systemSettings() != null) { - contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.systemSettings())); + contentJson.add("system_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createWorkspaceOptions.systemSettings())); } if (createWorkspaceOptions.intents() != null) { - contentJson.add("intents", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.intents())); + contentJson.add("intents", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createWorkspaceOptions + .intents())); } if (createWorkspaceOptions.entities() != null) { - contentJson.add("entities", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.entities())); + contentJson.add("entities", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createWorkspaceOptions.entities())); } if (createWorkspaceOptions.dialogNodes() != null) { - contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.dialogNodes())); + contentJson.add("dialog_nodes", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createWorkspaceOptions.dialogNodes())); } if (createWorkspaceOptions.counterexamples() != null) { - contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions - .counterexamples())); + contentJson.add("counterexamples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createWorkspaceOptions.counterexamples())); } builder.bodyJson(contentJson); } @@ -352,7 +322,8 @@ public ServiceCall createWorkspace() { * @return a {@link ServiceCall} with a response type of {@link Workspace} */ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspaceOptions) { - Validator.notNull(getWorkspaceOptions, "getWorkspaceOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getWorkspaceOptions, + "getWorkspaceOptions cannot be null"); String[] pathSegments = { "v1/workspaces" }; String[] pathParameters = { getWorkspaceOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -390,7 +361,8 @@ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspaceOptio * @return a {@link ServiceCall} with a response type of {@link Workspace} */ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorkspaceOptions) { - Validator.notNull(updateWorkspaceOptions, "updateWorkspaceOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateWorkspaceOptions, + "updateWorkspaceOptions cannot be null"); String[] pathSegments = { "v1/workspaces" }; String[] pathParameters = { updateWorkspaceOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -415,25 +387,31 @@ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorks contentJson.addProperty("language", updateWorkspaceOptions.language()); } if (updateWorkspaceOptions.metadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.metadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions + .metadata())); } if (updateWorkspaceOptions.learningOptOut() != null) { contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut()); } if (updateWorkspaceOptions.systemSettings() != null) { - contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings())); + contentJson.add("system_settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateWorkspaceOptions.systemSettings())); } if (updateWorkspaceOptions.intents() != null) { - contentJson.add("intents", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.intents())); + contentJson.add("intents", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions + .intents())); } if (updateWorkspaceOptions.entities() != null) { - contentJson.add("entities", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.entities())); + contentJson.add("entities", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions + .entities())); } if (updateWorkspaceOptions.dialogNodes() != null) { - contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.dialogNodes())); + contentJson.add("dialog_nodes", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateWorkspaceOptions.dialogNodes())); } if (updateWorkspaceOptions.counterexamples() != null) { - contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.counterexamples())); + contentJson.add("counterexamples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateWorkspaceOptions.counterexamples())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -453,7 +431,8 @@ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorks * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteWorkspace(DeleteWorkspaceOptions deleteWorkspaceOptions) { - Validator.notNull(deleteWorkspaceOptions, "deleteWorkspaceOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteWorkspaceOptions, + "deleteWorkspaceOptions cannot be null"); String[] pathSegments = { "v1/workspaces" }; String[] pathParameters = { deleteWorkspaceOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -480,7 +459,8 @@ public ServiceCall deleteWorkspace(DeleteWorkspaceOptions deleteWorkspaceO * @return a {@link ServiceCall} with a response type of {@link IntentCollection} */ public ServiceCall listIntents(ListIntentsOptions listIntentsOptions) { - Validator.notNull(listIntentsOptions, "listIntentsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listIntentsOptions, + "listIntentsOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents" }; String[] pathParameters = { listIntentsOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -497,9 +477,6 @@ public ServiceCall listIntents(ListIntentsOptions listIntentsO if (listIntentsOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listIntentsOptions.pageLimit())); } - if (listIntentsOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listIntentsOptions.includeCount())); - } if (listIntentsOptions.sort() != null) { builder.query("sort", listIntentsOptions.sort()); } @@ -529,7 +506,8 @@ public ServiceCall listIntents(ListIntentsOptions listIntentsO * @return a {@link ServiceCall} with a response type of {@link Intent} */ public ServiceCall createIntent(CreateIntentOptions createIntentOptions) { - Validator.notNull(createIntentOptions, "createIntentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createIntentOptions, + "createIntentOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents" }; String[] pathParameters = { createIntentOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -546,7 +524,8 @@ public ServiceCall createIntent(CreateIntentOptions createIntentOptions) contentJson.addProperty("description", createIntentOptions.description()); } if (createIntentOptions.examples() != null) { - contentJson.add("examples", GsonSingleton.getGson().toJsonTree(createIntentOptions.examples())); + contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createIntentOptions + .examples())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -567,7 +546,8 @@ public ServiceCall createIntent(CreateIntentOptions createIntentOptions) * @return a {@link ServiceCall} with a response type of {@link Intent} */ public ServiceCall getIntent(GetIntentOptions getIntentOptions) { - Validator.notNull(getIntentOptions, "getIntentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getIntentOptions, + "getIntentOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents" }; String[] pathParameters = { getIntentOptions.workspaceId(), getIntentOptions.intent() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -605,7 +585,8 @@ public ServiceCall getIntent(GetIntentOptions getIntentOptions) { * @return a {@link ServiceCall} with a response type of {@link Intent} */ public ServiceCall updateIntent(UpdateIntentOptions updateIntentOptions) { - Validator.notNull(updateIntentOptions, "updateIntentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateIntentOptions, + "updateIntentOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents" }; String[] pathParameters = { updateIntentOptions.workspaceId(), updateIntentOptions.intent() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -624,7 +605,8 @@ public ServiceCall updateIntent(UpdateIntentOptions updateIntentOptions) contentJson.addProperty("description", updateIntentOptions.newDescription()); } if (updateIntentOptions.newExamples() != null) { - contentJson.add("examples", GsonSingleton.getGson().toJsonTree(updateIntentOptions.newExamples())); + contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateIntentOptions + .newExamples())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -644,7 +626,8 @@ public ServiceCall updateIntent(UpdateIntentOptions updateIntentOptions) * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteIntent(DeleteIntentOptions deleteIntentOptions) { - Validator.notNull(deleteIntentOptions, "deleteIntentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteIntentOptions, + "deleteIntentOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents" }; String[] pathParameters = { deleteIntentOptions.workspaceId(), deleteIntentOptions.intent() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -670,7 +653,8 @@ public ServiceCall deleteIntent(DeleteIntentOptions deleteIntentOptions) { * @return a {@link ServiceCall} with a response type of {@link ExampleCollection} */ public ServiceCall listExamples(ListExamplesOptions listExamplesOptions) { - Validator.notNull(listExamplesOptions, "listExamplesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listExamplesOptions, + "listExamplesOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; String[] pathParameters = { listExamplesOptions.workspaceId(), listExamplesOptions.intent() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -684,9 +668,6 @@ public ServiceCall listExamples(ListExamplesOptions listExamp if (listExamplesOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listExamplesOptions.pageLimit())); } - if (listExamplesOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listExamplesOptions.includeCount())); - } if (listExamplesOptions.sort() != null) { builder.query("sort", listExamplesOptions.sort()); } @@ -716,7 +697,8 @@ public ServiceCall listExamples(ListExamplesOptions listExamp * @return a {@link ServiceCall} with a response type of {@link Example} */ public ServiceCall createExample(CreateExampleOptions createExampleOptions) { - Validator.notNull(createExampleOptions, "createExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createExampleOptions, + "createExampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; String[] pathParameters = { createExampleOptions.workspaceId(), createExampleOptions.intent() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -730,7 +712,8 @@ public ServiceCall createExample(CreateExampleOptions createExampleOpti final JsonObject contentJson = new JsonObject(); contentJson.addProperty("text", createExampleOptions.text()); if (createExampleOptions.mentions() != null) { - contentJson.add("mentions", GsonSingleton.getGson().toJsonTree(createExampleOptions.mentions())); + contentJson.add("mentions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createExampleOptions + .mentions())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -750,7 +733,8 @@ public ServiceCall createExample(CreateExampleOptions createExampleOpti * @return a {@link ServiceCall} with a response type of {@link Example} */ public ServiceCall getExample(GetExampleOptions getExampleOptions) { - Validator.notNull(getExampleOptions, "getExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getExampleOptions, + "getExampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; String[] pathParameters = { getExampleOptions.workspaceId(), getExampleOptions.intent(), getExampleOptions.text() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -784,7 +768,8 @@ public ServiceCall getExample(GetExampleOptions getExampleOptions) { * @return a {@link ServiceCall} with a response type of {@link Example} */ public ServiceCall updateExample(UpdateExampleOptions updateExampleOptions) { - Validator.notNull(updateExampleOptions, "updateExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateExampleOptions, + "updateExampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; String[] pathParameters = { updateExampleOptions.workspaceId(), updateExampleOptions.intent(), updateExampleOptions .text() }; @@ -801,7 +786,8 @@ public ServiceCall updateExample(UpdateExampleOptions updateExampleOpti contentJson.addProperty("text", updateExampleOptions.newText()); } if (updateExampleOptions.newMentions() != null) { - contentJson.add("mentions", GsonSingleton.getGson().toJsonTree(updateExampleOptions.newMentions())); + contentJson.add("mentions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateExampleOptions + .newMentions())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -821,7 +807,8 @@ public ServiceCall updateExample(UpdateExampleOptions updateExampleOpti * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteExample(DeleteExampleOptions deleteExampleOptions) { - Validator.notNull(deleteExampleOptions, "deleteExampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteExampleOptions, + "deleteExampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents", "examples" }; String[] pathParameters = { deleteExampleOptions.workspaceId(), deleteExampleOptions.intent(), deleteExampleOptions .text() }; @@ -849,7 +836,8 @@ public ServiceCall deleteExample(DeleteExampleOptions deleteExampleOptions */ public ServiceCall listCounterexamples( ListCounterexamplesOptions listCounterexamplesOptions) { - Validator.notNull(listCounterexamplesOptions, "listCounterexamplesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listCounterexamplesOptions, + "listCounterexamplesOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "counterexamples" }; String[] pathParameters = { listCounterexamplesOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -863,9 +851,6 @@ public ServiceCall listCounterexamples( if (listCounterexamplesOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listCounterexamplesOptions.pageLimit())); } - if (listCounterexamplesOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listCounterexamplesOptions.includeCount())); - } if (listCounterexamplesOptions.sort() != null) { builder.query("sort", listCounterexamplesOptions.sort()); } @@ -895,7 +880,8 @@ public ServiceCall listCounterexamples( * @return a {@link ServiceCall} with a response type of {@link Counterexample} */ public ServiceCall createCounterexample(CreateCounterexampleOptions createCounterexampleOptions) { - Validator.notNull(createCounterexampleOptions, "createCounterexampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createCounterexampleOptions, + "createCounterexampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "counterexamples" }; String[] pathParameters = { createCounterexampleOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -926,7 +912,8 @@ public ServiceCall createCounterexample(CreateCounterexampleOpti * @return a {@link ServiceCall} with a response type of {@link Counterexample} */ public ServiceCall getCounterexample(GetCounterexampleOptions getCounterexampleOptions) { - Validator.notNull(getCounterexampleOptions, "getCounterexampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getCounterexampleOptions, + "getCounterexampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "counterexamples" }; String[] pathParameters = { getCounterexampleOptions.workspaceId(), getCounterexampleOptions.text() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -960,7 +947,8 @@ public ServiceCall getCounterexample(GetCounterexampleOptions ge * @return a {@link ServiceCall} with a response type of {@link Counterexample} */ public ServiceCall updateCounterexample(UpdateCounterexampleOptions updateCounterexampleOptions) { - Validator.notNull(updateCounterexampleOptions, "updateCounterexampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateCounterexampleOptions, + "updateCounterexampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "counterexamples" }; String[] pathParameters = { updateCounterexampleOptions.workspaceId(), updateCounterexampleOptions.text() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -993,7 +981,8 @@ public ServiceCall updateCounterexample(UpdateCounterexampleOpti * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteCounterexample(DeleteCounterexampleOptions deleteCounterexampleOptions) { - Validator.notNull(deleteCounterexampleOptions, "deleteCounterexampleOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCounterexampleOptions, + "deleteCounterexampleOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "counterexamples" }; String[] pathParameters = { deleteCounterexampleOptions.workspaceId(), deleteCounterexampleOptions.text() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1020,7 +1009,8 @@ public ServiceCall deleteCounterexample(DeleteCounterexampleOptions delete * @return a {@link ServiceCall} with a response type of {@link EntityCollection} */ public ServiceCall listEntities(ListEntitiesOptions listEntitiesOptions) { - Validator.notNull(listEntitiesOptions, "listEntitiesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listEntitiesOptions, + "listEntitiesOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities" }; String[] pathParameters = { listEntitiesOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1037,9 +1027,6 @@ public ServiceCall listEntities(ListEntitiesOptions listEntiti if (listEntitiesOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listEntitiesOptions.pageLimit())); } - if (listEntitiesOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listEntitiesOptions.includeCount())); - } if (listEntitiesOptions.sort() != null) { builder.query("sort", listEntitiesOptions.sort()); } @@ -1069,7 +1056,8 @@ public ServiceCall listEntities(ListEntitiesOptions listEntiti * @return a {@link ServiceCall} with a response type of {@link Entity} */ public ServiceCall createEntity(CreateEntityOptions createEntityOptions) { - Validator.notNull(createEntityOptions, "createEntityOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createEntityOptions, + "createEntityOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities" }; String[] pathParameters = { createEntityOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1086,13 +1074,15 @@ public ServiceCall createEntity(CreateEntityOptions createEntityOptions) contentJson.addProperty("description", createEntityOptions.description()); } if (createEntityOptions.metadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createEntityOptions.metadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createEntityOptions + .metadata())); } if (createEntityOptions.fuzzyMatch() != null) { contentJson.addProperty("fuzzy_match", createEntityOptions.fuzzyMatch()); } if (createEntityOptions.values() != null) { - contentJson.add("values", GsonSingleton.getGson().toJsonTree(createEntityOptions.values())); + contentJson.add("values", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createEntityOptions + .values())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -1113,7 +1103,8 @@ public ServiceCall createEntity(CreateEntityOptions createEntityOptions) * @return a {@link ServiceCall} with a response type of {@link Entity} */ public ServiceCall getEntity(GetEntityOptions getEntityOptions) { - Validator.notNull(getEntityOptions, "getEntityOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getEntityOptions, + "getEntityOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities" }; String[] pathParameters = { getEntityOptions.workspaceId(), getEntityOptions.entity() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1151,7 +1142,8 @@ public ServiceCall getEntity(GetEntityOptions getEntityOptions) { * @return a {@link ServiceCall} with a response type of {@link Entity} */ public ServiceCall updateEntity(UpdateEntityOptions updateEntityOptions) { - Validator.notNull(updateEntityOptions, "updateEntityOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateEntityOptions, + "updateEntityOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities" }; String[] pathParameters = { updateEntityOptions.workspaceId(), updateEntityOptions.entity() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1170,13 +1162,15 @@ public ServiceCall updateEntity(UpdateEntityOptions updateEntityOptions) contentJson.addProperty("description", updateEntityOptions.newDescription()); } if (updateEntityOptions.newMetadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newMetadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateEntityOptions + .newMetadata())); } if (updateEntityOptions.newFuzzyMatch() != null) { contentJson.addProperty("fuzzy_match", updateEntityOptions.newFuzzyMatch()); } if (updateEntityOptions.newValues() != null) { - contentJson.add("values", GsonSingleton.getGson().toJsonTree(updateEntityOptions.newValues())); + contentJson.add("values", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateEntityOptions + .newValues())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -1196,7 +1190,8 @@ public ServiceCall updateEntity(UpdateEntityOptions updateEntityOptions) * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteEntity(DeleteEntityOptions deleteEntityOptions) { - Validator.notNull(deleteEntityOptions, "deleteEntityOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteEntityOptions, + "deleteEntityOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities" }; String[] pathParameters = { deleteEntityOptions.workspaceId(), deleteEntityOptions.entity() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1223,7 +1218,8 @@ public ServiceCall deleteEntity(DeleteEntityOptions deleteEntityOptions) { * @return a {@link ServiceCall} with a response type of {@link EntityMentionCollection} */ public ServiceCall listMentions(ListMentionsOptions listMentionsOptions) { - Validator.notNull(listMentionsOptions, "listMentionsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listMentionsOptions, + "listMentionsOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "mentions" }; String[] pathParameters = { listMentionsOptions.workspaceId(), listMentionsOptions.entity() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1257,7 +1253,8 @@ public ServiceCall listMentions(ListMentionsOptions lis * @return a {@link ServiceCall} with a response type of {@link ValueCollection} */ public ServiceCall listValues(ListValuesOptions listValuesOptions) { - Validator.notNull(listValuesOptions, "listValuesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listValuesOptions, + "listValuesOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values" }; String[] pathParameters = { listValuesOptions.workspaceId(), listValuesOptions.entity() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1274,9 +1271,6 @@ public ServiceCall listValues(ListValuesOptions listValuesOptio if (listValuesOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listValuesOptions.pageLimit())); } - if (listValuesOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listValuesOptions.includeCount())); - } if (listValuesOptions.sort() != null) { builder.query("sort", listValuesOptions.sort()); } @@ -1306,7 +1300,8 @@ public ServiceCall listValues(ListValuesOptions listValuesOptio * @return a {@link ServiceCall} with a response type of {@link Value} */ public ServiceCall createValue(CreateValueOptions createValueOptions) { - Validator.notNull(createValueOptions, "createValueOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createValueOptions, + "createValueOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values" }; String[] pathParameters = { createValueOptions.workspaceId(), createValueOptions.entity() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1320,16 +1315,19 @@ public ServiceCall createValue(CreateValueOptions createValueOptions) { final JsonObject contentJson = new JsonObject(); contentJson.addProperty("value", createValueOptions.value()); if (createValueOptions.metadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createValueOptions.metadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createValueOptions + .metadata())); } - if (createValueOptions.valueType() != null) { - contentJson.addProperty("type", createValueOptions.valueType()); + if (createValueOptions.type() != null) { + contentJson.addProperty("type", createValueOptions.type()); } if (createValueOptions.synonyms() != null) { - contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(createValueOptions.synonyms())); + contentJson.add("synonyms", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createValueOptions + .synonyms())); } if (createValueOptions.patterns() != null) { - contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(createValueOptions.patterns())); + contentJson.add("patterns", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createValueOptions + .patterns())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -1349,7 +1347,8 @@ public ServiceCall createValue(CreateValueOptions createValueOptions) { * @return a {@link ServiceCall} with a response type of {@link Value} */ public ServiceCall getValue(GetValueOptions getValueOptions) { - Validator.notNull(getValueOptions, "getValueOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getValueOptions, + "getValueOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values" }; String[] pathParameters = { getValueOptions.workspaceId(), getValueOptions.entity(), getValueOptions.value() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1387,7 +1386,8 @@ public ServiceCall getValue(GetValueOptions getValueOptions) { * @return a {@link ServiceCall} with a response type of {@link Value} */ public ServiceCall updateValue(UpdateValueOptions updateValueOptions) { - Validator.notNull(updateValueOptions, "updateValueOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateValueOptions, + "updateValueOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values" }; String[] pathParameters = { updateValueOptions.workspaceId(), updateValueOptions.entity(), updateValueOptions .value() }; @@ -1404,16 +1404,19 @@ public ServiceCall updateValue(UpdateValueOptions updateValueOptions) { contentJson.addProperty("value", updateValueOptions.newValue()); } if (updateValueOptions.newMetadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateValueOptions.newMetadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateValueOptions + .newMetadata())); } - if (updateValueOptions.valueType() != null) { - contentJson.addProperty("type", updateValueOptions.valueType()); + if (updateValueOptions.newType() != null) { + contentJson.addProperty("type", updateValueOptions.newType()); } if (updateValueOptions.newSynonyms() != null) { - contentJson.add("synonyms", GsonSingleton.getGson().toJsonTree(updateValueOptions.newSynonyms())); + contentJson.add("synonyms", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateValueOptions + .newSynonyms())); } if (updateValueOptions.newPatterns() != null) { - contentJson.add("patterns", GsonSingleton.getGson().toJsonTree(updateValueOptions.newPatterns())); + contentJson.add("patterns", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateValueOptions + .newPatterns())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue( @@ -1433,7 +1436,8 @@ public ServiceCall updateValue(UpdateValueOptions updateValueOptions) { * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteValue(DeleteValueOptions deleteValueOptions) { - Validator.notNull(deleteValueOptions, "deleteValueOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteValueOptions, + "deleteValueOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values" }; String[] pathParameters = { deleteValueOptions.workspaceId(), deleteValueOptions.entity(), deleteValueOptions .value() }; @@ -1460,7 +1464,8 @@ public ServiceCall deleteValue(DeleteValueOptions deleteValueOptions) { * @return a {@link ServiceCall} with a response type of {@link SynonymCollection} */ public ServiceCall listSynonyms(ListSynonymsOptions listSynonymsOptions) { - Validator.notNull(listSynonymsOptions, "listSynonymsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listSynonymsOptions, + "listSynonymsOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; String[] pathParameters = { listSynonymsOptions.workspaceId(), listSynonymsOptions.entity(), listSynonymsOptions .value() }; @@ -1475,9 +1480,6 @@ public ServiceCall listSynonyms(ListSynonymsOptions listSynon if (listSynonymsOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listSynonymsOptions.pageLimit())); } - if (listSynonymsOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listSynonymsOptions.includeCount())); - } if (listSynonymsOptions.sort() != null) { builder.query("sort", listSynonymsOptions.sort()); } @@ -1507,7 +1509,8 @@ public ServiceCall listSynonyms(ListSynonymsOptions listSynon * @return a {@link ServiceCall} with a response type of {@link Synonym} */ public ServiceCall createSynonym(CreateSynonymOptions createSynonymOptions) { - Validator.notNull(createSynonymOptions, "createSynonymOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createSynonymOptions, + "createSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; String[] pathParameters = { createSynonymOptions.workspaceId(), createSynonymOptions.entity(), createSynonymOptions .value() }; @@ -1539,7 +1542,8 @@ public ServiceCall createSynonym(CreateSynonymOptions createSynonymOpti * @return a {@link ServiceCall} with a response type of {@link Synonym} */ public ServiceCall getSynonym(GetSynonymOptions getSynonymOptions) { - Validator.notNull(getSynonymOptions, "getSynonymOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getSynonymOptions, + "getSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; String[] pathParameters = { getSynonymOptions.workspaceId(), getSynonymOptions.entity(), getSynonymOptions.value(), getSynonymOptions.synonym() }; @@ -1574,7 +1578,8 @@ public ServiceCall getSynonym(GetSynonymOptions getSynonymOptions) { * @return a {@link ServiceCall} with a response type of {@link Synonym} */ public ServiceCall updateSynonym(UpdateSynonymOptions updateSynonymOptions) { - Validator.notNull(updateSynonymOptions, "updateSynonymOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSynonymOptions, + "updateSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; String[] pathParameters = { updateSynonymOptions.workspaceId(), updateSynonymOptions.entity(), updateSynonymOptions .value(), updateSynonymOptions.synonym() }; @@ -1608,7 +1613,8 @@ public ServiceCall updateSynonym(UpdateSynonymOptions updateSynonymOpti * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteSynonym(DeleteSynonymOptions deleteSynonymOptions) { - Validator.notNull(deleteSynonymOptions, "deleteSynonymOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteSynonymOptions, + "deleteSynonymOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "entities", "values", "synonyms" }; String[] pathParameters = { deleteSynonymOptions.workspaceId(), deleteSynonymOptions.entity(), deleteSynonymOptions .value(), deleteSynonymOptions.synonym() }; @@ -1635,7 +1641,8 @@ public ServiceCall deleteSynonym(DeleteSynonymOptions deleteSynonymOptions * @return a {@link ServiceCall} with a response type of {@link DialogNodeCollection} */ public ServiceCall listDialogNodes(ListDialogNodesOptions listDialogNodesOptions) { - Validator.notNull(listDialogNodesOptions, "listDialogNodesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listDialogNodesOptions, + "listDialogNodesOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "dialog_nodes" }; String[] pathParameters = { listDialogNodesOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1649,9 +1656,6 @@ public ServiceCall listDialogNodes(ListDialogNodesOptions if (listDialogNodesOptions.pageLimit() != null) { builder.query("page_limit", String.valueOf(listDialogNodesOptions.pageLimit())); } - if (listDialogNodesOptions.includeCount() != null) { - builder.query("include_count", String.valueOf(listDialogNodesOptions.includeCount())); - } if (listDialogNodesOptions.sort() != null) { builder.query("sort", listDialogNodesOptions.sort()); } @@ -1681,7 +1685,8 @@ public ServiceCall listDialogNodes(ListDialogNodesOptions * @return a {@link ServiceCall} with a response type of {@link DialogNode} */ public ServiceCall createDialogNode(CreateDialogNodeOptions createDialogNodeOptions) { - Validator.notNull(createDialogNodeOptions, "createDialogNodeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(createDialogNodeOptions, + "createDialogNodeOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "dialog_nodes" }; String[] pathParameters = { createDialogNodeOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1707,22 +1712,26 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi contentJson.addProperty("previous_sibling", createDialogNodeOptions.previousSibling()); } if (createDialogNodeOptions.output() != null) { - contentJson.add("output", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.output())); + contentJson.add("output", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createDialogNodeOptions + .output())); } if (createDialogNodeOptions.context() != null) { - contentJson.add("context", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.context())); + contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createDialogNodeOptions + .context())); } if (createDialogNodeOptions.metadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.metadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createDialogNodeOptions + .metadata())); } if (createDialogNodeOptions.nextStep() != null) { - contentJson.add("next_step", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.nextStep())); + contentJson.add("next_step", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + createDialogNodeOptions.nextStep())); } if (createDialogNodeOptions.title() != null) { contentJson.addProperty("title", createDialogNodeOptions.title()); } - if (createDialogNodeOptions.nodeType() != null) { - contentJson.addProperty("type", createDialogNodeOptions.nodeType()); + if (createDialogNodeOptions.type() != null) { + contentJson.addProperty("type", createDialogNodeOptions.type()); } if (createDialogNodeOptions.eventName() != null) { contentJson.addProperty("event_name", createDialogNodeOptions.eventName()); @@ -1731,7 +1740,8 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi contentJson.addProperty("variable", createDialogNodeOptions.variable()); } if (createDialogNodeOptions.actions() != null) { - contentJson.add("actions", GsonSingleton.getGson().toJsonTree(createDialogNodeOptions.actions())); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createDialogNodeOptions + .actions())); } if (createDialogNodeOptions.digressIn() != null) { contentJson.addProperty("digress_in", createDialogNodeOptions.digressIn()); @@ -1763,7 +1773,8 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi * @return a {@link ServiceCall} with a response type of {@link DialogNode} */ public ServiceCall getDialogNode(GetDialogNodeOptions getDialogNodeOptions) { - Validator.notNull(getDialogNodeOptions, "getDialogNodeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(getDialogNodeOptions, + "getDialogNodeOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "dialog_nodes" }; String[] pathParameters = { getDialogNodeOptions.workspaceId(), getDialogNodeOptions.dialogNode() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1797,7 +1808,8 @@ public ServiceCall getDialogNode(GetDialogNodeOptions getDialogNodeO * @return a {@link ServiceCall} with a response type of {@link DialogNode} */ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDialogNodeOptions) { - Validator.notNull(updateDialogNodeOptions, "updateDialogNodeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateDialogNodeOptions, + "updateDialogNodeOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "dialog_nodes" }; String[] pathParameters = { updateDialogNodeOptions.workspaceId(), updateDialogNodeOptions.dialogNode() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1825,22 +1837,26 @@ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDi contentJson.addProperty("previous_sibling", updateDialogNodeOptions.newPreviousSibling()); } if (updateDialogNodeOptions.newOutput() != null) { - contentJson.add("output", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newOutput())); + contentJson.add("output", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions + .newOutput())); } if (updateDialogNodeOptions.newContext() != null) { - contentJson.add("context", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newContext())); + contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions + .newContext())); } if (updateDialogNodeOptions.newMetadata() != null) { - contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newMetadata())); + contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions + .newMetadata())); } if (updateDialogNodeOptions.newNextStep() != null) { - contentJson.add("next_step", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newNextStep())); + contentJson.add("next_step", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree( + updateDialogNodeOptions.newNextStep())); } if (updateDialogNodeOptions.newTitle() != null) { contentJson.addProperty("title", updateDialogNodeOptions.newTitle()); } - if (updateDialogNodeOptions.nodeType() != null) { - contentJson.addProperty("type", updateDialogNodeOptions.nodeType()); + if (updateDialogNodeOptions.newType() != null) { + contentJson.addProperty("type", updateDialogNodeOptions.newType()); } if (updateDialogNodeOptions.newEventName() != null) { contentJson.addProperty("event_name", updateDialogNodeOptions.newEventName()); @@ -1849,7 +1865,8 @@ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDi contentJson.addProperty("variable", updateDialogNodeOptions.newVariable()); } if (updateDialogNodeOptions.newActions() != null) { - contentJson.add("actions", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newActions())); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions + .newActions())); } if (updateDialogNodeOptions.newDigressIn() != null) { contentJson.addProperty("digress_in", updateDialogNodeOptions.newDigressIn()); @@ -1881,7 +1898,8 @@ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDi * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteDialogNode(DeleteDialogNodeOptions deleteDialogNodeOptions) { - Validator.notNull(deleteDialogNodeOptions, "deleteDialogNodeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteDialogNodeOptions, + "deleteDialogNodeOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "dialog_nodes" }; String[] pathParameters = { deleteDialogNodeOptions.workspaceId(), deleteDialogNodeOptions.dialogNode() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1908,7 +1926,8 @@ public ServiceCall deleteDialogNode(DeleteDialogNodeOptions deleteDialogNo * @return a {@link ServiceCall} with a response type of {@link LogCollection} */ public ServiceCall listLogs(ListLogsOptions listLogsOptions) { - Validator.notNull(listLogsOptions, "listLogsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listLogsOptions, + "listLogsOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "logs" }; String[] pathParameters = { listLogsOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, @@ -1949,7 +1968,8 @@ public ServiceCall listLogs(ListLogsOptions listLogsOptions) { * @return a {@link ServiceCall} with a response type of {@link LogCollection} */ public ServiceCall listAllLogs(ListAllLogsOptions listAllLogsOptions) { - Validator.notNull(listAllLogsOptions, "listAllLogsOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(listAllLogsOptions, + "listAllLogsOptions cannot be null"); String[] pathSegments = { "v1/logs" }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -1988,7 +2008,8 @@ public ServiceCall listAllLogs(ListAllLogsOptions listAllLogsOpti * @return a {@link ServiceCall} with a response type of Void */ public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - Validator.notNull(deleteUserDataOptions, "deleteUserDataOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, + "deleteUserDataOptions cannot be null"); String[] pathSegments = { "v1/user_data" }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CaptureGroup.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CaptureGroup.java index c083e36ad2b..48e7a2a246a 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CaptureGroup.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CaptureGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,6 +25,98 @@ public class CaptureGroup extends GenericModel { private String group; private List location; + /** + * Builder. + */ + public static class Builder { + private String group; + private List location; + + private Builder(CaptureGroup captureGroup) { + this.group = captureGroup.group; + this.location = captureGroup.location; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param group the group + */ + public Builder(String group) { + this.group = group; + } + + /** + * Builds a CaptureGroup. + * + * @return the captureGroup + */ + public CaptureGroup build() { + return new CaptureGroup(this); + } + + /** + * Adds an location to location. + * + * @param location the new location + * @return the CaptureGroup builder + */ + public Builder addLocation(Long location) { + com.ibm.cloud.sdk.core.util.Validator.notNull(location, + "location cannot be null"); + if (this.location == null) { + this.location = new ArrayList(); + } + this.location.add(location); + return this; + } + + /** + * Set the group. + * + * @param group the group + * @return the CaptureGroup builder + */ + public Builder group(String group) { + this.group = group; + return this; + } + + /** + * Set the location. + * Existing location will be replaced. + * + * @param location the location + * @return the CaptureGroup builder + */ + public Builder location(List location) { + this.location = location; + return this; + } + } + + private CaptureGroup(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.group, + "group cannot be null"); + group = builder.group; + location = builder.location; + } + + /** + * New builder. + * + * @return a CaptureGroup builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the group. * @@ -31,7 +124,7 @@ public class CaptureGroup extends GenericModel { * * @return the group */ - public String getGroup() { + public String group() { return group; } @@ -42,25 +135,7 @@ public String getGroup() { * * @return the location */ - public List getLocation() { + public List location() { return location; } - - /** - * Sets the group. - * - * @param group the new group - */ - public void setGroup(final String group) { - this.group = group; - } - - /** - * Sets the location. - * - * @param location the new location - */ - public void setLocation(final List location) { - this.location = location; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Context.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Context.java index b7468593497..6e95b3edbb2 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Context.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Context.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Counterexample.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Counterexample.java index 43428515307..94cca2ab264 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Counterexample.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Counterexample.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -15,7 +15,6 @@ import java.util.Date; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * Counterexample. @@ -99,7 +98,8 @@ public Builder updated(Date updated) { } private Counterexample(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; created = builder.created; updated = builder.updated; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CounterexampleCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CounterexampleCollection.java index e235ae4f92d..f6e60523fd7 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CounterexampleCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CounterexampleCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateCounterexampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateCounterexampleOptions.java index c5388fff1eb..bb334d53fa3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateCounterexampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateCounterexampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createCounterexample options. @@ -96,8 +95,10 @@ public Builder counterexample(Counterexample counterexample) { } private CreateCounterexampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); workspaceId = builder.workspaceId; text = builder.text; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java index 2fe975a42c9..308755b901f 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createDialogNode options. @@ -27,7 +26,7 @@ public class CreateDialogNodeOptions extends GenericModel { /** * How the dialog node is processed. */ - public interface NodeType { + public interface Type { /** standard. */ String STANDARD = "standard"; /** event_handler. */ @@ -113,7 +112,7 @@ public interface DigressOutSlots { private Map metadata; private DialogNodeNextStep nextStep; private String title; - private String nodeType; + private String type; private String eventName; private String variable; private List actions; @@ -137,7 +136,7 @@ public static class Builder { private Map metadata; private DialogNodeNextStep nextStep; private String title; - private String nodeType; + private String type; private String eventName; private String variable; private List actions; @@ -158,7 +157,7 @@ private Builder(CreateDialogNodeOptions createDialogNodeOptions) { this.metadata = createDialogNodeOptions.metadata; this.nextStep = createDialogNodeOptions.nextStep; this.title = createDialogNodeOptions.title; - this.nodeType = createDialogNodeOptions.nodeType; + this.type = createDialogNodeOptions.type; this.eventName = createDialogNodeOptions.eventName; this.variable = createDialogNodeOptions.variable; this.actions = createDialogNodeOptions.actions; @@ -201,7 +200,8 @@ public CreateDialogNodeOptions build() { * @return the CreateDialogNodeOptions builder */ public Builder addActions(DialogNodeAction actions) { - Validator.notNull(actions, "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); if (this.actions == null) { this.actions = new ArrayList(); } @@ -331,13 +331,13 @@ public Builder title(String title) { } /** - * Set the nodeType. + * Set the type. * - * @param nodeType the nodeType + * @param type the type * @return the CreateDialogNodeOptions builder */ - public Builder nodeType(String nodeType) { - this.nodeType = nodeType; + public Builder type(String type) { + this.type = type; return this; } @@ -436,7 +436,7 @@ public Builder dialogNode(DialogNode dialogNode) { this.metadata = dialogNode.metadata(); this.nextStep = dialogNode.nextStep(); this.title = dialogNode.title(); - this.nodeType = dialogNode.nodeType(); + this.type = dialogNode.type(); this.eventName = dialogNode.eventName(); this.variable = dialogNode.variable(); this.actions = dialogNode.actions(); @@ -449,8 +449,10 @@ public Builder dialogNode(DialogNode dialogNode) { } private CreateDialogNodeOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notNull(builder.dialogNode, "dialogNode cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.dialogNode, + "dialogNode cannot be null"); workspaceId = builder.workspaceId; dialogNode = builder.dialogNode; description = builder.description; @@ -462,7 +464,7 @@ private CreateDialogNodeOptions(Builder builder) { metadata = builder.metadata; nextStep = builder.nextStep; title = builder.title; - nodeType = builder.nodeType; + type = builder.type; eventName = builder.eventName; variable = builder.variable; actions = builder.actions; @@ -553,8 +555,7 @@ public String previousSibling() { * Gets the output. * * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). * * @return the output */ @@ -608,14 +609,14 @@ public String title() { } /** - * Gets the nodeType. + * Gets the type. * * How the dialog node is processed. * - * @return the nodeType + * @return the type */ - public String nodeType() { - return nodeType; + public String type() { + return type; } /** diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntity.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntity.java index 8ad28d6f9e9..ef499bf92b0 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntity.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -19,7 +19,6 @@ import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * CreateEntity. @@ -28,7 +27,7 @@ public class CreateEntity extends GenericModel { private String entity; private String description; - private Map metadata; + private Map metadata; @SerializedName("fuzzy_match") private Boolean fuzzyMatch; private Date created; @@ -41,7 +40,7 @@ public class CreateEntity extends GenericModel { public static class Builder { private String entity; private String description; - private Map metadata; + private Map metadata; private Boolean fuzzyMatch; private Date created; private Date updated; @@ -88,7 +87,8 @@ public CreateEntity build() { * @return the CreateEntity builder */ public Builder addValues(CreateValue values) { - Validator.notNull(values, "values cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(values, + "values cannot be null"); if (this.values == null) { this.values = new ArrayList(); } @@ -124,7 +124,7 @@ public Builder description(String description) { * @param metadata the metadata * @return the CreateEntity builder */ - public Builder metadata(Map metadata) { + public Builder metadata(Map metadata) { this.metadata = metadata; return this; } @@ -176,7 +176,8 @@ public Builder values(List values) { } private CreateEntity(Builder builder) { - Validator.notNull(builder.entity, "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.entity, + "entity cannot be null"); entity = builder.entity; description = builder.description; metadata = builder.metadata; @@ -227,7 +228,7 @@ public String description() { * * @return the metadata */ - public Map metadata() { + public Map metadata() { return metadata; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntityOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntityOptions.java index 0f16e06550a..8cde9348c8c 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntityOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateEntityOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createEntity options. @@ -84,7 +83,8 @@ public CreateEntityOptions build() { * @return the CreateEntityOptions builder */ public Builder addValues(CreateValue values) { - Validator.notNull(values, "values cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(values, + "values cannot be null"); if (this.values == null) { this.values = new ArrayList(); } @@ -161,8 +161,10 @@ public Builder values(List values) { } private CreateEntityOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notNull(builder.entity, "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.entity, + "entity cannot be null"); workspaceId = builder.workspaceId; entity = builder.entity; description = builder.description; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateExampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateExampleOptions.java index cb99c42d1db..8592f264dfe 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateExampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createExample options. @@ -79,7 +78,8 @@ public CreateExampleOptions build() { * @return the CreateExampleOptions builder */ public Builder addMentions(Mention mentions) { - Validator.notNull(mentions, "mentions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(mentions, + "mentions cannot be null"); if (this.mentions == null) { this.mentions = new ArrayList(); } @@ -146,9 +146,12 @@ public Builder example(Example example) { } private CreateExampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); workspaceId = builder.workspaceId; intent = builder.intent; text = builder.text; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntent.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntent.java index 13c92e300e6..a4e92251877 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntent.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntent.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * CreateIntent. @@ -79,7 +78,8 @@ public CreateIntent build() { * @return the CreateIntent builder */ public Builder addExample(Example example) { - Validator.notNull(example, "example cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(example, + "example cannot be null"); if (this.examples == null) { this.examples = new ArrayList(); } @@ -145,7 +145,8 @@ public Builder examples(List examples) { } private CreateIntent(Builder builder) { - Validator.notNull(builder.intent, "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.intent, + "intent cannot be null"); intent = builder.intent; description = builder.description; created = builder.created; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntentOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntentOptions.java index daee8b0394d..dddfb069c9e 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntentOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateIntentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createIntent options. @@ -77,7 +76,8 @@ public CreateIntentOptions build() { * @return the CreateIntentOptions builder */ public Builder addExample(Example example) { - Validator.notNull(example, "example cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(example, + "example cannot be null"); if (this.examples == null) { this.examples = new ArrayList(); } @@ -132,8 +132,10 @@ public Builder examples(List examples) { } private CreateIntentOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notNull(builder.intent, "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.intent, + "intent cannot be null"); workspaceId = builder.workspaceId; intent = builder.intent; description = builder.description; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateSynonymOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateSynonymOptions.java index 78d4b839da6..14588a7a931 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateSynonymOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateSynonymOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createSynonym options. @@ -128,10 +127,14 @@ public Builder synonym(Synonym synonym) { } private CreateSynonymOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); - Validator.notNull(builder.synonym, "synonym cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.synonym, + "synonym cannot be null"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java index 40a6caea5bf..7ac07a25cee 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,9 +17,7 @@ import java.util.List; import java.util.Map; -import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * CreateValue. @@ -29,7 +27,7 @@ public class CreateValue extends GenericModel { /** * Specifies the type of entity value. */ - public interface ValueType { + public interface Type { /** synonyms. */ String SYNONYMS = "synonyms"; /** patterns. */ @@ -37,9 +35,8 @@ public interface ValueType { } private String value; - private Map metadata; - @SerializedName("type") - private String valueType; + private Map metadata; + private String type; private List synonyms; private List patterns; private Date created; @@ -50,8 +47,8 @@ public interface ValueType { */ public static class Builder { private String value; - private Map metadata; - private String valueType; + private Map metadata; + private String type; private List synonyms; private List patterns; private Date created; @@ -60,7 +57,7 @@ public static class Builder { private Builder(CreateValue createValue) { this.value = createValue.value; this.metadata = createValue.metadata; - this.valueType = createValue.valueType; + this.type = createValue.type; this.synonyms = createValue.synonyms; this.patterns = createValue.patterns; this.created = createValue.created; @@ -98,7 +95,8 @@ public CreateValue build() { * @return the CreateValue builder */ public Builder addSynonym(String synonym) { - Validator.notNull(synonym, "synonym cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(synonym, + "synonym cannot be null"); if (this.synonyms == null) { this.synonyms = new ArrayList(); } @@ -113,7 +111,8 @@ public Builder addSynonym(String synonym) { * @return the CreateValue builder */ public Builder addPattern(String pattern) { - Validator.notNull(pattern, "pattern cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(pattern, + "pattern cannot be null"); if (this.patterns == null) { this.patterns = new ArrayList(); } @@ -138,19 +137,19 @@ public Builder value(String value) { * @param metadata the metadata * @return the CreateValue builder */ - public Builder metadata(Map metadata) { + public Builder metadata(Map metadata) { this.metadata = metadata; return this; } /** - * Set the valueType. + * Set the type. * - * @param valueType the valueType + * @param type the type * @return the CreateValue builder */ - public Builder valueType(String valueType) { - this.valueType = valueType; + public Builder type(String type) { + this.type = type; return this; } @@ -202,10 +201,11 @@ public Builder updated(Date updated) { } private CreateValue(Builder builder) { - Validator.notNull(builder.value, "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); value = builder.value; metadata = builder.metadata; - valueType = builder.valueType; + type = builder.type; synonyms = builder.synonyms; patterns = builder.patterns; created = builder.created; @@ -241,19 +241,19 @@ public String value() { * * @return the metadata */ - public Map metadata() { + public Map metadata() { return metadata; } /** - * Gets the valueType. + * Gets the type. * * Specifies the type of entity value. * - * @return the valueType + * @return the type */ - public String valueType() { - return valueType; + public String type() { + return type; } /** @@ -276,8 +276,7 @@ public List synonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the patterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java index e1d123c4a87..4a0cca456b5 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createValue options. @@ -27,7 +26,7 @@ public class CreateValueOptions extends GenericModel { /** * Specifies the type of entity value. */ - public interface ValueType { + public interface Type { /** synonyms. */ String SYNONYMS = "synonyms"; /** patterns. */ @@ -38,7 +37,7 @@ public interface ValueType { private String entity; private String value; private Map metadata; - private String valueType; + private String type; private List synonyms; private List patterns; @@ -50,7 +49,7 @@ public static class Builder { private String entity; private String value; private Map metadata; - private String valueType; + private String type; private List synonyms; private List patterns; @@ -59,7 +58,7 @@ private Builder(CreateValueOptions createValueOptions) { this.entity = createValueOptions.entity; this.value = createValueOptions.value; this.metadata = createValueOptions.metadata; - this.valueType = createValueOptions.valueType; + this.type = createValueOptions.type; this.synonyms = createValueOptions.synonyms; this.patterns = createValueOptions.patterns; } @@ -99,7 +98,8 @@ public CreateValueOptions build() { * @return the CreateValueOptions builder */ public Builder addSynonym(String synonym) { - Validator.notNull(synonym, "synonym cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(synonym, + "synonym cannot be null"); if (this.synonyms == null) { this.synonyms = new ArrayList(); } @@ -114,7 +114,8 @@ public Builder addSynonym(String synonym) { * @return the CreateValueOptions builder */ public Builder addPattern(String pattern) { - Validator.notNull(pattern, "pattern cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(pattern, + "pattern cannot be null"); if (this.patterns == null) { this.patterns = new ArrayList(); } @@ -167,13 +168,13 @@ public Builder metadata(Map metadata) { } /** - * Set the valueType. + * Set the type. * - * @param valueType the valueType + * @param type the type * @return the CreateValueOptions builder */ - public Builder valueType(String valueType) { - this.valueType = valueType; + public Builder type(String type) { + this.type = type; return this; } @@ -200,32 +201,20 @@ public Builder patterns(List patterns) { this.patterns = patterns; return this; } - - /** - * Set the createValue. - * - * @param createValue the createValue - * @return the CreateValueOptions builder - */ - public Builder createValue(CreateValue createValue) { - this.value = createValue.value(); - this.metadata = createValue.metadata(); - this.valueType = createValue.valueType(); - this.synonyms = createValue.synonyms(); - this.patterns = createValue.patterns(); - return this; - } } private CreateValueOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notNull(builder.value, "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; metadata = builder.metadata; - valueType = builder.valueType; + type = builder.type; synonyms = builder.synonyms; patterns = builder.patterns; } @@ -286,14 +275,14 @@ public Map metadata() { } /** - * Gets the valueType. + * Gets the type. * * Specifies the type of entity value. * - * @return the valueType + * @return the type */ - public String valueType() { - return valueType; + public String type() { + return type; } /** @@ -316,8 +305,7 @@ public List synonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the patterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateWorkspaceOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateWorkspaceOptions.java index 2e8c4393114..83b57c1bb23 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateWorkspaceOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateWorkspaceOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The createWorkspace options. @@ -85,7 +84,8 @@ public CreateWorkspaceOptions build() { * @return the CreateWorkspaceOptions builder */ public Builder addIntent(CreateIntent intent) { - Validator.notNull(intent, "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(intent, + "intent cannot be null"); if (this.intents == null) { this.intents = new ArrayList(); } @@ -100,7 +100,8 @@ public Builder addIntent(CreateIntent intent) { * @return the CreateWorkspaceOptions builder */ public Builder addEntity(CreateEntity entity) { - Validator.notNull(entity, "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(entity, + "entity cannot be null"); if (this.entities == null) { this.entities = new ArrayList(); } @@ -115,7 +116,8 @@ public Builder addEntity(CreateEntity entity) { * @return the CreateWorkspaceOptions builder */ public Builder addDialogNode(DialogNode dialogNode) { - Validator.notNull(dialogNode, "dialogNode cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(dialogNode, + "dialogNode cannot be null"); if (this.dialogNodes == null) { this.dialogNodes = new ArrayList(); } @@ -130,7 +132,8 @@ public Builder addDialogNode(DialogNode dialogNode) { * @return the CreateWorkspaceOptions builder */ public Builder addCounterexample(Counterexample counterexample) { - Validator.notNull(counterexample, "counterexample cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(counterexample, + "counterexample cannot be null"); if (this.counterexamples == null) { this.counterexamples = new ArrayList(); } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteCounterexampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteCounterexampleOptions.java index cf7508b01e6..8d6cac20969 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteCounterexampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteCounterexampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteCounterexample options. @@ -85,8 +84,10 @@ public Builder text(String text) { } private DeleteCounterexampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.text, "text cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.text, + "text cannot be empty"); workspaceId = builder.workspaceId; text = builder.text; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteDialogNodeOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteDialogNodeOptions.java index f1185d8f790..98ec5d95e44 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteDialogNodeOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteDialogNodeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteDialogNode options. @@ -85,8 +84,10 @@ public Builder dialogNode(String dialogNode) { } private DeleteDialogNodeOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.dialogNode, "dialogNode cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.dialogNode, + "dialogNode cannot be empty"); workspaceId = builder.workspaceId; dialogNode = builder.dialogNode; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteEntityOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteEntityOptions.java index 602cdb75e0c..96bc51ec3c2 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteEntityOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteEntityOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteEntity options. @@ -85,8 +84,10 @@ public Builder entity(String entity) { } private DeleteEntityOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteExampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteExampleOptions.java index dc9300fbf71..dc4ced980e3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteExampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteExample options. @@ -101,9 +100,12 @@ public Builder text(String text) { } private DeleteExampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); - Validator.notEmpty(builder.text, "text cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.text, + "text cannot be empty"); workspaceId = builder.workspaceId; intent = builder.intent; text = builder.text; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteIntentOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteIntentOptions.java index 309c5ffd311..4b32f32e9e0 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteIntentOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteIntentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteIntent options. @@ -85,8 +84,10 @@ public Builder intent(String intent) { } private DeleteIntentOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); workspaceId = builder.workspaceId; intent = builder.intent; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteSynonymOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteSynonymOptions.java index f7b4ddf1006..4474d11d91b 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteSynonymOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteSynonymOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteSynonym options. @@ -117,10 +116,14 @@ public Builder synonym(String synonym) { } private DeleteSynonymOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); - Validator.notEmpty(builder.synonym, "synonym cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.synonym, + "synonym cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteUserDataOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteUserDataOptions.java index 2282d2e0820..8e10d76bd57 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteUserDataOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteUserDataOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteUserData options. @@ -69,7 +68,8 @@ public Builder customerId(String customerId) { } private DeleteUserDataOptions(Builder builder) { - Validator.notNull(builder.customerId, "customerId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, + "customerId cannot be null"); customerId = builder.customerId; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteValueOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteValueOptions.java index cc70545b955..9f868065804 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteValueOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteValueOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteValue options. @@ -101,9 +100,12 @@ public Builder value(String value) { } private DeleteValueOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteWorkspaceOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteWorkspaceOptions.java index b2b63b6e7b7..b474925cbc1 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteWorkspaceOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DeleteWorkspaceOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteWorkspace options. @@ -69,7 +68,8 @@ public Builder workspaceId(String workspaceId) { } private DeleteWorkspaceOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java index caa338e1d0e..56f65df14fa 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -19,7 +19,6 @@ import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * DialogNode. @@ -29,7 +28,7 @@ public class DialogNode extends GenericModel { /** * How the dialog node is processed. */ - public interface NodeType { + public interface Type { /** standard. */ String STANDARD = "standard"; /** event_handler. */ @@ -112,13 +111,12 @@ public interface DigressOutSlots { @SerializedName("previous_sibling") private String previousSibling; private DialogNodeOutput output; - private Map context; - private Map metadata; + private Map context; + private Map metadata; @SerializedName("next_step") private DialogNodeNextStep nextStep; private String title; - @SerializedName("type") - private String nodeType; + private String type; @SerializedName("event_name") private String eventName; private String variable; @@ -145,11 +143,11 @@ public static class Builder { private String parent; private String previousSibling; private DialogNodeOutput output; - private Map context; - private Map metadata; + private Map context; + private Map metadata; private DialogNodeNextStep nextStep; private String title; - private String nodeType; + private String type; private String eventName; private String variable; private List actions; @@ -172,7 +170,7 @@ private Builder(DialogNode dialogNode) { this.metadata = dialogNode.metadata; this.nextStep = dialogNode.nextStep; this.title = dialogNode.title; - this.nodeType = dialogNode.nodeType; + this.type = dialogNode.type; this.eventName = dialogNode.eventName; this.variable = dialogNode.variable; this.actions = dialogNode.actions; @@ -216,7 +214,8 @@ public DialogNode build() { * @return the DialogNode builder */ public Builder addActions(DialogNodeAction actions) { - Validator.notNull(actions, "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); if (this.actions == null) { this.actions = new ArrayList(); } @@ -296,7 +295,7 @@ public Builder output(DialogNodeOutput output) { * @param context the context * @return the DialogNode builder */ - public Builder context(Map context) { + public Builder context(Map context) { this.context = context; return this; } @@ -307,7 +306,7 @@ public Builder context(Map context) { * @param metadata the metadata * @return the DialogNode builder */ - public Builder metadata(Map metadata) { + public Builder metadata(Map metadata) { this.metadata = metadata; return this; } @@ -335,13 +334,13 @@ public Builder title(String title) { } /** - * Set the nodeType. + * Set the type. * - * @param nodeType the nodeType + * @param type the type * @return the DialogNode builder */ - public Builder nodeType(String nodeType) { - this.nodeType = nodeType; + public Builder type(String type) { + this.type = type; return this; } @@ -458,7 +457,8 @@ public Builder updated(Date updated) { } private DialogNode(Builder builder) { - Validator.notNull(builder.dialogNode, "dialogNode cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.dialogNode, + "dialogNode cannot be null"); dialogNode = builder.dialogNode; description = builder.description; conditions = builder.conditions; @@ -469,7 +469,7 @@ private DialogNode(Builder builder) { metadata = builder.metadata; nextStep = builder.nextStep; title = builder.title; - nodeType = builder.nodeType; + type = builder.type; eventName = builder.eventName; variable = builder.variable; actions = builder.actions; @@ -552,8 +552,7 @@ public String previousSibling() { * Gets the output. * * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). * * @return the output */ @@ -568,7 +567,7 @@ public DialogNodeOutput output() { * * @return the context */ - public Map context() { + public Map context() { return context; } @@ -579,7 +578,7 @@ public Map context() { * * @return the metadata */ - public Map metadata() { + public Map metadata() { return metadata; } @@ -607,14 +606,14 @@ public String title() { } /** - * Gets the nodeType. + * Gets the type. * * How the dialog node is processed. * - * @return the nodeType + * @return the type */ - public String nodeType() { - return nodeType; + public String type() { + return type; } /** diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java index 97706579d33..06fd35062b1 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,11 +12,12 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.List; +import java.util.Map; + import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Map; - /** * DialogNodeAction. */ @@ -25,7 +26,7 @@ public class DialogNodeAction extends GenericModel { /** * The type of action to invoke. */ - public interface ActionType { + public interface Type { /** client. */ String CLIENT = "client"; /** server. */ @@ -37,13 +38,133 @@ public interface ActionType { } private String name; - @SerializedName("type") - private String actionType; - private Map parameters; + private String type; + private Map parameters; @SerializedName("result_variable") private String resultVariable; private String credentials; + /** + * Builder. + */ + public static class Builder { + private String name; + private String type; + private Map parameters; + private String resultVariable; + private String credentials; + + private Builder(DialogNodeAction dialogNodeAction) { + this.name = dialogNodeAction.name; + this.type = dialogNodeAction.type; + this.parameters = dialogNodeAction.parameters; + this.resultVariable = dialogNodeAction.resultVariable; + this.credentials = dialogNodeAction.credentials; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param resultVariable the resultVariable + */ + public Builder(String name, String resultVariable) { + this.name = name; + this.resultVariable = resultVariable; + } + + /** + * Builds a DialogNodeAction. + * + * @return the dialogNodeAction + */ + public DialogNodeAction build() { + return new DialogNodeAction(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the DialogNodeAction builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the DialogNodeAction builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the parameters. + * + * @param parameters the parameters + * @return the DialogNodeAction builder + */ + public Builder parameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Set the resultVariable. + * + * @param resultVariable the resultVariable + * @return the DialogNodeAction builder + */ + public Builder resultVariable(String resultVariable) { + this.resultVariable = resultVariable; + return this; + } + + /** + * Set the credentials. + * + * @param credentials the credentials + * @return the DialogNodeAction builder + */ + public Builder credentials(String credentials) { + this.credentials = credentials; + return this; + } + } + + private DialogNodeAction(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resultVariable, + "resultVariable cannot be null"); + name = builder.name; + type = builder.type; + parameters = builder.parameters; + resultVariable = builder.resultVariable; + credentials = builder.credentials; + } + + /** + * New builder. + * + * @return a DialogNodeAction builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the name. * @@ -51,19 +172,19 @@ public interface ActionType { * * @return the name */ - public String getName() { + public String name() { return name; } /** - * Gets the actionType. + * Gets the type. * * The type of action to invoke. * - * @return the actionType + * @return the type */ - public String getActionType() { - return actionType; + public String type() { + return type; } /** @@ -73,7 +194,7 @@ public String getActionType() { * * @return the parameters */ - public Map getParameters() { + public Map parameters() { return parameters; } @@ -84,7 +205,7 @@ public Map getParameters() { * * @return the resultVariable */ - public String getResultVariable() { + public String resultVariable() { return resultVariable; } @@ -95,52 +216,7 @@ public String getResultVariable() { * * @return the credentials */ - public String getCredentials() { + public String credentials() { return credentials; } - - /** - * Sets the name. - * - * @param name the new name - */ - public void setName(final String name) { - this.name = name; - } - - /** - * Sets the actionType. - * - * @param actionType the new actionType - */ - public void setActionType(final String actionType) { - this.actionType = actionType; - } - - /** - * Sets the parameters. - * - * @param parameters the new parameters - */ - public void setParameters(final Map parameters) { - this.parameters = parameters; - } - - /** - * Sets the resultVariable. - * - * @param resultVariable the new resultVariable - */ - public void setResultVariable(final String resultVariable) { - this.resultVariable = resultVariable; - } - - /** - * Sets the credentials. - * - * @param credentials the new credentials - */ - public void setCredentials(final String credentials) { - this.credentials = credentials; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeCollection.java index 929254c8954..d0f9b0b6279 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeNextStep.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeNextStep.java index 1ed436edd59..77447a6bf63 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeNextStep.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeNextStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -39,7 +39,6 @@ public class DialogNodeNextStep extends GenericModel { * - `reprompt` * - `skip_slot` * - `skip_all_slots` - * * If you specify `jump_to`, then you must also specify a value for the `dialog_node` property. */ public interface Behavior { @@ -76,6 +75,95 @@ public interface Selector { private String dialogNode; private String selector; + /** + * Builder. + */ + public static class Builder { + private String behavior; + private String dialogNode; + private String selector; + + private Builder(DialogNodeNextStep dialogNodeNextStep) { + this.behavior = dialogNodeNextStep.behavior; + this.dialogNode = dialogNodeNextStep.dialogNode; + this.selector = dialogNodeNextStep.selector; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param behavior the behavior + */ + public Builder(String behavior) { + this.behavior = behavior; + } + + /** + * Builds a DialogNodeNextStep. + * + * @return the dialogNodeNextStep + */ + public DialogNodeNextStep build() { + return new DialogNodeNextStep(this); + } + + /** + * Set the behavior. + * + * @param behavior the behavior + * @return the DialogNodeNextStep builder + */ + public Builder behavior(String behavior) { + this.behavior = behavior; + return this; + } + + /** + * Set the dialogNode. + * + * @param dialogNode the dialogNode + * @return the DialogNodeNextStep builder + */ + public Builder dialogNode(String dialogNode) { + this.dialogNode = dialogNode; + return this; + } + + /** + * Set the selector. + * + * @param selector the selector + * @return the DialogNodeNextStep builder + */ + public Builder selector(String selector) { + this.selector = selector; + return this; + } + } + + private DialogNodeNextStep(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.behavior, + "behavior cannot be null"); + behavior = builder.behavior; + dialogNode = builder.dialogNode; + selector = builder.selector; + } + + /** + * New builder. + * + * @return a DialogNodeNextStep builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the behavior. * @@ -97,12 +185,11 @@ public interface Selector { * - `reprompt` * - `skip_slot` * - `skip_all_slots` - * * If you specify `jump_to`, then you must also specify a value for the `dialog_node` property. * * @return the behavior */ - public String getBehavior() { + public String behavior() { return behavior; } @@ -113,7 +200,7 @@ public String getBehavior() { * * @return the dialogNode */ - public String getDialogNode() { + public String dialogNode() { return dialogNode; } @@ -124,34 +211,7 @@ public String getDialogNode() { * * @return the selector */ - public String getSelector() { + public String selector() { return selector; } - - /** - * Sets the behavior. - * - * @param behavior the new behavior - */ - public void setBehavior(final String behavior) { - this.behavior = behavior; - } - - /** - * Sets the dialogNode. - * - * @param dialogNode the new dialogNode - */ - public void setDialogNode(final String dialogNode) { - this.dialogNode = dialogNode; - } - - /** - * Sets the selector. - * - * @param selector the new selector - */ - public void setSelector(final String selector) { - this.selector = selector; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java index d374d02362d..ffc2ebb9d6a 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -20,8 +20,7 @@ /** * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). */ public class DialogNodeOutput extends DynamicModel { @SerializedName("generic") diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java index cd4b773f58c..9d6d9344344 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -25,6 +26,9 @@ public class DialogNodeOutputGeneric extends GenericModel { /** * The type of response returned by the dialog node. The specified response type must be supported by the client * application or channel. + * + * **Note:** The **search_skill** response type is available only for Plus and Premium users, and is used only by the + * v2 runtime API. */ public interface ResponseType { /** text. */ @@ -37,6 +41,8 @@ public interface ResponseType { String OPTION = "option"; /** connect_to_agent. */ String CONNECT_TO_AGENT = "connect_to_agent"; + /** search_skill. */ + String SEARCH_SKILL = "search_skill"; } /** @@ -62,6 +68,16 @@ public interface Preference { String BUTTON = "button"; } + /** + * The type of the search query. Required when **response_type**=`search_skill`. + */ + public interface QueryType { + /** natural_language. */ + String NATURAL_LANGUAGE = "natural_language"; + /** discovery_query_language. */ + String DISCOVERY_QUERY_LANGUAGE = "discovery_query_language"; + } + @SerializedName("response_type") private String responseType; private List values; @@ -77,6 +93,317 @@ public interface Preference { private List options; @SerializedName("message_to_human_agent") private String messageToHumanAgent; + private String query; + @SerializedName("query_type") + private String queryType; + private String filter; + @SerializedName("discovery_version") + private String discoveryVersion; + + /** + * Builder. + */ + public static class Builder { + private String responseType; + private List values; + private String selectionPolicy; + private String delimiter; + private Long time; + private Boolean typing; + private String source; + private String title; + private String description; + private String preference; + private List options; + private String messageToHumanAgent; + private String query; + private String queryType; + private String filter; + private String discoveryVersion; + + private Builder(DialogNodeOutputGeneric dialogNodeOutputGeneric) { + this.responseType = dialogNodeOutputGeneric.responseType; + this.values = dialogNodeOutputGeneric.values; + this.selectionPolicy = dialogNodeOutputGeneric.selectionPolicy; + this.delimiter = dialogNodeOutputGeneric.delimiter; + this.time = dialogNodeOutputGeneric.time; + this.typing = dialogNodeOutputGeneric.typing; + this.source = dialogNodeOutputGeneric.source; + this.title = dialogNodeOutputGeneric.title; + this.description = dialogNodeOutputGeneric.description; + this.preference = dialogNodeOutputGeneric.preference; + this.options = dialogNodeOutputGeneric.options; + this.messageToHumanAgent = dialogNodeOutputGeneric.messageToHumanAgent; + this.query = dialogNodeOutputGeneric.query; + this.queryType = dialogNodeOutputGeneric.queryType; + this.filter = dialogNodeOutputGeneric.filter; + this.discoveryVersion = dialogNodeOutputGeneric.discoveryVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param responseType the responseType + */ + public Builder(String responseType) { + this.responseType = responseType; + } + + /** + * Builds a DialogNodeOutputGeneric. + * + * @return the dialogNodeOutputGeneric + */ + public DialogNodeOutputGeneric build() { + return new DialogNodeOutputGeneric(this); + } + + /** + * Adds an values to values. + * + * @param values the new values + * @return the DialogNodeOutputGeneric builder + */ + public Builder addValues(DialogNodeOutputTextValuesElement values) { + com.ibm.cloud.sdk.core.util.Validator.notNull(values, + "values cannot be null"); + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(values); + return this; + } + + /** + * Adds an options to options. + * + * @param options the new options + * @return the DialogNodeOutputGeneric builder + */ + public Builder addOptions(DialogNodeOutputOptionsElement options) { + com.ibm.cloud.sdk.core.util.Validator.notNull(options, + "options cannot be null"); + if (this.options == null) { + this.options = new ArrayList(); + } + this.options.add(options); + return this; + } + + /** + * Set the responseType. + * + * @param responseType the responseType + * @return the DialogNodeOutputGeneric builder + */ + public Builder responseType(String responseType) { + this.responseType = responseType; + return this; + } + + /** + * Set the values. + * Existing values will be replaced. + * + * @param values the values + * @return the DialogNodeOutputGeneric builder + */ + public Builder values(List values) { + this.values = values; + return this; + } + + /** + * Set the selectionPolicy. + * + * @param selectionPolicy the selectionPolicy + * @return the DialogNodeOutputGeneric builder + */ + public Builder selectionPolicy(String selectionPolicy) { + this.selectionPolicy = selectionPolicy; + return this; + } + + /** + * Set the delimiter. + * + * @param delimiter the delimiter + * @return the DialogNodeOutputGeneric builder + */ + public Builder delimiter(String delimiter) { + this.delimiter = delimiter; + return this; + } + + /** + * Set the time. + * + * @param time the time + * @return the DialogNodeOutputGeneric builder + */ + public Builder time(long time) { + this.time = time; + return this; + } + + /** + * Set the typing. + * + * @param typing the typing + * @return the DialogNodeOutputGeneric builder + */ + public Builder typing(Boolean typing) { + this.typing = typing; + return this; + } + + /** + * Set the source. + * + * @param source the source + * @return the DialogNodeOutputGeneric builder + */ + public Builder source(String source) { + this.source = source; + return this; + } + + /** + * Set the title. + * + * @param title the title + * @return the DialogNodeOutputGeneric builder + */ + public Builder title(String title) { + this.title = title; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the DialogNodeOutputGeneric builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the preference. + * + * @param preference the preference + * @return the DialogNodeOutputGeneric builder + */ + public Builder preference(String preference) { + this.preference = preference; + return this; + } + + /** + * Set the options. + * Existing options will be replaced. + * + * @param options the options + * @return the DialogNodeOutputGeneric builder + */ + public Builder options(List options) { + this.options = options; + return this; + } + + /** + * Set the messageToHumanAgent. + * + * @param messageToHumanAgent the messageToHumanAgent + * @return the DialogNodeOutputGeneric builder + */ + public Builder messageToHumanAgent(String messageToHumanAgent) { + this.messageToHumanAgent = messageToHumanAgent; + return this; + } + + /** + * Set the query. + * + * @param query the query + * @return the DialogNodeOutputGeneric builder + */ + public Builder query(String query) { + this.query = query; + return this; + } + + /** + * Set the queryType. + * + * @param queryType the queryType + * @return the DialogNodeOutputGeneric builder + */ + public Builder queryType(String queryType) { + this.queryType = queryType; + return this; + } + + /** + * Set the filter. + * + * @param filter the filter + * @return the DialogNodeOutputGeneric builder + */ + public Builder filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Set the discoveryVersion. + * + * @param discoveryVersion the discoveryVersion + * @return the DialogNodeOutputGeneric builder + */ + public Builder discoveryVersion(String discoveryVersion) { + this.discoveryVersion = discoveryVersion; + return this; + } + } + + private DialogNodeOutputGeneric(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.responseType, + "responseType cannot be null"); + responseType = builder.responseType; + values = builder.values; + selectionPolicy = builder.selectionPolicy; + delimiter = builder.delimiter; + time = builder.time; + typing = builder.typing; + source = builder.source; + title = builder.title; + description = builder.description; + preference = builder.preference; + options = builder.options; + messageToHumanAgent = builder.messageToHumanAgent; + query = builder.query; + queryType = builder.queryType; + filter = builder.filter; + discoveryVersion = builder.discoveryVersion; + } + + /** + * New builder. + * + * @return a DialogNodeOutputGeneric builder + */ + public Builder newBuilder() { + return new Builder(this); + } /** * Gets the responseType. @@ -84,9 +411,12 @@ public interface Preference { * The type of response returned by the dialog node. The specified response type must be supported by the client * application or channel. * + * **Note:** The **search_skill** response type is available only for Plus and Premium users, and is used only by the + * v2 runtime API. + * * @return the responseType */ - public String getResponseType() { + public String responseType() { return responseType; } @@ -97,7 +427,7 @@ public String getResponseType() { * * @return the values */ - public List getValues() { + public List values() { return values; } @@ -109,7 +439,7 @@ public List getValues() { * * @return the selectionPolicy */ - public String getSelectionPolicy() { + public String selectionPolicy() { return selectionPolicy; } @@ -120,7 +450,7 @@ public String getSelectionPolicy() { * * @return the delimiter */ - public String getDelimiter() { + public String delimiter() { return delimiter; } @@ -132,7 +462,7 @@ public String getDelimiter() { * * @return the time */ - public Long getTime() { + public Long time() { return time; } @@ -144,7 +474,7 @@ public Long getTime() { * * @return the typing */ - public Boolean isTyping() { + public Boolean typing() { return typing; } @@ -155,7 +485,7 @@ public Boolean isTyping() { * * @return the source */ - public String getSource() { + public String source() { return source; } @@ -166,7 +496,7 @@ public String getSource() { * * @return the title */ - public String getTitle() { + public String title() { return title; } @@ -177,7 +507,7 @@ public String getTitle() { * * @return the description */ - public String getDescription() { + public String description() { return description; } @@ -188,7 +518,7 @@ public String getDescription() { * * @return the preference */ - public String getPreference() { + public String preference() { return preference; } @@ -200,7 +530,7 @@ public String getPreference() { * * @return the options */ - public List getOptions() { + public List options() { return options; } @@ -212,115 +542,56 @@ public List getOptions() { * * @return the messageToHumanAgent */ - public String getMessageToHumanAgent() { + public String messageToHumanAgent() { return messageToHumanAgent; } /** - * Sets the responseType. + * Gets the query. * - * @param responseType the new responseType - */ - public void setResponseType(final String responseType) { - this.responseType = responseType; - } - - /** - * Sets the values. + * The text of the search query. This can be either a natural-language query or a query that uses the Discovery query + * language syntax, depending on the value of the **query_type** property. For more information, see the [Discovery + * service documentation](https://cloud.ibm.com/docs/services/discovery/query-operators.html#query-operators). + * Required when **response_type**=`search_skill`. * - * @param values the new values + * @return the query */ - public void setValues(final List values) { - this.values = values; + public String query() { + return query; } /** - * Sets the selectionPolicy. + * Gets the queryType. * - * @param selectionPolicy the new selectionPolicy - */ - public void setSelectionPolicy(final String selectionPolicy) { - this.selectionPolicy = selectionPolicy; - } - - /** - * Sets the delimiter. + * The type of the search query. Required when **response_type**=`search_skill`. * - * @param delimiter the new delimiter + * @return the queryType */ - public void setDelimiter(final String delimiter) { - this.delimiter = delimiter; + public String queryType() { + return queryType; } /** - * Sets the time. + * Gets the filter. * - * @param time the new time - */ - public void setTime(final long time) { - this.time = time; - } - - /** - * Sets the typing. + * An optional filter that narrows the set of documents to be searched. For more information, see the [Discovery + * service documentation]([Discovery service + * documentation](https://cloud.ibm.com/docs/services/discovery/query-parameters.html#filter). * - * @param typing the new typing + * @return the filter */ - public void setTyping(final Boolean typing) { - this.typing = typing; + public String filter() { + return filter; } /** - * Sets the source. + * Gets the discoveryVersion. * - * @param source the new source - */ - public void setSource(final String source) { - this.source = source; - } - - /** - * Sets the title. - * - * @param title the new title - */ - public void setTitle(final String title) { - this.title = title; - } - - /** - * Sets the description. - * - * @param description the new description - */ - public void setDescription(final String description) { - this.description = description; - } - - /** - * Sets the preference. - * - * @param preference the new preference - */ - public void setPreference(final String preference) { - this.preference = preference; - } - - /** - * Sets the options. - * - * @param options the new options - */ - public void setOptions(final List options) { - this.options = options; - } - - /** - * Sets the messageToHumanAgent. + * The version of the Discovery service API to use for the query. * - * @param messageToHumanAgent the new messageToHumanAgent + * @return the discoveryVersion */ - public void setMessageToHumanAgent(final String messageToHumanAgent) { - this.messageToHumanAgent = messageToHumanAgent; + public String discoveryVersion() { + return discoveryVersion; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputModifiers.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputModifiers.java index e421ddef042..620804c364f 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputModifiers.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputModifiers.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -21,6 +21,56 @@ public class DialogNodeOutputModifiers extends GenericModel { private Boolean overwrite; + /** + * Builder. + */ + public static class Builder { + private Boolean overwrite; + + private Builder(DialogNodeOutputModifiers dialogNodeOutputModifiers) { + this.overwrite = dialogNodeOutputModifiers.overwrite; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DialogNodeOutputModifiers. + * + * @return the dialogNodeOutputModifiers + */ + public DialogNodeOutputModifiers build() { + return new DialogNodeOutputModifiers(this); + } + + /** + * Set the overwrite. + * + * @param overwrite the overwrite + * @return the DialogNodeOutputModifiers builder + */ + public Builder overwrite(Boolean overwrite) { + this.overwrite = overwrite; + return this; + } + } + + private DialogNodeOutputModifiers(Builder builder) { + overwrite = builder.overwrite; + } + + /** + * New builder. + * + * @return a DialogNodeOutputModifiers builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the overwrite. * @@ -29,16 +79,7 @@ public class DialogNodeOutputModifiers extends GenericModel { * * @return the overwrite */ - public Boolean isOverwrite() { + public Boolean overwrite() { return overwrite; } - - /** - * Sets the overwrite. - * - * @param overwrite the new overwrite - */ - public void setOverwrite(final Boolean overwrite) { - this.overwrite = overwrite; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElement.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElement.java index da5c489f41d..a60de9c5786 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElement.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,6 +22,85 @@ public class DialogNodeOutputOptionsElement extends GenericModel { private String label; private DialogNodeOutputOptionsElementValue value; + /** + * Builder. + */ + public static class Builder { + private String label; + private DialogNodeOutputOptionsElementValue value; + + private Builder(DialogNodeOutputOptionsElement dialogNodeOutputOptionsElement) { + this.label = dialogNodeOutputOptionsElement.label; + this.value = dialogNodeOutputOptionsElement.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param label the label + * @param value the value + */ + public Builder(String label, DialogNodeOutputOptionsElementValue value) { + this.label = label; + this.value = value; + } + + /** + * Builds a DialogNodeOutputOptionsElement. + * + * @return the dialogNodeOutputOptionsElement + */ + public DialogNodeOutputOptionsElement build() { + return new DialogNodeOutputOptionsElement(this); + } + + /** + * Set the label. + * + * @param label the label + * @return the DialogNodeOutputOptionsElement builder + */ + public Builder label(String label) { + this.label = label; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the DialogNodeOutputOptionsElement builder + */ + public Builder value(DialogNodeOutputOptionsElementValue value) { + this.value = value; + return this; + } + } + + private DialogNodeOutputOptionsElement(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.label, + "label cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + label = builder.label; + value = builder.value; + } + + /** + * New builder. + * + * @return a DialogNodeOutputOptionsElement builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the label. * @@ -29,7 +108,7 @@ public class DialogNodeOutputOptionsElement extends GenericModel { * * @return the label */ - public String getLabel() { + public String label() { return label; } @@ -41,25 +120,7 @@ public String getLabel() { * * @return the value */ - public DialogNodeOutputOptionsElementValue getValue() { + public DialogNodeOutputOptionsElementValue value() { return value; } - - /** - * Sets the label. - * - * @param label the new label - */ - public void setLabel(final String label) { - this.label = label; - } - - /** - * Sets the value. - * - * @param value the new value - */ - public void setValue(final DialogNodeOutputOptionsElementValue value) { - this.value = value; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElementValue.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElementValue.java index 2eaf0f839e1..6e0311fad2b 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElementValue.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElementValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -26,6 +27,118 @@ public class DialogNodeOutputOptionsElementValue extends GenericModel { private List intents; private List entities; + /** + * Builder. + */ + public static class Builder { + private MessageInput input; + private List intents; + private List entities; + + private Builder(DialogNodeOutputOptionsElementValue dialogNodeOutputOptionsElementValue) { + this.input = dialogNodeOutputOptionsElementValue.input; + this.intents = dialogNodeOutputOptionsElementValue.intents; + this.entities = dialogNodeOutputOptionsElementValue.entities; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DialogNodeOutputOptionsElementValue. + * + * @return the dialogNodeOutputOptionsElementValue + */ + public DialogNodeOutputOptionsElementValue build() { + return new DialogNodeOutputOptionsElementValue(this); + } + + /** + * Adds an intents to intents. + * + * @param intents the new intents + * @return the DialogNodeOutputOptionsElementValue builder + */ + public Builder addIntents(RuntimeIntent intents) { + com.ibm.cloud.sdk.core.util.Validator.notNull(intents, + "intents cannot be null"); + if (this.intents == null) { + this.intents = new ArrayList(); + } + this.intents.add(intents); + return this; + } + + /** + * Adds an entities to entities. + * + * @param entities the new entities + * @return the DialogNodeOutputOptionsElementValue builder + */ + public Builder addEntities(RuntimeEntity entities) { + com.ibm.cloud.sdk.core.util.Validator.notNull(entities, + "entities cannot be null"); + if (this.entities == null) { + this.entities = new ArrayList(); + } + this.entities.add(entities); + return this; + } + + /** + * Set the input. + * + * @param input the input + * @return the DialogNodeOutputOptionsElementValue builder + */ + public Builder input(MessageInput input) { + this.input = input; + return this; + } + + /** + * Set the intents. + * Existing intents will be replaced. + * + * @param intents the intents + * @return the DialogNodeOutputOptionsElementValue builder + */ + public Builder intents(List intents) { + this.intents = intents; + return this; + } + + /** + * Set the entities. + * Existing entities will be replaced. + * + * @param entities the entities + * @return the DialogNodeOutputOptionsElementValue builder + */ + public Builder entities(List entities) { + this.entities = entities; + return this; + } + } + + private DialogNodeOutputOptionsElementValue(Builder builder) { + input = builder.input; + intents = builder.intents; + entities = builder.entities; + } + + /** + * New builder. + * + * @return a DialogNodeOutputOptionsElementValue builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the input. * @@ -33,7 +146,7 @@ public class DialogNodeOutputOptionsElementValue extends GenericModel { * * @return the input */ - public MessageInput getInput() { + public MessageInput input() { return input; } @@ -47,7 +160,7 @@ public MessageInput getInput() { * * @return the intents */ - public List getIntents() { + public List intents() { return intents; } @@ -61,34 +174,7 @@ public List getIntents() { * * @return the entities */ - public List getEntities() { + public List entities() { return entities; } - - /** - * Sets the input. - * - * @param input the new input - */ - public void setInput(final MessageInput input) { - this.input = input; - } - - /** - * Sets the intents. - * - * @param intents the new intents - */ - public void setIntents(final List intents) { - this.intents = intents; - } - - /** - * Sets the entities. - * - * @param entities the new entities - */ - public void setEntities(final List entities) { - this.entities = entities; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputTextValuesElement.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputTextValuesElement.java index cd7ac4ec85a..7b344ce5682 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputTextValuesElement.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputTextValuesElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -22,23 +22,64 @@ public class DialogNodeOutputTextValuesElement extends GenericModel { private String text; /** - * Gets the text. - * - * The text of a response. This string can include newline characters (`\\n`), Markdown tagging, or other special - * characters, if supported by the channel. + * Builder. + */ + public static class Builder { + private String text; + + private Builder(DialogNodeOutputTextValuesElement dialogNodeOutputTextValuesElement) { + this.text = dialogNodeOutputTextValuesElement.text; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DialogNodeOutputTextValuesElement. + * + * @return the dialogNodeOutputTextValuesElement + */ + public DialogNodeOutputTextValuesElement build() { + return new DialogNodeOutputTextValuesElement(this); + } + + /** + * Set the text. + * + * @param text the text + * @return the DialogNodeOutputTextValuesElement builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + } + + private DialogNodeOutputTextValuesElement(Builder builder) { + text = builder.text; + } + + /** + * New builder. * - * @return the text + * @return a DialogNodeOutputTextValuesElement builder */ - public String getText() { - return text; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the text. + * Gets the text. + * + * The text of a response. This string can include newline characters (`\n`), Markdown tagging, or other special + * characters, if supported by the channel. * - * @param text the new text + * @return the text */ - public void setText(final String text) { - this.text = text; + public String text() { + return text; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeVisitedDetails.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeVisitedDetails.java index f1e57708d28..ff883001944 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeVisitedDetails.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeVisitedDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -25,6 +25,84 @@ public class DialogNodeVisitedDetails extends GenericModel { private String title; private String conditions; + /** + * Builder. + */ + public static class Builder { + private String dialogNode; + private String title; + private String conditions; + + private Builder(DialogNodeVisitedDetails dialogNodeVisitedDetails) { + this.dialogNode = dialogNodeVisitedDetails.dialogNode; + this.title = dialogNodeVisitedDetails.title; + this.conditions = dialogNodeVisitedDetails.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DialogNodeVisitedDetails. + * + * @return the dialogNodeVisitedDetails + */ + public DialogNodeVisitedDetails build() { + return new DialogNodeVisitedDetails(this); + } + + /** + * Set the dialogNode. + * + * @param dialogNode the dialogNode + * @return the DialogNodeVisitedDetails builder + */ + public Builder dialogNode(String dialogNode) { + this.dialogNode = dialogNode; + return this; + } + + /** + * Set the title. + * + * @param title the title + * @return the DialogNodeVisitedDetails builder + */ + public Builder title(String title) { + this.title = title; + return this; + } + + /** + * Set the conditions. + * + * @param conditions the conditions + * @return the DialogNodeVisitedDetails builder + */ + public Builder conditions(String conditions) { + this.conditions = conditions; + return this; + } + } + + private DialogNodeVisitedDetails(Builder builder) { + dialogNode = builder.dialogNode; + title = builder.title; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a DialogNodeVisitedDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the dialogNode. * @@ -32,7 +110,7 @@ public class DialogNodeVisitedDetails extends GenericModel { * * @return the dialogNode */ - public String getDialogNode() { + public String dialogNode() { return dialogNode; } @@ -43,7 +121,7 @@ public String getDialogNode() { * * @return the title */ - public String getTitle() { + public String title() { return title; } @@ -54,34 +132,7 @@ public String getTitle() { * * @return the conditions */ - public String getConditions() { + public String conditions() { return conditions; } - - /** - * Sets the dialogNode. - * - * @param dialogNode the new dialogNode - */ - public void setDialogNode(final String dialogNode) { - this.dialogNode = dialogNode; - } - - /** - * Sets the title. - * - * @param title the new title - */ - public void setTitle(final String title) { - this.title = title; - } - - /** - * Sets the conditions. - * - * @param conditions the new conditions - */ - public void setConditions(final String conditions) { - this.conditions = conditions; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogRuntimeResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogRuntimeResponseGeneric.java deleted file mode 100644 index 8e3e12e4977..00000000000 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogRuntimeResponseGeneric.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright 2018 IBM Corp. All Rights Reserved. - * - * 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. - */ -package com.ibm.watson.assistant.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * DialogRuntimeResponseGeneric. - */ -public class DialogRuntimeResponseGeneric extends GenericModel { - - /** - * The type of response returned by the dialog node. The specified response type must be supported by the client - * application or channel. - * - * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for - * Premium users. - */ - public interface ResponseType { - /** text. */ - String TEXT = "text"; - /** pause. */ - String PAUSE = "pause"; - /** image. */ - String IMAGE = "image"; - /** option. */ - String OPTION = "option"; - /** connect_to_agent. */ - String CONNECT_TO_AGENT = "connect_to_agent"; - /** suggestion. */ - String SUGGESTION = "suggestion"; - } - - /** - * The preferred type of control to display. - */ - public interface Preference { - /** dropdown. */ - String DROPDOWN = "dropdown"; - /** button. */ - String BUTTON = "button"; - } - - @SerializedName("response_type") - private String responseType; - private String text; - private Long time; - private Boolean typing; - private String source; - private String title; - private String description; - private String preference; - private List options; - @SerializedName("message_to_human_agent") - private String messageToHumanAgent; - private String topic; - @SerializedName("dialog_node") - private String dialogNode; - private List suggestions; - - /** - * Gets the responseType. - * - * The type of response returned by the dialog node. The specified response type must be supported by the client - * application or channel. - * - * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for - * Premium users. - * - * @return the responseType - */ - public String getResponseType() { - return responseType; - } - - /** - * Gets the text. - * - * The text of the response. - * - * @return the text - */ - public String getText() { - return text; - } - - /** - * Gets the time. - * - * How long to pause, in milliseconds. - * - * @return the time - */ - public Long getTime() { - return time; - } - - /** - * Gets the typing. - * - * Whether to send a "user is typing" event during the pause. - * - * @return the typing - */ - public Boolean isTyping() { - return typing; - } - - /** - * Gets the source. - * - * The URL of the image. - * - * @return the source - */ - public String getSource() { - return source; - } - - /** - * Gets the title. - * - * The title or introductory text to show before the response. - * - * @return the title - */ - public String getTitle() { - return title; - } - - /** - * Gets the description. - * - * The description to show with the the response. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the preference. - * - * The preferred type of control to display. - * - * @return the preference - */ - public String getPreference() { - return preference; - } - - /** - * Gets the options. - * - * An array of objects describing the options from which the user can choose. - * - * @return the options - */ - public List getOptions() { - return options; - } - - /** - * Gets the messageToHumanAgent. - * - * A message to be sent to the human agent who will be taking over the conversation. - * - * @return the messageToHumanAgent - */ - public String getMessageToHumanAgent() { - return messageToHumanAgent; - } - - /** - * Gets the topic. - * - * A label identifying the topic of the conversation, derived from the **user_label** property of the relevant node. - * - * @return the topic - */ - public String getTopic() { - return topic; - } - - /** - * Gets the dialogNode. - * - * The ID of the dialog node that the **topic** property is taken from. The **topic** property is populated using the - * value of the dialog node's **user_label** property. - * - * @return the dialogNode - */ - public String getDialogNode() { - return dialogNode; - } - - /** - * Gets the suggestions. - * - * An array of objects describing the possible matching dialog nodes from which the user can choose. - * - * **Note:** The **suggestions** property is part of the disambiguation feature, which is only available for Premium - * users. - * - * @return the suggestions - */ - public List getSuggestions() { - return suggestions; - } - - /** - * Sets the responseType. - * - * @param responseType the new responseType - */ - public void setResponseType(final String responseType) { - this.responseType = responseType; - } - - /** - * Sets the text. - * - * @param text the new text - */ - public void setText(final String text) { - this.text = text; - } - - /** - * Sets the time. - * - * @param time the new time - */ - public void setTime(final long time) { - this.time = time; - } - - /** - * Sets the typing. - * - * @param typing the new typing - */ - public void setTyping(final Boolean typing) { - this.typing = typing; - } - - /** - * Sets the source. - * - * @param source the new source - */ - public void setSource(final String source) { - this.source = source; - } - - /** - * Sets the title. - * - * @param title the new title - */ - public void setTitle(final String title) { - this.title = title; - } - - /** - * Sets the description. - * - * @param description the new description - */ - public void setDescription(final String description) { - this.description = description; - } - - /** - * Sets the preference. - * - * @param preference the new preference - */ - public void setPreference(final String preference) { - this.preference = preference; - } - - /** - * Sets the options. - * - * @param options the new options - */ - public void setOptions(final List options) { - this.options = options; - } - - /** - * Sets the messageToHumanAgent. - * - * @param messageToHumanAgent the new messageToHumanAgent - */ - public void setMessageToHumanAgent(final String messageToHumanAgent) { - this.messageToHumanAgent = messageToHumanAgent; - } - - /** - * Sets the dialogNode. - * - * @param dialogNode the new dialogNode - */ - public void setDialogNode(final String dialogNode) { - this.dialogNode = dialogNode; - } - - /** - * Sets the suggestions. - * - * @param suggestions the new suggestions - */ - public void setSuggestions(final List suggestions) { - this.suggestions = suggestions; - } -} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestion.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestion.java index 839f9985315..628f1fba24b 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestion.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestion.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -15,8 +15,6 @@ import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Map; - /** * DialogSuggestion. */ @@ -24,10 +22,117 @@ public class DialogSuggestion extends GenericModel { private String label; private DialogSuggestionValue value; - private Map output; + private DialogSuggestionOutput output; @SerializedName("dialog_node") private String dialogNode; + /** + * Builder. + */ + public static class Builder { + private String label; + private DialogSuggestionValue value; + private DialogSuggestionOutput output; + private String dialogNode; + + private Builder(DialogSuggestion dialogSuggestion) { + this.label = dialogSuggestion.label; + this.value = dialogSuggestion.value; + this.output = dialogSuggestion.output; + this.dialogNode = dialogSuggestion.dialogNode; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param label the label + * @param value the value + */ + public Builder(String label, DialogSuggestionValue value) { + this.label = label; + this.value = value; + } + + /** + * Builds a DialogSuggestion. + * + * @return the dialogSuggestion + */ + public DialogSuggestion build() { + return new DialogSuggestion(this); + } + + /** + * Set the label. + * + * @param label the label + * @return the DialogSuggestion builder + */ + public Builder label(String label) { + this.label = label; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the DialogSuggestion builder + */ + public Builder value(DialogSuggestionValue value) { + this.value = value; + return this; + } + + /** + * Set the output. + * + * @param output the output + * @return the DialogSuggestion builder + */ + public Builder output(DialogSuggestionOutput output) { + this.output = output; + return this; + } + + /** + * Set the dialogNode. + * + * @param dialogNode the dialogNode + * @return the DialogSuggestion builder + */ + public Builder dialogNode(String dialogNode) { + this.dialogNode = dialogNode; + return this; + } + } + + private DialogSuggestion(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.label, + "label cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + label = builder.label; + value = builder.value; + output = builder.output; + dialogNode = builder.dialogNode; + } + + /** + * New builder. + * + * @return a DialogSuggestion builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the label. * @@ -36,7 +141,7 @@ public class DialogSuggestion extends GenericModel { * * @return the label */ - public String getLabel() { + public String label() { return label; } @@ -48,7 +153,7 @@ public String getLabel() { * * @return the value */ - public DialogSuggestionValue getValue() { + public DialogSuggestionValue value() { return value; } @@ -60,7 +165,7 @@ public DialogSuggestionValue getValue() { * * @return the output */ - public Map getOutput() { + public DialogSuggestionOutput output() { return output; } @@ -72,43 +177,7 @@ public Map getOutput() { * * @return the dialogNode */ - public String getDialogNode() { + public String dialogNode() { return dialogNode; } - - /** - * Sets the label. - * - * @param label the new label - */ - public void setLabel(final String label) { - this.label = label; - } - - /** - * Sets the value. - * - * @param value the new value - */ - public void setValue(final DialogSuggestionValue value) { - this.value = value; - } - - /** - * Sets the output. - * - * @param output the new output - */ - public void setOutput(final Map output) { - this.output = output; - } - - /** - * Sets the dialogNode. - * - * @param dialogNode the new dialogNode - */ - public void setDialogNode(final String dialogNode) { - this.dialogNode = dialogNode; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionOutput.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionOutput.java new file mode 100644 index 00000000000..758adab2cbb --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionOutput.java @@ -0,0 +1,123 @@ +/* + * (C) Copyright IBM Corp. 2019. + * + * 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. + */ +package com.ibm.watson.assistant.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.ibm.cloud.sdk.core.service.model.DynamicModel; + +/** + * The dialog output that will be returned from the Watson Assistant service if the user selects the corresponding + * option. + */ +public class DialogSuggestionOutput extends DynamicModel { + @SerializedName("nodes_visited") + private List nodesVisited; + @SerializedName("nodes_visited_details") + private List nodesVisitedDetails; + @SerializedName("text") + private List text; + @SerializedName("generic") + private List generic; + + public DialogSuggestionOutput() { + super(new TypeToken() { + }); + } + + /** + * Gets the nodesVisited. + * + * An array of the nodes that were triggered to create the response, in the order in which they were visited. This + * information is useful for debugging and for tracing the path taken through the node tree. + * + * @return the nodesVisited + */ + public List getNodesVisited() { + return this.nodesVisited; + } + + /** + * Sets the nodesVisited. + * + * @param nodesVisited the new nodesVisited + */ + public void setNodesVisited(final List nodesVisited) { + this.nodesVisited = nodesVisited; + } + + /** + * Gets the nodesVisitedDetails. + * + * An array of objects containing detailed diagnostic information about the nodes that were triggered during + * processing of the input message. Included only if **nodes_visited_details** is set to `true` in the message + * request. + * + * @return the nodesVisitedDetails + */ + public List getNodesVisitedDetails() { + return this.nodesVisitedDetails; + } + + /** + * Sets the nodesVisitedDetails. + * + * @param nodesVisitedDetails the new nodesVisitedDetails + */ + public void setNodesVisitedDetails(final List nodesVisitedDetails) { + this.nodesVisitedDetails = nodesVisitedDetails; + } + + /** + * Gets the text. + * + * An array of responses to the user. + * + * @return the text + */ + public List getText() { + return this.text; + } + + /** + * Sets the text. + * + * @param text the new text + */ + public void setText(final List text) { + this.text = text; + } + + /** + * Gets the generic. + * + * Output intended for any channel. It is the responsibility of the client application to implement the supported + * response types. + * + * @return the generic + */ + public List getGeneric() { + return this.generic; + } + + /** + * Sets the generic. + * + * @param generic the new generic + */ + public void setGeneric(final List generic) { + this.generic = generic; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java new file mode 100644 index 00000000000..dcf7b62066c --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java @@ -0,0 +1,444 @@ +/* + * (C) Copyright IBM Corp. 2019. + * + * 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. + */ +package com.ibm.watson.assistant.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * DialogSuggestionResponseGeneric. + */ +public class DialogSuggestionResponseGeneric extends GenericModel { + + /** + * The type of response returned by the dialog node. The specified response type must be supported by the client + * application or channel. + * + * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for Plus + * and Premium users. The **search_skill** response type is available only for Plus and Premium users, and is used + * only by the v2 runtime API. + */ + public interface ResponseType { + /** text. */ + String TEXT = "text"; + /** pause. */ + String PAUSE = "pause"; + /** image. */ + String IMAGE = "image"; + /** option. */ + String OPTION = "option"; + /** connect_to_agent. */ + String CONNECT_TO_AGENT = "connect_to_agent"; + /** search_skill. */ + String SEARCH_SKILL = "search_skill"; + } + + /** + * The preferred type of control to display. + */ + public interface Preference { + /** dropdown. */ + String DROPDOWN = "dropdown"; + /** button. */ + String BUTTON = "button"; + } + + @SerializedName("response_type") + private String responseType; + private String text; + private Long time; + private Boolean typing; + private String source; + private String title; + private String description; + private String preference; + private List options; + @SerializedName("message_to_human_agent") + private String messageToHumanAgent; + private String topic; + @SerializedName("dialog_node") + private String dialogNode; + + /** + * Builder. + */ + public static class Builder { + private String responseType; + private String text; + private Long time; + private Boolean typing; + private String source; + private String title; + private String description; + private String preference; + private List options; + private String messageToHumanAgent; + private String topic; + private String dialogNode; + + private Builder(DialogSuggestionResponseGeneric dialogSuggestionResponseGeneric) { + this.responseType = dialogSuggestionResponseGeneric.responseType; + this.text = dialogSuggestionResponseGeneric.text; + this.time = dialogSuggestionResponseGeneric.time; + this.typing = dialogSuggestionResponseGeneric.typing; + this.source = dialogSuggestionResponseGeneric.source; + this.title = dialogSuggestionResponseGeneric.title; + this.description = dialogSuggestionResponseGeneric.description; + this.preference = dialogSuggestionResponseGeneric.preference; + this.options = dialogSuggestionResponseGeneric.options; + this.messageToHumanAgent = dialogSuggestionResponseGeneric.messageToHumanAgent; + this.topic = dialogSuggestionResponseGeneric.topic; + this.dialogNode = dialogSuggestionResponseGeneric.dialogNode; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param responseType the responseType + */ + public Builder(String responseType) { + this.responseType = responseType; + } + + /** + * Builds a DialogSuggestionResponseGeneric. + * + * @return the dialogSuggestionResponseGeneric + */ + public DialogSuggestionResponseGeneric build() { + return new DialogSuggestionResponseGeneric(this); + } + + /** + * Adds an options to options. + * + * @param options the new options + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder addOptions(DialogNodeOutputOptionsElement options) { + com.ibm.cloud.sdk.core.util.Validator.notNull(options, + "options cannot be null"); + if (this.options == null) { + this.options = new ArrayList(); + } + this.options.add(options); + return this; + } + + /** + * Set the responseType. + * + * @param responseType the responseType + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder responseType(String responseType) { + this.responseType = responseType; + return this; + } + + /** + * Set the text. + * + * @param text the text + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + + /** + * Set the time. + * + * @param time the time + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder time(long time) { + this.time = time; + return this; + } + + /** + * Set the typing. + * + * @param typing the typing + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder typing(Boolean typing) { + this.typing = typing; + return this; + } + + /** + * Set the source. + * + * @param source the source + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder source(String source) { + this.source = source; + return this; + } + + /** + * Set the title. + * + * @param title the title + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder title(String title) { + this.title = title; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the preference. + * + * @param preference the preference + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder preference(String preference) { + this.preference = preference; + return this; + } + + /** + * Set the options. + * Existing options will be replaced. + * + * @param options the options + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder options(List options) { + this.options = options; + return this; + } + + /** + * Set the messageToHumanAgent. + * + * @param messageToHumanAgent the messageToHumanAgent + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder messageToHumanAgent(String messageToHumanAgent) { + this.messageToHumanAgent = messageToHumanAgent; + return this; + } + + /** + * Set the topic. + * + * @param topic the topic + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder topic(String topic) { + this.topic = topic; + return this; + } + + /** + * Set the dialogNode. + * + * @param dialogNode the dialogNode + * @return the DialogSuggestionResponseGeneric builder + */ + public Builder dialogNode(String dialogNode) { + this.dialogNode = dialogNode; + return this; + } + } + + private DialogSuggestionResponseGeneric(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.responseType, + "responseType cannot be null"); + responseType = builder.responseType; + text = builder.text; + time = builder.time; + typing = builder.typing; + source = builder.source; + title = builder.title; + description = builder.description; + preference = builder.preference; + options = builder.options; + messageToHumanAgent = builder.messageToHumanAgent; + topic = builder.topic; + dialogNode = builder.dialogNode; + } + + /** + * New builder. + * + * @return a DialogSuggestionResponseGeneric builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the responseType. + * + * The type of response returned by the dialog node. The specified response type must be supported by the client + * application or channel. + * + * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for Plus + * and Premium users. The **search_skill** response type is available only for Plus and Premium users, and is used + * only by the v2 runtime API. + * + * @return the responseType + */ + public String responseType() { + return responseType; + } + + /** + * Gets the text. + * + * The text of the response. + * + * @return the text + */ + public String text() { + return text; + } + + /** + * Gets the time. + * + * How long to pause, in milliseconds. + * + * @return the time + */ + public Long time() { + return time; + } + + /** + * Gets the typing. + * + * Whether to send a "user is typing" event during the pause. + * + * @return the typing + */ + public Boolean typing() { + return typing; + } + + /** + * Gets the source. + * + * The URL of the image. + * + * @return the source + */ + public String source() { + return source; + } + + /** + * Gets the title. + * + * The title or introductory text to show before the response. + * + * @return the title + */ + public String title() { + return title; + } + + /** + * Gets the description. + * + * The description to show with the the response. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the preference. + * + * The preferred type of control to display. + * + * @return the preference + */ + public String preference() { + return preference; + } + + /** + * Gets the options. + * + * An array of objects describing the options from which the user can choose. + * + * @return the options + */ + public List options() { + return options; + } + + /** + * Gets the messageToHumanAgent. + * + * A message to be sent to the human agent who will be taking over the conversation. + * + * @return the messageToHumanAgent + */ + public String messageToHumanAgent() { + return messageToHumanAgent; + } + + /** + * Gets the topic. + * + * A label identifying the topic of the conversation, derived from the **user_label** property of the relevant node. + * + * @return the topic + */ + public String topic() { + return topic; + } + + /** + * Gets the dialogNode. + * + * The ID of the dialog node that the **topic** property is taken from. The **topic** property is populated using the + * value of the dialog node's **user_label** property. + * + * @return the dialogNode + */ + public String dialogNode() { + return dialogNode; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionValue.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionValue.java index dd0f48dcb18..8f4fbf102e3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionValue.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -26,6 +27,118 @@ public class DialogSuggestionValue extends GenericModel { private List intents; private List entities; + /** + * Builder. + */ + public static class Builder { + private MessageInput input; + private List intents; + private List entities; + + private Builder(DialogSuggestionValue dialogSuggestionValue) { + this.input = dialogSuggestionValue.input; + this.intents = dialogSuggestionValue.intents; + this.entities = dialogSuggestionValue.entities; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DialogSuggestionValue. + * + * @return the dialogSuggestionValue + */ + public DialogSuggestionValue build() { + return new DialogSuggestionValue(this); + } + + /** + * Adds an intents to intents. + * + * @param intents the new intents + * @return the DialogSuggestionValue builder + */ + public Builder addIntents(RuntimeIntent intents) { + com.ibm.cloud.sdk.core.util.Validator.notNull(intents, + "intents cannot be null"); + if (this.intents == null) { + this.intents = new ArrayList(); + } + this.intents.add(intents); + return this; + } + + /** + * Adds an entities to entities. + * + * @param entities the new entities + * @return the DialogSuggestionValue builder + */ + public Builder addEntities(RuntimeEntity entities) { + com.ibm.cloud.sdk.core.util.Validator.notNull(entities, + "entities cannot be null"); + if (this.entities == null) { + this.entities = new ArrayList(); + } + this.entities.add(entities); + return this; + } + + /** + * Set the input. + * + * @param input the input + * @return the DialogSuggestionValue builder + */ + public Builder input(MessageInput input) { + this.input = input; + return this; + } + + /** + * Set the intents. + * Existing intents will be replaced. + * + * @param intents the intents + * @return the DialogSuggestionValue builder + */ + public Builder intents(List intents) { + this.intents = intents; + return this; + } + + /** + * Set the entities. + * Existing entities will be replaced. + * + * @param entities the entities + * @return the DialogSuggestionValue builder + */ + public Builder entities(List entities) { + this.entities = entities; + return this; + } + } + + private DialogSuggestionValue(Builder builder) { + input = builder.input; + intents = builder.intents; + entities = builder.entities; + } + + /** + * New builder. + * + * @return a DialogSuggestionValue builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the input. * @@ -33,7 +146,7 @@ public class DialogSuggestionValue extends GenericModel { * * @return the input */ - public MessageInput getInput() { + public MessageInput input() { return input; } @@ -44,7 +157,7 @@ public MessageInput getInput() { * * @return the intents */ - public List getIntents() { + public List intents() { return intents; } @@ -55,34 +168,7 @@ public List getIntents() { * * @return the entities */ - public List getEntities() { + public List entities() { return entities; } - - /** - * Sets the input. - * - * @param input the new input - */ - public void setInput(final MessageInput input) { - this.input = input; - } - - /** - * Sets the intents. - * - * @param intents the new intents - */ - public void setIntents(final List intents) { - this.intents = intents; - } - - /** - * Sets the entities. - * - * @param entities the new entities - */ - public void setEntities(final List entities) { - this.entities = entities; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Entity.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Entity.java index a877d1c1ea0..57236243382 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Entity.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Entity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -26,7 +26,7 @@ public class Entity extends GenericModel { private String entity; private String description; - private Map metadata; + private Map metadata; @SerializedName("fuzzy_match") private Boolean fuzzyMatch; private Date created; @@ -65,7 +65,7 @@ public String getDescription() { * * @return the metadata */ - public Map getMetadata() { + public Map getMetadata() { return metadata; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityCollection.java index f1984376057..155b26d1446 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMention.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMention.java index 055e93995e9..610b7becd37 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMention.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMention.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMentionCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMentionCollection.java index 66018c7d382..99d53e8cc03 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMentionCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/EntityMentionCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Example.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Example.java index c91aeb7b1f9..3ad58a5b7be 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Example.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Example.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * Example. @@ -76,7 +75,8 @@ public Example build() { * @return the Example builder */ public Builder addMentions(Mention mentions) { - Validator.notNull(mentions, "mentions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(mentions, + "mentions cannot be null"); if (this.mentions == null) { this.mentions = new ArrayList(); } @@ -131,7 +131,8 @@ public Builder updated(Date updated) { } private Example(Builder builder) { - Validator.notNull(builder.text, "text cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, + "text cannot be null"); text = builder.text; mentions = builder.mentions; created = builder.created; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ExampleCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ExampleCollection.java index 2ae63a04675..8dafe177334 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ExampleCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ExampleCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetCounterexampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetCounterexampleOptions.java index c33075ed9fe..6167b1b9989 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetCounterexampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetCounterexampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getCounterexample options. @@ -99,8 +98,10 @@ public Builder includeAudit(Boolean includeAudit) { } private GetCounterexampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.text, "text cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.text, + "text cannot be empty"); workspaceId = builder.workspaceId; text = builder.text; includeAudit = builder.includeAudit; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetDialogNodeOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetDialogNodeOptions.java index 7ca9e2ac26f..7cdb652fd16 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetDialogNodeOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetDialogNodeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getDialogNode options. @@ -99,8 +98,10 @@ public Builder includeAudit(Boolean includeAudit) { } private GetDialogNodeOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.dialogNode, "dialogNode cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.dialogNode, + "dialogNode cannot be empty"); workspaceId = builder.workspaceId; dialogNode = builder.dialogNode; includeAudit = builder.includeAudit; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetEntityOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetEntityOptions.java index 520d9afaf31..c9d3b666447 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetEntityOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetEntityOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getEntity options. @@ -113,8 +112,10 @@ public Builder includeAudit(Boolean includeAudit) { } private GetEntityOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; export = builder.export; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetExampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetExampleOptions.java index 81cf2bd11c8..b17eb8d7416 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetExampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getExample options. @@ -115,9 +114,12 @@ public Builder includeAudit(Boolean includeAudit) { } private GetExampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); - Validator.notEmpty(builder.text, "text cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.text, + "text cannot be empty"); workspaceId = builder.workspaceId; intent = builder.intent; text = builder.text; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetIntentOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetIntentOptions.java index 1c279c1fdbe..d2d877c516b 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetIntentOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetIntentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getIntent options. @@ -113,8 +112,10 @@ public Builder includeAudit(Boolean includeAudit) { } private GetIntentOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); workspaceId = builder.workspaceId; intent = builder.intent; export = builder.export; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetSynonymOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetSynonymOptions.java index d34c8a5f188..ddfbfeead46 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetSynonymOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetSynonymOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getSynonym options. @@ -131,10 +130,14 @@ public Builder includeAudit(Boolean includeAudit) { } private GetSynonymOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); - Validator.notEmpty(builder.synonym, "synonym cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.synonym, + "synonym cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetValueOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetValueOptions.java index 566fa1e58fd..f34deaaf01e 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetValueOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetValueOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getValue options. @@ -129,9 +128,12 @@ public Builder includeAudit(Boolean includeAudit) { } private GetValueOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetWorkspaceOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetWorkspaceOptions.java index 578982376b2..456dab867ec 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetWorkspaceOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/GetWorkspaceOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The getWorkspace options. @@ -120,7 +119,8 @@ public Builder sort(String sort) { } private GetWorkspaceOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; export = builder.export; includeAudit = builder.includeAudit; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Intent.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Intent.java index 4ba2e4e5f39..4ad05244b12 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Intent.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Intent.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/IntentCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/IntentCollection.java index 0047b8bc5bf..7b6666297bd 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/IntentCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/IntentCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListAllLogsOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListAllLogsOptions.java index a4509711edf..f0e78533d9c 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListAllLogsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListAllLogsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listAllLogs options. @@ -111,7 +110,8 @@ public Builder cursor(String cursor) { } private ListAllLogsOptions(Builder builder) { - Validator.notNull(builder.filter, "filter cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.filter, + "filter cannot be null"); filter = builder.filter; sort = builder.sort; pageLimit = builder.pageLimit; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListCounterexamplesOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListCounterexamplesOptions.java index b03a7bfb524..518a95af2f0 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListCounterexamplesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListCounterexamplesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listCounterexamples options. @@ -33,7 +32,6 @@ public interface Sort { private String workspaceId; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -44,7 +42,6 @@ public interface Sort { public static class Builder { private String workspaceId; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -52,7 +49,6 @@ public static class Builder { private Builder(ListCounterexamplesOptions listCounterexamplesOptions) { this.workspaceId = listCounterexamplesOptions.workspaceId; this.pageLimit = listCounterexamplesOptions.pageLimit; - this.includeCount = listCounterexamplesOptions.includeCount; this.sort = listCounterexamplesOptions.sort; this.cursor = listCounterexamplesOptions.cursor; this.includeAudit = listCounterexamplesOptions.includeAudit; @@ -104,17 +100,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListCounterexamplesOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -150,10 +135,10 @@ public Builder includeAudit(Boolean includeAudit) { } private ListCounterexamplesOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -190,17 +175,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListDialogNodesOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListDialogNodesOptions.java index 50e065398cb..af92b81b5c3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListDialogNodesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListDialogNodesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listDialogNodes options. @@ -33,7 +32,6 @@ public interface Sort { private String workspaceId; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -44,7 +42,6 @@ public interface Sort { public static class Builder { private String workspaceId; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -52,7 +49,6 @@ public static class Builder { private Builder(ListDialogNodesOptions listDialogNodesOptions) { this.workspaceId = listDialogNodesOptions.workspaceId; this.pageLimit = listDialogNodesOptions.pageLimit; - this.includeCount = listDialogNodesOptions.includeCount; this.sort = listDialogNodesOptions.sort; this.cursor = listDialogNodesOptions.cursor; this.includeAudit = listDialogNodesOptions.includeAudit; @@ -104,17 +100,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListDialogNodesOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -150,10 +135,10 @@ public Builder includeAudit(Boolean includeAudit) { } private ListDialogNodesOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -190,17 +175,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListEntitiesOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListEntitiesOptions.java index ff6acaf3b18..c5094de2c8d 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListEntitiesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListEntitiesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listEntities options. @@ -34,7 +33,6 @@ public interface Sort { private String workspaceId; private Boolean export; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -46,7 +44,6 @@ public static class Builder { private String workspaceId; private Boolean export; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -55,7 +52,6 @@ private Builder(ListEntitiesOptions listEntitiesOptions) { this.workspaceId = listEntitiesOptions.workspaceId; this.export = listEntitiesOptions.export; this.pageLimit = listEntitiesOptions.pageLimit; - this.includeCount = listEntitiesOptions.includeCount; this.sort = listEntitiesOptions.sort; this.cursor = listEntitiesOptions.cursor; this.includeAudit = listEntitiesOptions.includeAudit; @@ -118,17 +114,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListEntitiesOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -164,11 +149,11 @@ public Builder includeAudit(Boolean includeAudit) { } private ListEntitiesOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; export = builder.export; pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -217,17 +202,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListExamplesOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListExamplesOptions.java index 49c9a1dbccb..3a4735e5f10 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListExamplesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListExamplesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listExamples options. @@ -34,7 +33,6 @@ public interface Sort { private String workspaceId; private String intent; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -46,7 +44,6 @@ public static class Builder { private String workspaceId; private String intent; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -55,7 +52,6 @@ private Builder(ListExamplesOptions listExamplesOptions) { this.workspaceId = listExamplesOptions.workspaceId; this.intent = listExamplesOptions.intent; this.pageLimit = listExamplesOptions.pageLimit; - this.includeCount = listExamplesOptions.includeCount; this.sort = listExamplesOptions.sort; this.cursor = listExamplesOptions.cursor; this.includeAudit = listExamplesOptions.includeAudit; @@ -120,17 +116,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListExamplesOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -166,12 +151,13 @@ public Builder includeAudit(Boolean includeAudit) { } private ListExamplesOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); workspaceId = builder.workspaceId; intent = builder.intent; pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -219,17 +205,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListIntentsOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListIntentsOptions.java index bc390f22953..9f24b56a3f8 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListIntentsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListIntentsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listIntents options. @@ -34,7 +33,6 @@ public interface Sort { private String workspaceId; private Boolean export; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -46,7 +44,6 @@ public static class Builder { private String workspaceId; private Boolean export; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -55,7 +52,6 @@ private Builder(ListIntentsOptions listIntentsOptions) { this.workspaceId = listIntentsOptions.workspaceId; this.export = listIntentsOptions.export; this.pageLimit = listIntentsOptions.pageLimit; - this.includeCount = listIntentsOptions.includeCount; this.sort = listIntentsOptions.sort; this.cursor = listIntentsOptions.cursor; this.includeAudit = listIntentsOptions.includeAudit; @@ -118,17 +114,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListIntentsOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -164,11 +149,11 @@ public Builder includeAudit(Boolean includeAudit) { } private ListIntentsOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; export = builder.export; pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -217,17 +202,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListLogsOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListLogsOptions.java index ef6c341b506..5f7bab9c339 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListLogsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListLogsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listLogs options. @@ -125,7 +124,8 @@ public Builder cursor(String cursor) { } private ListLogsOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; sort = builder.sort; filter = builder.filter; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListMentionsOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListMentionsOptions.java index 6099ec3b345..f8eb554d662 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListMentionsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListMentionsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listMentions options. @@ -113,8 +112,10 @@ public Builder includeAudit(Boolean includeAudit) { } private ListMentionsOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; export = builder.export; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListSynonymsOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListSynonymsOptions.java index cc422444f6d..d3a235ab204 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListSynonymsOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListSynonymsOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listSynonyms options. @@ -35,7 +34,6 @@ public interface Sort { private String entity; private String value; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -48,7 +46,6 @@ public static class Builder { private String entity; private String value; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -58,7 +55,6 @@ private Builder(ListSynonymsOptions listSynonymsOptions) { this.entity = listSynonymsOptions.entity; this.value = listSynonymsOptions.value; this.pageLimit = listSynonymsOptions.pageLimit; - this.includeCount = listSynonymsOptions.includeCount; this.sort = listSynonymsOptions.sort; this.cursor = listSynonymsOptions.cursor; this.includeAudit = listSynonymsOptions.includeAudit; @@ -136,17 +132,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListSynonymsOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -182,14 +167,16 @@ public Builder includeAudit(Boolean includeAudit) { } private ListSynonymsOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -248,17 +235,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListValuesOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListValuesOptions.java index 8abb2ea052b..8bd8e624adc 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListValuesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListValuesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The listValues options. @@ -35,7 +34,6 @@ public interface Sort { private String entity; private Boolean export; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -48,7 +46,6 @@ public static class Builder { private String entity; private Boolean export; private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -58,7 +55,6 @@ private Builder(ListValuesOptions listValuesOptions) { this.entity = listValuesOptions.entity; this.export = listValuesOptions.export; this.pageLimit = listValuesOptions.pageLimit; - this.includeCount = listValuesOptions.includeCount; this.sort = listValuesOptions.sort; this.cursor = listValuesOptions.cursor; this.includeAudit = listValuesOptions.includeAudit; @@ -134,17 +130,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListValuesOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -180,13 +165,14 @@ public Builder includeAudit(Boolean includeAudit) { } private ListValuesOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; export = builder.export; pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -246,17 +232,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListWorkspacesOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListWorkspacesOptions.java index 8b1af04efee..cb19dd0f849 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListWorkspacesOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ListWorkspacesOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -31,7 +31,6 @@ public interface Sort { } private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; @@ -41,14 +40,12 @@ public interface Sort { */ public static class Builder { private Long pageLimit; - private Boolean includeCount; private String sort; private String cursor; private Boolean includeAudit; private Builder(ListWorkspacesOptions listWorkspacesOptions) { this.pageLimit = listWorkspacesOptions.pageLimit; - this.includeCount = listWorkspacesOptions.includeCount; this.sort = listWorkspacesOptions.sort; this.cursor = listWorkspacesOptions.cursor; this.includeAudit = listWorkspacesOptions.includeAudit; @@ -80,17 +77,6 @@ public Builder pageLimit(long pageLimit) { return this; } - /** - * Set the includeCount. - * - * @param includeCount the includeCount - * @return the ListWorkspacesOptions builder - */ - public Builder includeCount(Boolean includeCount) { - this.includeCount = includeCount; - return this; - } - /** * Set the sort. * @@ -127,7 +113,6 @@ public Builder includeAudit(Boolean includeAudit) { private ListWorkspacesOptions(Builder builder) { pageLimit = builder.pageLimit; - includeCount = builder.includeCount; sort = builder.sort; cursor = builder.cursor; includeAudit = builder.includeAudit; @@ -153,17 +138,6 @@ public Long pageLimit() { return pageLimit; } - /** - * Gets the includeCount. - * - * Whether to include information about the number of records returned. - * - * @return the includeCount - */ - public Boolean includeCount() { - return includeCount; - } - /** * Gets the sort. * diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Log.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Log.java index 354347be46c..8b2788ad799 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Log.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Log.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogCollection.java index e6d27eb2a9e..0fa7d7d03e3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogMessage.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogMessage.java index 9dfb95200d7..0b27a6d06a8 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogMessage.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,14 +12,13 @@ */ package com.ibm.watson.assistant.v1.model; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.ibm.cloud.sdk.core.service.model.DynamicModel; +import com.ibm.cloud.sdk.core.service.model.GenericModel; /** * Log message details. */ -public class LogMessage extends DynamicModel { +public class LogMessage extends GenericModel { + /** * The severity of the log message. */ @@ -32,34 +31,97 @@ public interface Level { String WARN = "warn"; } - @SerializedName("level") private String level; - @SerializedName("msg") private String msg; - public LogMessage() { - super(new TypeToken() { - }); + /** + * Builder. + */ + public static class Builder { + private String level; + private String msg; + + private Builder(LogMessage logMessage) { + this.level = logMessage.level; + this.msg = logMessage.msg; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param level the level + * @param msg the msg + */ + public Builder(String level, String msg) { + this.level = level; + this.msg = msg; + } + + /** + * Builds a LogMessage. + * + * @return the logMessage + */ + public LogMessage build() { + return new LogMessage(this); + } + + /** + * Set the level. + * + * @param level the level + * @return the LogMessage builder + */ + public Builder level(String level) { + this.level = level; + return this; + } + + /** + * Set the msg. + * + * @param msg the msg + * @return the LogMessage builder + */ + public Builder msg(String msg) { + this.msg = msg; + return this; + } + } + + private LogMessage(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.level, + "level cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.msg, + "msg cannot be null"); + level = builder.level; + msg = builder.msg; } /** - * Gets the level. + * New builder. * - * The severity of the log message. - * - * @return the level + * @return a LogMessage builder */ - public String getLevel() { - return this.level; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the level. + * Gets the level. + * + * The severity of the log message. * - * @param level the new level + * @return the level */ - public void setLevel(final String level) { - this.level = level; + public String level() { + return level; } /** @@ -69,16 +131,7 @@ public void setLevel(final String level) { * * @return the msg */ - public String getMsg() { - return this.msg; - } - - /** - * Sets the msg. - * - * @param msg the new msg - */ - public void setMsg(final String msg) { - this.msg = msg; + public String msg() { + return msg; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogPagination.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogPagination.java index 1053975acaa..092348f826d 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogPagination.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/LogPagination.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Mention.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Mention.java index fed439eb5f7..686c7478f8e 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Mention.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Mention.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.ArrayList; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,6 +25,102 @@ public class Mention extends GenericModel { private String entity; private List location; + /** + * Builder. + */ + public static class Builder { + private String entity; + private List location; + + private Builder(Mention mention) { + this.entity = mention.entity; + this.location = mention.location; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param entity the entity + * @param location the location + */ + public Builder(String entity, List location) { + this.entity = entity; + this.location = location; + } + + /** + * Builds a Mention. + * + * @return the mention + */ + public Mention build() { + return new Mention(this); + } + + /** + * Adds an location to location. + * + * @param location the new location + * @return the Mention builder + */ + public Builder addLocation(Long location) { + com.ibm.cloud.sdk.core.util.Validator.notNull(location, + "location cannot be null"); + if (this.location == null) { + this.location = new ArrayList(); + } + this.location.add(location); + return this; + } + + /** + * Set the entity. + * + * @param entity the entity + * @return the Mention builder + */ + public Builder entity(String entity) { + this.entity = entity; + return this; + } + + /** + * Set the location. + * Existing location will be replaced. + * + * @param location the location + * @return the Mention builder + */ + public Builder location(List location) { + this.location = location; + return this; + } + } + + private Mention(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.entity, + "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.location, + "location cannot be null"); + entity = builder.entity; + location = builder.location; + } + + /** + * New builder. + * + * @return a Mention builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the entity. * @@ -31,7 +128,7 @@ public class Mention extends GenericModel { * * @return the entity */ - public String getEntity() { + public String entity() { return entity; } @@ -42,25 +139,7 @@ public String getEntity() { * * @return the location */ - public List getLocation() { + public List location() { return location; } - - /** - * Sets the entity. - * - * @param entity the new entity - */ - public void setEntity(final String entity) { - this.entity = entity; - } - - /** - * Sets the location. - * - * @param location the new location - */ - public void setLocation(final List location) { - this.location = location; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageContextMetadata.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageContextMetadata.java index c63256f9ca9..c4de2771c2e 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageContextMetadata.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageContextMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -24,6 +24,70 @@ public class MessageContextMetadata extends GenericModel { @SerializedName("user_id") private String userId; + /** + * Builder. + */ + public static class Builder { + private String deployment; + private String userId; + + private Builder(MessageContextMetadata messageContextMetadata) { + this.deployment = messageContextMetadata.deployment; + this.userId = messageContextMetadata.userId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MessageContextMetadata. + * + * @return the messageContextMetadata + */ + public MessageContextMetadata build() { + return new MessageContextMetadata(this); + } + + /** + * Set the deployment. + * + * @param deployment the deployment + * @return the MessageContextMetadata builder + */ + public Builder deployment(String deployment) { + this.deployment = deployment; + return this; + } + + /** + * Set the userId. + * + * @param userId the userId + * @return the MessageContextMetadata builder + */ + public Builder userId(String userId) { + this.userId = userId; + return this; + } + } + + private MessageContextMetadata(Builder builder) { + deployment = builder.deployment; + userId = builder.userId; + } + + /** + * New builder. + * + * @return a MessageContextMetadata builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the deployment. * @@ -32,7 +96,7 @@ public class MessageContextMetadata extends GenericModel { * * @return the deployment */ - public String getDeployment() { + public String deployment() { return deployment; } @@ -46,25 +110,7 @@ public String getDeployment() { * * @return the userId */ - public String getUserId() { + public String userId() { return userId; } - - /** - * Sets the deployment. - * - * @param deployment the new deployment - */ - public void setDeployment(final String deployment) { - this.deployment = deployment; - } - - /** - * Sets the userId. - * - * @param userId the new userId - */ - public void setUserId(final String userId) { - this.userId = userId; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageInput.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageInput.java index 9ab49e6e00f..ca2c637d88f 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageInput.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageInput.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageOptions.java index 7820078802b..f40ed7bf88b 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The message options. @@ -87,7 +86,8 @@ public MessageOptions build() { * @return the MessageOptions builder */ public Builder addIntent(RuntimeIntent intent) { - Validator.notNull(intent, "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(intent, + "intent cannot be null"); if (this.intents == null) { this.intents = new ArrayList(); } @@ -102,7 +102,8 @@ public Builder addIntent(RuntimeIntent intent) { * @return the MessageOptions builder */ public Builder addEntity(RuntimeEntity entity) { - Validator.notNull(entity, "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(entity, + "entity cannot be null"); if (this.entities == null) { this.entities = new ArrayList(); } @@ -207,18 +208,19 @@ public Builder nodesVisitedDetails(Boolean nodesVisitedDetails) { * @return the MessageOptions builder */ public Builder messageRequest(MessageRequest messageRequest) { - this.input = messageRequest.getInput(); - this.intents = messageRequest.getIntents(); - this.entities = messageRequest.getEntities(); - this.alternateIntents = messageRequest.isAlternateIntents(); - this.context = messageRequest.getContext(); - this.output = messageRequest.getOutput(); + this.input = messageRequest.input(); + this.intents = messageRequest.intents(); + this.entities = messageRequest.entities(); + this.alternateIntents = messageRequest.alternateIntents(); + this.context = messageRequest.context(); + this.output = messageRequest.output(); return this; } } private MessageOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; input = builder.input; intents = builder.intents; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageRequest.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageRequest.java index f17d2207a76..9f9febbaabf 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageRequest.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -31,6 +32,191 @@ public class MessageRequest extends GenericModel { private OutputData output; private List actions; + /** + * Builder. + */ + public static class Builder { + private MessageInput input; + private List intents; + private List entities; + private Boolean alternateIntents; + private Context context; + private OutputData output; + private List actions; + + private Builder(MessageRequest messageRequest) { + this.input = messageRequest.input; + this.intents = messageRequest.intents; + this.entities = messageRequest.entities; + this.alternateIntents = messageRequest.alternateIntents; + this.context = messageRequest.context; + this.output = messageRequest.output; + this.actions = messageRequest.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MessageRequest. + * + * @return the messageRequest + */ + public MessageRequest build() { + return new MessageRequest(this); + } + + /** + * Adds an intent to intents. + * + * @param intent the new intent + * @return the MessageRequest builder + */ + public Builder addIntent(RuntimeIntent intent) { + com.ibm.cloud.sdk.core.util.Validator.notNull(intent, + "intent cannot be null"); + if (this.intents == null) { + this.intents = new ArrayList(); + } + this.intents.add(intent); + return this; + } + + /** + * Adds an entity to entities. + * + * @param entity the new entity + * @return the MessageRequest builder + */ + public Builder addEntity(RuntimeEntity entity) { + com.ibm.cloud.sdk.core.util.Validator.notNull(entity, + "entity cannot be null"); + if (this.entities == null) { + this.entities = new ArrayList(); + } + this.entities.add(entity); + return this; + } + + /** + * Adds an actions to actions. + * + * @param actions the new actions + * @return the MessageRequest builder + */ + public Builder addActions(DialogNodeAction actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the input. + * + * @param input the input + * @return the MessageRequest builder + */ + public Builder input(MessageInput input) { + this.input = input; + return this; + } + + /** + * Set the intents. + * Existing intents will be replaced. + * + * @param intents the intents + * @return the MessageRequest builder + */ + public Builder intents(List intents) { + this.intents = intents; + return this; + } + + /** + * Set the entities. + * Existing entities will be replaced. + * + * @param entities the entities + * @return the MessageRequest builder + */ + public Builder entities(List entities) { + this.entities = entities; + return this; + } + + /** + * Set the alternateIntents. + * + * @param alternateIntents the alternateIntents + * @return the MessageRequest builder + */ + public Builder alternateIntents(Boolean alternateIntents) { + this.alternateIntents = alternateIntents; + return this; + } + + /** + * Set the context. + * + * @param context the context + * @return the MessageRequest builder + */ + public Builder context(Context context) { + this.context = context; + return this; + } + + /** + * Set the output. + * + * @param output the output + * @return the MessageRequest builder + */ + public Builder output(OutputData output) { + this.output = output; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the MessageRequest builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + private MessageRequest(Builder builder) { + input = builder.input; + intents = builder.intents; + entities = builder.entities; + alternateIntents = builder.alternateIntents; + context = builder.context; + output = builder.output; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a MessageRequest builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the input. * @@ -38,7 +224,7 @@ public class MessageRequest extends GenericModel { * * @return the input */ - public MessageInput getInput() { + public MessageInput input() { return input; } @@ -50,7 +236,7 @@ public MessageInput getInput() { * * @return the intents */ - public List getIntents() { + public List intents() { return intents; } @@ -62,7 +248,7 @@ public List getIntents() { * * @return the entities */ - public List getEntities() { + public List entities() { return entities; } @@ -73,7 +259,7 @@ public List getEntities() { * * @return the alternateIntents */ - public Boolean isAlternateIntents() { + public Boolean alternateIntents() { return alternateIntents; } @@ -84,7 +270,7 @@ public Boolean isAlternateIntents() { * * @return the context */ - public Context getContext() { + public Context context() { return context; } @@ -96,7 +282,7 @@ public Context getContext() { * * @return the output */ - public OutputData getOutput() { + public OutputData output() { return output; } @@ -107,61 +293,7 @@ public OutputData getOutput() { * * @return the actions */ - public List getActions() { + public List actions() { return actions; } - - /** - * Sets the input. - * - * @param input the new input - */ - public void setInput(final MessageInput input) { - this.input = input; - } - - /** - * Sets the intents. - * - * @param intents the new intents - */ - public void setIntents(final List intents) { - this.intents = intents; - } - - /** - * Sets the entities. - * - * @param entities the new entities - */ - public void setEntities(final List entities) { - this.entities = entities; - } - - /** - * Sets the alternateIntents. - * - * @param alternateIntents the new alternateIntents - */ - public void setAlternateIntents(final Boolean alternateIntents) { - this.alternateIntents = alternateIntents; - } - - /** - * Sets the context. - * - * @param context the new context - */ - public void setContext(final Context context) { - this.context = context; - } - - /** - * Sets the output. - * - * @param output the new output - */ - public void setOutput(final OutputData output) { - this.output = output; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageResponse.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageResponse.java index d705b3f6204..d3b009205c8 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageResponse.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/MessageResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/OutputData.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/OutputData.java index 8a6323749c2..5d06d19a18b 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/OutputData.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/OutputData.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -23,22 +23,65 @@ * log. */ public class OutputData extends DynamicModel { + @SerializedName("nodes_visited") + private List nodesVisited; + @SerializedName("nodes_visited_details") + private List nodesVisitedDetails; @SerializedName("log_messages") private List logMessages; @SerializedName("text") private List text; @SerializedName("generic") - private List generic; - @SerializedName("nodes_visited") - private List nodesVisited; - @SerializedName("nodes_visited_details") - private List nodesVisitedDetails; + private List generic; public OutputData() { super(new TypeToken() { }); } + /** + * Gets the nodesVisited. + * + * An array of the nodes that were triggered to create the response, in the order in which they were visited. This + * information is useful for debugging and for tracing the path taken through the node tree. + * + * @return the nodesVisited + */ + public List getNodesVisited() { + return this.nodesVisited; + } + + /** + * Sets the nodesVisited. + * + * @param nodesVisited the new nodesVisited + */ + public void setNodesVisited(final List nodesVisited) { + this.nodesVisited = nodesVisited; + } + + /** + * Gets the nodesVisitedDetails. + * + * An array of objects containing detailed diagnostic information about the nodes that were triggered during + * processing of the input message. Included only if **nodes_visited_details** is set to `true` in the message + * request. + * + * @return the nodesVisitedDetails + */ + public List getNodesVisitedDetails() { + return this.nodesVisitedDetails; + } + + /** + * Sets the nodesVisitedDetails. + * + * @param nodesVisitedDetails the new nodesVisitedDetails + */ + public void setNodesVisitedDetails(final List nodesVisitedDetails) { + this.nodesVisitedDetails = nodesVisitedDetails; + } + /** * Gets the logMessages. * @@ -87,7 +130,7 @@ public void setText(final List text) { * * @return the generic */ - public List getGeneric() { + public List getGeneric() { return this.generic; } @@ -96,50 +139,7 @@ public List getGeneric() { * * @param generic the new generic */ - public void setGeneric(final List generic) { + public void setGeneric(final List generic) { this.generic = generic; } - - /** - * Gets the nodesVisited. - * - * An array of the nodes that were triggered to create the response, in the order in which they were visited. This - * information is useful for debugging and for tracing the path taken through the node tree. - * - * @return the nodesVisited - */ - public List getNodesVisited() { - return this.nodesVisited; - } - - /** - * Sets the nodesVisited. - * - * @param nodesVisited the new nodesVisited - */ - public void setNodesVisited(final List nodesVisited) { - this.nodesVisited = nodesVisited; - } - - /** - * Gets the nodesVisitedDetails. - * - * An array of objects containing detailed diagnostic information about the nodes that were triggered during - * processing of the input message. Included only if **nodes_visited_details** is set to `true` in the message - * request. - * - * @return the nodesVisitedDetails - */ - public List getNodesVisitedDetails() { - return this.nodesVisitedDetails; - } - - /** - * Sets the nodesVisitedDetails. - * - * @param nodesVisitedDetails the new nodesVisitedDetails - */ - public void setNodesVisitedDetails(final List nodesVisitedDetails) { - this.nodesVisitedDetails = nodesVisitedDetails; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Pagination.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Pagination.java index 3f9eefc7f26..37d6ad8e2ff 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Pagination.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Pagination.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeEntity.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeEntity.java index 9c77531ef2f..9e5a6d291b3 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeEntity.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,53 +12,206 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.ArrayList; import java.util.List; import java.util.Map; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.ibm.cloud.sdk.core.service.model.DynamicModel; +import com.ibm.cloud.sdk.core.service.model.GenericModel; /** * A term from the request that was identified as an entity. */ -public class RuntimeEntity extends DynamicModel { - @SerializedName("entity") +public class RuntimeEntity extends GenericModel { + private String entity; - @SerializedName("location") private List location; - @SerializedName("value") private String value; - @SerializedName("confidence") private Double confidence; - @SerializedName("metadata") - private Map metadata; - @SerializedName("groups") + private Map metadata; private List groups; - public RuntimeEntity() { - super(new TypeToken() { - }); + /** + * Builder. + */ + public static class Builder { + private String entity; + private List location; + private String value; + private Double confidence; + private Map metadata; + private List groups; + + private Builder(RuntimeEntity runtimeEntity) { + this.entity = runtimeEntity.entity; + this.location = runtimeEntity.location; + this.value = runtimeEntity.value; + this.confidence = runtimeEntity.confidence; + this.metadata = runtimeEntity.metadata; + this.groups = runtimeEntity.groups; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param entity the entity + * @param location the location + * @param value the value + */ + public Builder(String entity, List location, String value) { + this.entity = entity; + this.location = location; + this.value = value; + } + + /** + * Builds a RuntimeEntity. + * + * @return the runtimeEntity + */ + public RuntimeEntity build() { + return new RuntimeEntity(this); + } + + /** + * Adds an location to location. + * + * @param location the new location + * @return the RuntimeEntity builder + */ + public Builder addLocation(Long location) { + com.ibm.cloud.sdk.core.util.Validator.notNull(location, + "location cannot be null"); + if (this.location == null) { + this.location = new ArrayList(); + } + this.location.add(location); + return this; + } + + /** + * Adds an groups to groups. + * + * @param groups the new groups + * @return the RuntimeEntity builder + */ + public Builder addGroups(CaptureGroup groups) { + com.ibm.cloud.sdk.core.util.Validator.notNull(groups, + "groups cannot be null"); + if (this.groups == null) { + this.groups = new ArrayList(); + } + this.groups.add(groups); + return this; + } + + /** + * Set the entity. + * + * @param entity the entity + * @return the RuntimeEntity builder + */ + public Builder entity(String entity) { + this.entity = entity; + return this; + } + + /** + * Set the location. + * Existing location will be replaced. + * + * @param location the location + * @return the RuntimeEntity builder + */ + public Builder location(List location) { + this.location = location; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuntimeEntity builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the confidence. + * + * @param confidence the confidence + * @return the RuntimeEntity builder + */ + public Builder confidence(Double confidence) { + this.confidence = confidence; + return this; + } + + /** + * Set the metadata. + * + * @param metadata the metadata + * @return the RuntimeEntity builder + */ + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Set the groups. + * Existing groups will be replaced. + * + * @param groups the groups + * @return the RuntimeEntity builder + */ + public Builder groups(List groups) { + this.groups = groups; + return this; + } + } + + private RuntimeEntity(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.entity, + "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.location, + "location cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + entity = builder.entity; + location = builder.location; + value = builder.value; + confidence = builder.confidence; + metadata = builder.metadata; + groups = builder.groups; } /** - * Gets the entity. - * - * An entity detected in the input. + * New builder. * - * @return the entity + * @return a RuntimeEntity builder */ - public String getEntity() { - return this.entity; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the entity. + * Gets the entity. * - * @param entity the new entity + * An entity detected in the input. + * + * @return the entity */ - public void setEntity(final String entity) { - this.entity = entity; + public String entity() { + return entity; } /** @@ -69,17 +222,8 @@ public void setEntity(final String entity) { * * @return the location */ - public List getLocation() { - return this.location; - } - - /** - * Sets the location. - * - * @param location the new location - */ - public void setLocation(final List location) { - this.location = location; + public List location() { + return location; } /** @@ -89,17 +233,8 @@ public void setLocation(final List location) { * * @return the value */ - public String getValue() { - return this.value; - } - - /** - * Sets the value. - * - * @param value the new value - */ - public void setValue(final String value) { - this.value = value; + public String value() { + return value; } /** @@ -109,17 +244,8 @@ public void setValue(final String value) { * * @return the confidence */ - public Double getConfidence() { - return this.confidence; - } - - /** - * Sets the confidence. - * - * @param confidence the new confidence - */ - public void setConfidence(final Double confidence) { - this.confidence = confidence; + public Double confidence() { + return confidence; } /** @@ -129,17 +255,8 @@ public void setConfidence(final Double confidence) { * * @return the metadata */ - public Map getMetadata() { - return this.metadata; - } - - /** - * Sets the metadata. - * - * @param metadata the new metadata - */ - public void setMetadata(final Map metadata) { - this.metadata = metadata; + public Map metadata() { + return metadata; } /** @@ -149,16 +266,7 @@ public void setMetadata(final Map metadata) { * * @return the groups */ - public List getGroups() { - return this.groups; - } - - /** - * Sets the groups. - * - * @param groups the new groups - */ - public void setGroups(final List groups) { - this.groups = groups; + public List groups() { + return groups; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeIntent.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeIntent.java index ac706f0af79..09239105c6d 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeIntent.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeIntent.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,42 +12,104 @@ */ package com.ibm.watson.assistant.v1.model; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.ibm.cloud.sdk.core.service.model.DynamicModel; +import com.ibm.cloud.sdk.core.service.model.GenericModel; /** * An intent identified in the user input. */ -public class RuntimeIntent extends DynamicModel { - @SerializedName("intent") +public class RuntimeIntent extends GenericModel { + private String intent; - @SerializedName("confidence") private Double confidence; - public RuntimeIntent() { - super(new TypeToken() { - }); + /** + * Builder. + */ + public static class Builder { + private String intent; + private Double confidence; + + private Builder(RuntimeIntent runtimeIntent) { + this.intent = runtimeIntent.intent; + this.confidence = runtimeIntent.confidence; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param intent the intent + * @param confidence the confidence + */ + public Builder(String intent, Double confidence) { + this.intent = intent; + this.confidence = confidence; + } + + /** + * Builds a RuntimeIntent. + * + * @return the runtimeIntent + */ + public RuntimeIntent build() { + return new RuntimeIntent(this); + } + + /** + * Set the intent. + * + * @param intent the intent + * @return the RuntimeIntent builder + */ + public Builder intent(String intent) { + this.intent = intent; + return this; + } + + /** + * Set the confidence. + * + * @param confidence the confidence + * @return the RuntimeIntent builder + */ + public Builder confidence(Double confidence) { + this.confidence = confidence; + return this; + } + } + + private RuntimeIntent(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.intent, + "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.confidence, + "confidence cannot be null"); + intent = builder.intent; + confidence = builder.confidence; } /** - * Gets the intent. + * New builder. * - * The name of the recognized intent. - * - * @return the intent + * @return a RuntimeIntent builder */ - public String getIntent() { - return this.intent; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the intent. + * Gets the intent. + * + * The name of the recognized intent. * - * @param intent the new intent + * @return the intent */ - public void setIntent(final String intent) { - this.intent = intent; + public String intent() { + return intent; } /** @@ -57,16 +119,7 @@ public void setIntent(final String intent) { * * @return the confidence */ - public Double getConfidence() { - return this.confidence; - } - - /** - * Sets the confidence. - * - * @param confidence the new confidence - */ - public void setConfidence(final Double confidence) { - this.confidence = confidence; + public Double confidence() { + return confidence; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java new file mode 100644 index 00000000000..a3a029109db --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java @@ -0,0 +1,488 @@ +/* + * (C) Copyright IBM Corp. 2019. + * + * 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. + */ +package com.ibm.watson.assistant.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * RuntimeResponseGeneric. + */ +public class RuntimeResponseGeneric extends GenericModel { + + /** + * The type of response returned by the dialog node. The specified response type must be supported by the client + * application or channel. + * + * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for Plus + * and Premium users. + */ + public interface ResponseType { + /** text. */ + String TEXT = "text"; + /** pause. */ + String PAUSE = "pause"; + /** image. */ + String IMAGE = "image"; + /** option. */ + String OPTION = "option"; + /** connect_to_agent. */ + String CONNECT_TO_AGENT = "connect_to_agent"; + /** suggestion. */ + String SUGGESTION = "suggestion"; + } + + /** + * The preferred type of control to display. + */ + public interface Preference { + /** dropdown. */ + String DROPDOWN = "dropdown"; + /** button. */ + String BUTTON = "button"; + } + + @SerializedName("response_type") + private String responseType; + private String text; + private Long time; + private Boolean typing; + private String source; + private String title; + private String description; + private String preference; + private List options; + @SerializedName("message_to_human_agent") + private String messageToHumanAgent; + private String topic; + @SerializedName("dialog_node") + private String dialogNode; + private List suggestions; + + /** + * Builder. + */ + public static class Builder { + private String responseType; + private String text; + private Long time; + private Boolean typing; + private String source; + private String title; + private String description; + private String preference; + private List options; + private String messageToHumanAgent; + private String topic; + private String dialogNode; + private List suggestions; + + private Builder(RuntimeResponseGeneric runtimeResponseGeneric) { + this.responseType = runtimeResponseGeneric.responseType; + this.text = runtimeResponseGeneric.text; + this.time = runtimeResponseGeneric.time; + this.typing = runtimeResponseGeneric.typing; + this.source = runtimeResponseGeneric.source; + this.title = runtimeResponseGeneric.title; + this.description = runtimeResponseGeneric.description; + this.preference = runtimeResponseGeneric.preference; + this.options = runtimeResponseGeneric.options; + this.messageToHumanAgent = runtimeResponseGeneric.messageToHumanAgent; + this.topic = runtimeResponseGeneric.topic; + this.dialogNode = runtimeResponseGeneric.dialogNode; + this.suggestions = runtimeResponseGeneric.suggestions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param responseType the responseType + */ + public Builder(String responseType) { + this.responseType = responseType; + } + + /** + * Builds a RuntimeResponseGeneric. + * + * @return the runtimeResponseGeneric + */ + public RuntimeResponseGeneric build() { + return new RuntimeResponseGeneric(this); + } + + /** + * Adds an options to options. + * + * @param options the new options + * @return the RuntimeResponseGeneric builder + */ + public Builder addOptions(DialogNodeOutputOptionsElement options) { + com.ibm.cloud.sdk.core.util.Validator.notNull(options, + "options cannot be null"); + if (this.options == null) { + this.options = new ArrayList(); + } + this.options.add(options); + return this; + } + + /** + * Adds an suggestions to suggestions. + * + * @param suggestions the new suggestions + * @return the RuntimeResponseGeneric builder + */ + public Builder addSuggestions(DialogSuggestion suggestions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(suggestions, + "suggestions cannot be null"); + if (this.suggestions == null) { + this.suggestions = new ArrayList(); + } + this.suggestions.add(suggestions); + return this; + } + + /** + * Set the responseType. + * + * @param responseType the responseType + * @return the RuntimeResponseGeneric builder + */ + public Builder responseType(String responseType) { + this.responseType = responseType; + return this; + } + + /** + * Set the text. + * + * @param text the text + * @return the RuntimeResponseGeneric builder + */ + public Builder text(String text) { + this.text = text; + return this; + } + + /** + * Set the time. + * + * @param time the time + * @return the RuntimeResponseGeneric builder + */ + public Builder time(long time) { + this.time = time; + return this; + } + + /** + * Set the typing. + * + * @param typing the typing + * @return the RuntimeResponseGeneric builder + */ + public Builder typing(Boolean typing) { + this.typing = typing; + return this; + } + + /** + * Set the source. + * + * @param source the source + * @return the RuntimeResponseGeneric builder + */ + public Builder source(String source) { + this.source = source; + return this; + } + + /** + * Set the title. + * + * @param title the title + * @return the RuntimeResponseGeneric builder + */ + public Builder title(String title) { + this.title = title; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RuntimeResponseGeneric builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the preference. + * + * @param preference the preference + * @return the RuntimeResponseGeneric builder + */ + public Builder preference(String preference) { + this.preference = preference; + return this; + } + + /** + * Set the options. + * Existing options will be replaced. + * + * @param options the options + * @return the RuntimeResponseGeneric builder + */ + public Builder options(List options) { + this.options = options; + return this; + } + + /** + * Set the messageToHumanAgent. + * + * @param messageToHumanAgent the messageToHumanAgent + * @return the RuntimeResponseGeneric builder + */ + public Builder messageToHumanAgent(String messageToHumanAgent) { + this.messageToHumanAgent = messageToHumanAgent; + return this; + } + + /** + * Set the topic. + * + * @param topic the topic + * @return the RuntimeResponseGeneric builder + */ + public Builder topic(String topic) { + this.topic = topic; + return this; + } + + /** + * Set the dialogNode. + * + * @param dialogNode the dialogNode + * @return the RuntimeResponseGeneric builder + */ + public Builder dialogNode(String dialogNode) { + this.dialogNode = dialogNode; + return this; + } + + /** + * Set the suggestions. + * Existing suggestions will be replaced. + * + * @param suggestions the suggestions + * @return the RuntimeResponseGeneric builder + */ + public Builder suggestions(List suggestions) { + this.suggestions = suggestions; + return this; + } + } + + private RuntimeResponseGeneric(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.responseType, + "responseType cannot be null"); + responseType = builder.responseType; + text = builder.text; + time = builder.time; + typing = builder.typing; + source = builder.source; + title = builder.title; + description = builder.description; + preference = builder.preference; + options = builder.options; + messageToHumanAgent = builder.messageToHumanAgent; + topic = builder.topic; + dialogNode = builder.dialogNode; + suggestions = builder.suggestions; + } + + /** + * New builder. + * + * @return a RuntimeResponseGeneric builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the responseType. + * + * The type of response returned by the dialog node. The specified response type must be supported by the client + * application or channel. + * + * **Note:** The **suggestion** response type is part of the disambiguation feature, which is only available for Plus + * and Premium users. + * + * @return the responseType + */ + public String responseType() { + return responseType; + } + + /** + * Gets the text. + * + * The text of the response. + * + * @return the text + */ + public String text() { + return text; + } + + /** + * Gets the time. + * + * How long to pause, in milliseconds. + * + * @return the time + */ + public Long time() { + return time; + } + + /** + * Gets the typing. + * + * Whether to send a "user is typing" event during the pause. + * + * @return the typing + */ + public Boolean typing() { + return typing; + } + + /** + * Gets the source. + * + * The URL of the image. + * + * @return the source + */ + public String source() { + return source; + } + + /** + * Gets the title. + * + * The title or introductory text to show before the response. + * + * @return the title + */ + public String title() { + return title; + } + + /** + * Gets the description. + * + * The description to show with the the response. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the preference. + * + * The preferred type of control to display. + * + * @return the preference + */ + public String preference() { + return preference; + } + + /** + * Gets the options. + * + * An array of objects describing the options from which the user can choose. + * + * @return the options + */ + public List options() { + return options; + } + + /** + * Gets the messageToHumanAgent. + * + * A message to be sent to the human agent who will be taking over the conversation. + * + * @return the messageToHumanAgent + */ + public String messageToHumanAgent() { + return messageToHumanAgent; + } + + /** + * Gets the topic. + * + * A label identifying the topic of the conversation, derived from the **user_label** property of the relevant node. + * + * @return the topic + */ + public String topic() { + return topic; + } + + /** + * Gets the dialogNode. + * + * The ID of the dialog node that the **topic** property is taken from. The **topic** property is populated using the + * value of the dialog node's **user_label** property. + * + * @return the dialogNode + */ + public String dialogNode() { + return dialogNode; + } + + /** + * Gets the suggestions. + * + * An array of objects describing the possible matching dialog nodes from which the user can choose. + * + * **Note:** The **suggestions** property is part of the disambiguation feature, which is only available for Premium + * users. + * + * @return the suggestions + */ + public List suggestions() { + return suggestions; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Synonym.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Synonym.java index 30d4dd5ad41..53952313cdc 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Synonym.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Synonym.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -15,7 +15,6 @@ import java.util.Date; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * Synonym. @@ -99,7 +98,8 @@ public Builder updated(Date updated) { } private Synonym(Builder builder) { - Validator.notNull(builder.synonym, "synonym cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.synonym, + "synonym cannot be null"); synonym = builder.synonym; created = builder.created; updated = builder.updated; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SynonymCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SynonymCollection.java index 34e62d6a49c..5c43037e2ba 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SynonymCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SynonymCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java index a265a7fef74..9edc0346413 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1.model; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateCounterexampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateCounterexampleOptions.java index d588d75eb38..7b332b10c42 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateCounterexampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateCounterexampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateCounterexample options. @@ -99,8 +98,10 @@ public Builder newText(String newText) { } private UpdateCounterexampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.text, "text cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.text, + "text cannot be empty"); workspaceId = builder.workspaceId; text = builder.text; newText = builder.newText; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java index 04cfa1cce16..97244b6b312 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateDialogNode options. @@ -27,7 +26,7 @@ public class UpdateDialogNodeOptions extends GenericModel { /** * How the dialog node is processed. */ - public interface NodeType { + public interface NewType { /** standard. */ String STANDARD = "standard"; /** event_handler. */ @@ -114,7 +113,7 @@ public interface NewDigressOutSlots { private Map newMetadata; private DialogNodeNextStep newNextStep; private String newTitle; - private String nodeType; + private String newType; private String newEventName; private String newVariable; private List newActions; @@ -139,7 +138,7 @@ public static class Builder { private Map newMetadata; private DialogNodeNextStep newNextStep; private String newTitle; - private String nodeType; + private String newType; private String newEventName; private String newVariable; private List newActions; @@ -161,7 +160,7 @@ private Builder(UpdateDialogNodeOptions updateDialogNodeOptions) { this.newMetadata = updateDialogNodeOptions.newMetadata; this.newNextStep = updateDialogNodeOptions.newNextStep; this.newTitle = updateDialogNodeOptions.newTitle; - this.nodeType = updateDialogNodeOptions.nodeType; + this.newType = updateDialogNodeOptions.newType; this.newEventName = updateDialogNodeOptions.newEventName; this.newVariable = updateDialogNodeOptions.newVariable; this.newActions = updateDialogNodeOptions.newActions; @@ -204,7 +203,8 @@ public UpdateDialogNodeOptions build() { * @return the UpdateDialogNodeOptions builder */ public Builder addNewActions(DialogNodeAction newActions) { - Validator.notNull(newActions, "newActions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(newActions, + "newActions cannot be null"); if (this.newActions == null) { this.newActions = new ArrayList(); } @@ -345,13 +345,13 @@ public Builder newTitle(String newTitle) { } /** - * Set the nodeType. + * Set the newType. * - * @param nodeType the nodeType + * @param newType the newType * @return the UpdateDialogNodeOptions builder */ - public Builder nodeType(String nodeType) { - this.nodeType = nodeType; + public Builder newType(String newType) { + this.newType = newType; return this; } @@ -435,8 +435,10 @@ public Builder newUserLabel(String newUserLabel) { } private UpdateDialogNodeOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.dialogNode, "dialogNode cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.dialogNode, + "dialogNode cannot be empty"); workspaceId = builder.workspaceId; dialogNode = builder.dialogNode; newDialogNode = builder.newDialogNode; @@ -449,7 +451,7 @@ private UpdateDialogNodeOptions(Builder builder) { newMetadata = builder.newMetadata; newNextStep = builder.newNextStep; newTitle = builder.newTitle; - nodeType = builder.nodeType; + newType = builder.newType; newEventName = builder.newEventName; newVariable = builder.newVariable; newActions = builder.newActions; @@ -551,8 +553,7 @@ public String newPreviousSibling() { * Gets the newOutput. * * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). * * @return the newOutput */ @@ -606,14 +607,14 @@ public String newTitle() { } /** - * Gets the nodeType. + * Gets the newType. * * How the dialog node is processed. * - * @return the nodeType + * @return the newType */ - public String nodeType() { - return nodeType; + public String newType() { + return newType; } /** diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateEntityOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateEntityOptions.java index 52f40e38806..f0042026cdf 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateEntityOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateEntityOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateEntity options. @@ -87,7 +86,8 @@ public UpdateEntityOptions build() { * @return the UpdateEntityOptions builder */ public Builder addValue(CreateValue value) { - Validator.notNull(value, "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(value, + "value cannot be null"); if (this.newValues == null) { this.newValues = new ArrayList(); } @@ -175,8 +175,10 @@ public Builder newValues(List newValues) { } private UpdateEntityOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; newEntity = builder.newEntity; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateExampleOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateExampleOptions.java index cf97cbce991..424a000b8de 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateExampleOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateExampleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateExample options. @@ -82,7 +81,8 @@ public UpdateExampleOptions build() { * @return the UpdateExampleOptions builder */ public Builder addNewMentions(Mention newMentions) { - Validator.notNull(newMentions, "newMentions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(newMentions, + "newMentions cannot be null"); if (this.newMentions == null) { this.newMentions = new ArrayList(); } @@ -148,9 +148,12 @@ public Builder newMentions(List newMentions) { } private UpdateExampleOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); - Validator.notEmpty(builder.text, "text cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.text, + "text cannot be empty"); workspaceId = builder.workspaceId; intent = builder.intent; text = builder.text; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateIntentOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateIntentOptions.java index 161d9ed6209..a531a561c1d 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateIntentOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateIntentOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -16,7 +16,6 @@ import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateIntent options. @@ -80,7 +79,8 @@ public UpdateIntentOptions build() { * @return the UpdateIntentOptions builder */ public Builder addExample(Example example) { - Validator.notNull(example, "example cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(example, + "example cannot be null"); if (this.newExamples == null) { this.newExamples = new ArrayList(); } @@ -146,8 +146,10 @@ public Builder newExamples(List newExamples) { } private UpdateIntentOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.intent, "intent cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.intent, + "intent cannot be empty"); workspaceId = builder.workspaceId; intent = builder.intent; newIntent = builder.newIntent; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateSynonymOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateSynonymOptions.java index 4d633fc694b..dde41a03d24 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateSynonymOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateSynonymOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -13,7 +13,6 @@ package com.ibm.watson.assistant.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateSynonym options. @@ -131,10 +130,14 @@ public Builder newSynonym(String newSynonym) { } private UpdateSynonymOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); - Validator.notEmpty(builder.synonym, "synonym cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.synonym, + "synonym cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java index 9e894d97fc5..39fca761963 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateValue options. @@ -27,7 +26,7 @@ public class UpdateValueOptions extends GenericModel { /** * Specifies the type of entity value. */ - public interface ValueType { + public interface NewType { /** synonyms. */ String SYNONYMS = "synonyms"; /** patterns. */ @@ -39,7 +38,7 @@ public interface ValueType { private String value; private String newValue; private Map newMetadata; - private String valueType; + private String newType; private List newSynonyms; private List newPatterns; @@ -52,7 +51,7 @@ public static class Builder { private String value; private String newValue; private Map newMetadata; - private String valueType; + private String newType; private List newSynonyms; private List newPatterns; @@ -62,7 +61,7 @@ private Builder(UpdateValueOptions updateValueOptions) { this.value = updateValueOptions.value; this.newValue = updateValueOptions.newValue; this.newMetadata = updateValueOptions.newMetadata; - this.valueType = updateValueOptions.valueType; + this.newType = updateValueOptions.newType; this.newSynonyms = updateValueOptions.newSynonyms; this.newPatterns = updateValueOptions.newPatterns; } @@ -102,7 +101,8 @@ public UpdateValueOptions build() { * @return the UpdateValueOptions builder */ public Builder addSynonym(String synonym) { - Validator.notNull(synonym, "synonym cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(synonym, + "synonym cannot be null"); if (this.newSynonyms == null) { this.newSynonyms = new ArrayList(); } @@ -117,7 +117,8 @@ public Builder addSynonym(String synonym) { * @return the UpdateValueOptions builder */ public Builder addPattern(String pattern) { - Validator.notNull(pattern, "pattern cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(pattern, + "pattern cannot be null"); if (this.newPatterns == null) { this.newPatterns = new ArrayList(); } @@ -181,13 +182,13 @@ public Builder newMetadata(Map newMetadata) { } /** - * Set the valueType. + * Set the newType. * - * @param valueType the valueType + * @param newType the newType * @return the UpdateValueOptions builder */ - public Builder valueType(String valueType) { - this.valueType = valueType; + public Builder newType(String newType) { + this.newType = newType; return this; } @@ -217,15 +218,18 @@ public Builder newPatterns(List newPatterns) { } private UpdateValueOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); - Validator.notEmpty(builder.entity, "entity cannot be empty"); - Validator.notEmpty(builder.value, "value cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.entity, + "entity cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.value, + "value cannot be empty"); workspaceId = builder.workspaceId; entity = builder.entity; value = builder.value; newValue = builder.newValue; newMetadata = builder.newMetadata; - valueType = builder.valueType; + newType = builder.newType; newSynonyms = builder.newSynonyms; newPatterns = builder.newPatterns; } @@ -297,14 +301,14 @@ public Map newMetadata() { } /** - * Gets the valueType. + * Gets the newType. * * Specifies the type of entity value. * - * @return the valueType + * @return the newType */ - public String valueType() { - return valueType; + public String newType() { + return newType; } /** @@ -327,8 +331,7 @@ public List newSynonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the newPatterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateWorkspaceOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateWorkspaceOptions.java index 65effeb4e42..488d8921101 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateWorkspaceOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateWorkspaceOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,7 +17,6 @@ import java.util.Map; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * The updateWorkspace options. @@ -100,7 +99,8 @@ public UpdateWorkspaceOptions build() { * @return the UpdateWorkspaceOptions builder */ public Builder addIntent(CreateIntent intent) { - Validator.notNull(intent, "intent cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(intent, + "intent cannot be null"); if (this.intents == null) { this.intents = new ArrayList(); } @@ -115,7 +115,8 @@ public Builder addIntent(CreateIntent intent) { * @return the UpdateWorkspaceOptions builder */ public Builder addEntity(CreateEntity entity) { - Validator.notNull(entity, "entity cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(entity, + "entity cannot be null"); if (this.entities == null) { this.entities = new ArrayList(); } @@ -130,7 +131,8 @@ public Builder addEntity(CreateEntity entity) { * @return the UpdateWorkspaceOptions builder */ public Builder addDialogNode(DialogNode dialogNode) { - Validator.notNull(dialogNode, "dialogNode cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(dialogNode, + "dialogNode cannot be null"); if (this.dialogNodes == null) { this.dialogNodes = new ArrayList(); } @@ -145,7 +147,8 @@ public Builder addDialogNode(DialogNode dialogNode) { * @return the UpdateWorkspaceOptions builder */ public Builder addCounterexample(Counterexample counterexample) { - Validator.notNull(counterexample, "counterexample cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(counterexample, + "counterexample cannot be null"); if (this.counterexamples == null) { this.counterexamples = new ArrayList(); } @@ -291,7 +294,8 @@ public Builder append(Boolean append) { } private UpdateWorkspaceOptions(Builder builder) { - Validator.notEmpty(builder.workspaceId, "workspaceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.workspaceId, + "workspaceId cannot be empty"); workspaceId = builder.workspaceId; name = builder.name; description = builder.description; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java index e0313927abf..d4da9369e5f 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -17,9 +17,7 @@ import java.util.List; import java.util.Map; -import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.Validator; /** * Value. @@ -29,7 +27,7 @@ public class Value extends GenericModel { /** * Specifies the type of entity value. */ - public interface ValueType { + public interface Type { /** synonyms. */ String SYNONYMS = "synonyms"; /** patterns. */ @@ -37,9 +35,8 @@ public interface ValueType { } private String value; - private Map metadata; - @SerializedName("type") - private String valueType; + private Map metadata; + private String type; private List synonyms; private List patterns; private Date created; @@ -50,8 +47,8 @@ public interface ValueType { */ public static class Builder { private String value; - private Map metadata; - private String valueType; + private Map metadata; + private String type; private List synonyms; private List patterns; private Date created; @@ -60,7 +57,7 @@ public static class Builder { private Builder(Value value) { this.value = value.value; this.metadata = value.metadata; - this.valueType = value.valueType; + this.type = value.type; this.synonyms = value.synonyms; this.patterns = value.patterns; this.created = value.created; @@ -77,11 +74,11 @@ public Builder() { * Instantiates a new builder with required properties. * * @param value the value - * @param valueType the valueType + * @param type the type */ - public Builder(String value, String valueType) { + public Builder(String value, String type) { this.value = value; - this.valueType = valueType; + this.type = type; } /** @@ -100,7 +97,8 @@ public Value build() { * @return the Value builder */ public Builder addSynonym(String synonym) { - Validator.notNull(synonym, "synonym cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(synonym, + "synonym cannot be null"); if (this.synonyms == null) { this.synonyms = new ArrayList(); } @@ -115,7 +113,8 @@ public Builder addSynonym(String synonym) { * @return the Value builder */ public Builder addPattern(String pattern) { - Validator.notNull(pattern, "pattern cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(pattern, + "pattern cannot be null"); if (this.patterns == null) { this.patterns = new ArrayList(); } @@ -140,19 +139,19 @@ public Builder value(String value) { * @param metadata the metadata * @return the Value builder */ - public Builder metadata(Map metadata) { + public Builder metadata(Map metadata) { this.metadata = metadata; return this; } /** - * Set the valueType. + * Set the type. * - * @param valueType the valueType + * @param type the type * @return the Value builder */ - public Builder valueType(String valueType) { - this.valueType = valueType; + public Builder type(String type) { + this.type = type; return this; } @@ -204,11 +203,13 @@ public Builder updated(Date updated) { } private Value(Builder builder) { - Validator.notNull(builder.value, "value cannot be null"); - Validator.notNull(builder.valueType, "valueType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); value = builder.value; metadata = builder.metadata; - valueType = builder.valueType; + type = builder.type; synonyms = builder.synonyms; patterns = builder.patterns; created = builder.created; @@ -244,19 +245,19 @@ public String value() { * * @return the metadata */ - public Map metadata() { + public Map metadata() { return metadata; } /** - * Gets the valueType. + * Gets the type. * * Specifies the type of entity value. * - * @return the valueType + * @return the type */ - public String valueType() { - return valueType; + public String type() { + return type; } /** @@ -279,8 +280,7 @@ public List synonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation] - * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the patterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ValueCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ValueCollection.java index 599958c448a..b2c39fc0ab1 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ValueCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/ValueCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Workspace.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Workspace.java index 23a193eb14a..c59911b4f1c 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Workspace.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Workspace.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -43,7 +43,7 @@ public interface Status { private String name; private String description; private String language; - private Map metadata; + private Map metadata; @SerializedName("learning_opt_out") private Boolean learningOptOut; @SerializedName("system_settings") @@ -99,7 +99,7 @@ public String getLanguage() { * * @return the metadata */ - public Map getMetadata() { + public Map getMetadata() { return metadata; } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceCollection.java index 45a88263a4f..e5b4b0d5e94 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceCollection.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceCollection.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java index 478b700a565..be25743507a 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -12,11 +12,12 @@ */ package com.ibm.watson.assistant.v1.model; +import java.util.List; +import java.util.Map; + import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Map; - /** * Global settings for the workspace. */ @@ -25,7 +26,85 @@ public class WorkspaceSystemSettings extends GenericModel { private WorkspaceSystemSettingsTooling tooling; private WorkspaceSystemSettingsDisambiguation disambiguation; @SerializedName("human_agent_assist") - private Map humanAgentAssist; + private Map humanAgentAssist; + + /** + * Builder. + */ + public static class Builder { + private WorkspaceSystemSettingsTooling tooling; + private WorkspaceSystemSettingsDisambiguation disambiguation; + private Map humanAgentAssist; + + private Builder(WorkspaceSystemSettings workspaceSystemSettings) { + this.tooling = workspaceSystemSettings.tooling; + this.disambiguation = workspaceSystemSettings.disambiguation; + this.humanAgentAssist = workspaceSystemSettings.humanAgentAssist; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a WorkspaceSystemSettings. + * + * @return the workspaceSystemSettings + */ + public WorkspaceSystemSettings build() { + return new WorkspaceSystemSettings(this); + } + + /** + * Set the tooling. + * + * @param tooling the tooling + * @return the WorkspaceSystemSettings builder + */ + public Builder tooling(WorkspaceSystemSettingsTooling tooling) { + this.tooling = tooling; + return this; + } + + /** + * Set the disambiguation. + * + * @param disambiguation the disambiguation + * @return the WorkspaceSystemSettings builder + */ + public Builder disambiguation(WorkspaceSystemSettingsDisambiguation disambiguation) { + this.disambiguation = disambiguation; + return this; + } + + /** + * Set the humanAgentAssist. + * + * @param humanAgentAssist the humanAgentAssist + * @return the WorkspaceSystemSettings builder + */ + public Builder humanAgentAssist(Map humanAgentAssist) { + this.humanAgentAssist = humanAgentAssist; + return this; + } + } + + private WorkspaceSystemSettings(Builder builder) { + tooling = builder.tooling; + disambiguation = builder.disambiguation; + humanAgentAssist = builder.humanAgentAssist; + } + + /** + * New builder. + * + * @return a WorkspaceSystemSettings builder + */ + public Builder newBuilder() { + return new Builder(this); + } /** * Gets the tooling. @@ -34,7 +113,7 @@ public class WorkspaceSystemSettings extends GenericModel { * * @return the tooling */ - public WorkspaceSystemSettingsTooling getTooling() { + public WorkspaceSystemSettingsTooling tooling() { return tooling; } @@ -47,7 +126,7 @@ public WorkspaceSystemSettingsTooling getTooling() { * * @return the disambiguation */ - public WorkspaceSystemSettingsDisambiguation getDisambiguation() { + public WorkspaceSystemSettingsDisambiguation disambiguation() { return disambiguation; } @@ -58,34 +137,7 @@ public WorkspaceSystemSettingsDisambiguation getDisambiguation() { * * @return the humanAgentAssist */ - public Map getHumanAgentAssist() { + public Map humanAgentAssist() { return humanAgentAssist; } - - /** - * Sets the tooling. - * - * @param tooling the new tooling - */ - public void setTooling(final WorkspaceSystemSettingsTooling tooling) { - this.tooling = tooling; - } - - /** - * Sets the disambiguation. - * - * @param disambiguation the new disambiguation - */ - public void setDisambiguation(final WorkspaceSystemSettingsDisambiguation disambiguation) { - this.disambiguation = disambiguation; - } - - /** - * Sets the humanAgentAssist. - * - * @param humanAgentAssist the new humanAgentAssist - */ - public void setHumanAgentAssist(final Map humanAgentAssist) { - this.humanAgentAssist = humanAgentAssist; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java index c28530aef27..6821fafc0ab 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -39,6 +39,98 @@ public interface Sensitivity { private Boolean enabled; private String sensitivity; + /** + * Builder. + */ + public static class Builder { + private String prompt; + private String noneOfTheAbovePrompt; + private Boolean enabled; + private String sensitivity; + + private Builder(WorkspaceSystemSettingsDisambiguation workspaceSystemSettingsDisambiguation) { + this.prompt = workspaceSystemSettingsDisambiguation.prompt; + this.noneOfTheAbovePrompt = workspaceSystemSettingsDisambiguation.noneOfTheAbovePrompt; + this.enabled = workspaceSystemSettingsDisambiguation.enabled; + this.sensitivity = workspaceSystemSettingsDisambiguation.sensitivity; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a WorkspaceSystemSettingsDisambiguation. + * + * @return the workspaceSystemSettingsDisambiguation + */ + public WorkspaceSystemSettingsDisambiguation build() { + return new WorkspaceSystemSettingsDisambiguation(this); + } + + /** + * Set the prompt. + * + * @param prompt the prompt + * @return the WorkspaceSystemSettingsDisambiguation builder + */ + public Builder prompt(String prompt) { + this.prompt = prompt; + return this; + } + + /** + * Set the noneOfTheAbovePrompt. + * + * @param noneOfTheAbovePrompt the noneOfTheAbovePrompt + * @return the WorkspaceSystemSettingsDisambiguation builder + */ + public Builder noneOfTheAbovePrompt(String noneOfTheAbovePrompt) { + this.noneOfTheAbovePrompt = noneOfTheAbovePrompt; + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the WorkspaceSystemSettingsDisambiguation builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the sensitivity. + * + * @param sensitivity the sensitivity + * @return the WorkspaceSystemSettingsDisambiguation builder + */ + public Builder sensitivity(String sensitivity) { + this.sensitivity = sensitivity; + return this; + } + } + + private WorkspaceSystemSettingsDisambiguation(Builder builder) { + prompt = builder.prompt; + noneOfTheAbovePrompt = builder.noneOfTheAbovePrompt; + enabled = builder.enabled; + sensitivity = builder.sensitivity; + } + + /** + * New builder. + * + * @return a WorkspaceSystemSettingsDisambiguation builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the prompt. * @@ -46,7 +138,7 @@ public interface Sensitivity { * * @return the prompt */ - public String getPrompt() { + public String prompt() { return prompt; } @@ -58,7 +150,7 @@ public String getPrompt() { * * @return the noneOfTheAbovePrompt */ - public String getNoneOfTheAbovePrompt() { + public String noneOfTheAbovePrompt() { return noneOfTheAbovePrompt; } @@ -69,7 +161,7 @@ public String getNoneOfTheAbovePrompt() { * * @return the enabled */ - public Boolean isEnabled() { + public Boolean enabled() { return enabled; } @@ -81,43 +173,7 @@ public Boolean isEnabled() { * * @return the sensitivity */ - public String getSensitivity() { + public String sensitivity() { return sensitivity; } - - /** - * Sets the prompt. - * - * @param prompt the new prompt - */ - public void setPrompt(final String prompt) { - this.prompt = prompt; - } - - /** - * Sets the noneOfTheAbovePrompt. - * - * @param noneOfTheAbovePrompt the new noneOfTheAbovePrompt - */ - public void setNoneOfTheAbovePrompt(final String noneOfTheAbovePrompt) { - this.noneOfTheAbovePrompt = noneOfTheAbovePrompt; - } - - /** - * Sets the enabled. - * - * @param enabled the new enabled - */ - public void setEnabled(final Boolean enabled) { - this.enabled = enabled; - } - - /** - * Sets the sensitivity. - * - * @param sensitivity the new sensitivity - */ - public void setSensitivity(final String sensitivity) { - this.sensitivity = sensitivity; - } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsTooling.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsTooling.java index 0c957830a14..8a52449126f 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsTooling.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsTooling.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 @@ -24,22 +24,63 @@ public class WorkspaceSystemSettingsTooling extends GenericModel { private Boolean storeGenericResponses; /** - * Gets the storeGenericResponses. - * - * Whether the dialog JSON editor displays text responses within the `output.generic` object. + * Builder. + */ + public static class Builder { + private Boolean storeGenericResponses; + + private Builder(WorkspaceSystemSettingsTooling workspaceSystemSettingsTooling) { + this.storeGenericResponses = workspaceSystemSettingsTooling.storeGenericResponses; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a WorkspaceSystemSettingsTooling. + * + * @return the workspaceSystemSettingsTooling + */ + public WorkspaceSystemSettingsTooling build() { + return new WorkspaceSystemSettingsTooling(this); + } + + /** + * Set the storeGenericResponses. + * + * @param storeGenericResponses the storeGenericResponses + * @return the WorkspaceSystemSettingsTooling builder + */ + public Builder storeGenericResponses(Boolean storeGenericResponses) { + this.storeGenericResponses = storeGenericResponses; + return this; + } + } + + private WorkspaceSystemSettingsTooling(Builder builder) { + storeGenericResponses = builder.storeGenericResponses; + } + + /** + * New builder. * - * @return the storeGenericResponses + * @return a WorkspaceSystemSettingsTooling builder */ - public Boolean isStoreGenericResponses() { - return storeGenericResponses; + public Builder newBuilder() { + return new Builder(this); } /** - * Sets the storeGenericResponses. + * Gets the storeGenericResponses. + * + * Whether the dialog JSON editor displays text responses within the `output.generic` object. * - * @param storeGenericResponses the new storeGenericResponses + * @return the storeGenericResponses */ - public void setStoreGenericResponses(final Boolean storeGenericResponses) { - this.storeGenericResponses = storeGenericResponses; + public Boolean storeGenericResponses() { + return storeGenericResponses; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/package-info.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/package-info.java index ba445e7b9b9..12f9f08112a 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/package-info.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 IBM Corp. All Rights Reserved. + * (C) Copyright IBM Corp. 2019. * * 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 From 179ed46b369dfb003e56a43828f2ede99920cccc Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:38:39 -0400 Subject: [PATCH 04/28] test(Assistant): Update tests --- .../assistant/v1/AssistantServiceIT.java | 49 +-- .../assistant/v1/AssistantServiceTest.java | 9 +- .../watson/assistant/v1/AssistantTest.java | 307 ++++++++++-------- .../assistant/v2/AssistantServiceIT.java | 15 +- .../assistant/v2/AssistantServiceTest.java | 9 +- .../watson/assistant/v2/AssistantTest.java | 196 +++++------ 6 files changed, 310 insertions(+), 275 deletions(-) diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceIT.java b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceIT.java index cf54b104ca8..e2fda3d6189 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceIT.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceIT.java @@ -14,6 +14,7 @@ import com.ibm.cloud.sdk.core.http.Response; import com.ibm.cloud.sdk.core.http.ServiceCallback; +import com.ibm.cloud.sdk.core.security.BasicAuthenticator; import com.ibm.cloud.sdk.core.service.exception.NotFoundException; import com.ibm.cloud.sdk.core.service.exception.UnauthorizedException; import com.ibm.watson.assistant.v1.model.Context; @@ -166,7 +167,7 @@ public void accept(Response response) throws Exception { @Test(expected = UnauthorizedException.class) public void pingBadCredentialsThrowsException() { - Assistant badService = new Assistant("2018-02-16", "foo", "bar"); + Assistant badService = new Assistant("2018-02-16", new BasicAuthenticator("foo", "bar")); MessageOptions options = new MessageOptions.Builder(workspaceId).build(); badService.message(options).execute().getResult(); } @@ -200,9 +201,10 @@ public void testSendMessages() throws InterruptedException { .build(); if (message.equals("yes")) { - RuntimeIntent offTopic = new RuntimeIntent(); - offTopic.setIntent("off_topic"); - offTopic.setConfidence(1.0); + RuntimeIntent offTopic = new RuntimeIntent.Builder() + .intent("off_topic") + .confidence(1.0) + .build(); request = request.newBuilder().addIntent(offTopic).build(); } MessageResponse response = service.message(request).execute().getResult(); @@ -1102,16 +1104,19 @@ public void testCreateWorkspace() { workspaceCounterExamples.add(new Counterexample.Builder().text(counterExampleText).build()); // systemSettings - WorkspaceSystemSettingsDisambiguation disambiguation = new WorkspaceSystemSettingsDisambiguation(); - disambiguation.setEnabled(true); - disambiguation.setNoneOfTheAbovePrompt("none of the above"); - disambiguation.setPrompt("prompt"); - disambiguation.setSensitivity(WorkspaceSystemSettingsDisambiguation.Sensitivity.HIGH); - WorkspaceSystemSettingsTooling tooling = new WorkspaceSystemSettingsTooling(); - tooling.setStoreGenericResponses(true); - WorkspaceSystemSettings systemSettings = new WorkspaceSystemSettings(); - systemSettings.setDisambiguation(disambiguation); - systemSettings.setTooling(tooling); + WorkspaceSystemSettingsDisambiguation disambiguation = new WorkspaceSystemSettingsDisambiguation.Builder() + .enabled(true) + .noneOfTheAbovePrompt("none of the above") + .prompt("prompt") + .sensitivity(WorkspaceSystemSettingsDisambiguation.Sensitivity.HIGH) + .build(); + WorkspaceSystemSettingsTooling tooling = new WorkspaceSystemSettingsTooling.Builder() + .storeGenericResponses(true) + .build(); + WorkspaceSystemSettings systemSettings = new WorkspaceSystemSettings.Builder() + .disambiguation(disambiguation) + .tooling(tooling) + .build(); CreateWorkspaceOptions createOptions = new CreateWorkspaceOptions.Builder() .name(workspaceName) @@ -1183,14 +1188,14 @@ public void testCreateWorkspace() { // systemSettings assertNotNull(exResponse.getSystemSettings()); - assertEquals(exResponse.getSystemSettings().getDisambiguation().getNoneOfTheAbovePrompt(), - disambiguation.getNoneOfTheAbovePrompt()); - assertEquals(exResponse.getSystemSettings().getDisambiguation().getSensitivity(), - disambiguation.getSensitivity()); - assertEquals(exResponse.getSystemSettings().getDisambiguation().getPrompt(), disambiguation.getPrompt()); - assertEquals(exResponse.getSystemSettings().getDisambiguation().isEnabled(), disambiguation.isEnabled()); - assertEquals(exResponse.getSystemSettings().getTooling().isStoreGenericResponses(), - tooling.isStoreGenericResponses()); + assertEquals(exResponse.getSystemSettings().disambiguation().noneOfTheAbovePrompt(), + disambiguation.noneOfTheAbovePrompt()); + assertEquals(exResponse.getSystemSettings().disambiguation().sensitivity(), + disambiguation.sensitivity()); + assertEquals(exResponse.getSystemSettings().disambiguation().prompt(), disambiguation.prompt()); + assertEquals(exResponse.getSystemSettings().disambiguation().enabled(), disambiguation.enabled()); + assertEquals(exResponse.getSystemSettings().tooling().storeGenericResponses(), + tooling.storeGenericResponses()); } catch (Exception ex) { fail(ex.getMessage()); diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java index d44277a655f..5adf45b6291 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java @@ -12,7 +12,7 @@ */ package com.ibm.watson.assistant.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import org.junit.Assume; import org.junit.Before; @@ -45,12 +45,9 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new Assistant("2018-07-10"); + IamAuthenticator authenticator = new IamAuthenticator(apiKey); + service = new Assistant("2018-07-10", authenticator); service.setEndPoint(getProperty("assistant.url")); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); service.setDefaultHeaders(getDefaultHeaders()); } diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java index aba5eba8488..dc32a1714d5 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java @@ -13,7 +13,7 @@ package com.ibm.watson.assistant.v1; import com.ibm.cloud.sdk.core.http.HttpHeaders; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.assistant.v1.model.Context; import com.ibm.watson.assistant.v1.model.Counterexample; import com.ibm.watson.assistant.v1.model.CreateDialogNodeOptions; @@ -75,6 +75,18 @@ * Unit tests for the {@link Assistant}. */ public class AssistantTest extends WatsonServiceUnitTest { + private static final String INTENT = "turn_on"; + private static final Double CONFIDENCE = 0.0; + private static final String ENTITY = "genre"; + private static final String VALUE = "jazz"; + private static final String NONE_OF_THE_ABOVE_PROMPT = "none of the above"; + private static final String PROMPT = "prompt"; + private static final List LOCATION = Arrays.asList(1L, 2L); + private static final String TEXT = "text"; + private static final String NAME = "name"; + private static final String CREDENTIALS = "credentials"; + private static final String RESULT_VARIABLE = "result_variable"; + private Assistant service; private static final String FIXTURE = "src/test/resources/assistant/assistant.json"; private static final String WORKSPACE_ID = "123"; @@ -89,11 +101,7 @@ public class AssistantTest extends WatsonServiceUnitTest { @Before public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new Assistant("2018-07-10", authConfig); + service = new Assistant("2018-07-10", new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); } @@ -102,7 +110,7 @@ public void setUp() throws Exception { */ @Test(expected = IllegalArgumentException.class) public void testConstructorWithNullVersionDate() { - new Assistant(null); + new Assistant(null, new NoAuthAuthenticator()); } /** @@ -110,7 +118,7 @@ public void testConstructorWithNullVersionDate() { */ @Test(expected = IllegalArgumentException.class) public void testConstructorWithEmptyVersionDate() { - new Assistant(""); + new Assistant("", new NoAuthAuthenticator()); } /** @@ -154,12 +162,15 @@ public void testSendMessage() throws IOException, InterruptedException { MessageInput input = new MessageInput(); input.setText(text); - RuntimeIntent intent = new RuntimeIntent(); - intent.setIntent("turn_on"); - intent.setConfidence(0.0); - RuntimeEntity entity = new RuntimeEntity(); - entity.setEntity("genre"); - entity.setValue("jazz"); + RuntimeIntent intent = new RuntimeIntent.Builder() + .intent(INTENT) + .confidence(CONFIDENCE) + .build(); + RuntimeEntity entity = new RuntimeEntity.Builder() + .entity(ENTITY) + .value(VALUE) + .location(LOCATION) + .build(); MessageOptions options = new MessageOptions.Builder(WORKSPACE_ID) .input(input) .addIntent(intent) @@ -178,20 +189,19 @@ public void testSendMessage() throws IOException, InterruptedException { assertArrayEquals(new String[]{"Great choice! Playing some jazz for you."}, serviceResponse.getOutput().getText().toArray(new String[0])); assertEquals(request.getMethod(), "POST"); - assertNotNull(request.getHeader(HttpHeaders.AUTHORIZATION)); assertNotNull(serviceResponse.getActions()); - assertNotNull(serviceResponse.getActions().get(0).getName()); - assertNotNull(serviceResponse.getActions().get(0).getCredentials()); - assertNotNull(serviceResponse.getActions().get(0).getActionType()); - assertNotNull(serviceResponse.getActions().get(0).getParameters()); - assertNotNull(serviceResponse.getActions().get(0).getResultVariable()); + assertNotNull(serviceResponse.getActions().get(0).name()); + assertNotNull(serviceResponse.getActions().get(0).credentials()); + assertNotNull(serviceResponse.getActions().get(0).type()); + assertNotNull(serviceResponse.getActions().get(0).parameters()); + assertNotNull(serviceResponse.getActions().get(0).resultVariable()); assertNotNull(serviceResponse.getOutput().getLogMessages()); assertNotNull(serviceResponse.getOutput().getNodesVisited()); assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getDialogNode()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getTitle()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).dialogNode()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).title()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).conditions()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).conditions()); } /** @@ -205,7 +215,7 @@ public void testSendMessageWithAlternateIntents() throws IOException, Interrupte MessageResponse mockResponse = loadFixture(FIXTURE, MessageResponse.class); server.enqueue(jsonResponse(mockResponse)); - MessageContextMetadata metadata = new MessageContextMetadata(); + MessageContextMetadata metadata = new MessageContextMetadata.Builder().build(); Context contextTemp = new Context(); contextTemp.put("name", "Myname"); contextTemp.setMetadata(metadata); @@ -232,7 +242,6 @@ public void testSendMessageWithAlternateIntents() throws IOException, Interrupte assertArrayEquals(new String[] { "Great choice! Playing some jazz for you." }, serviceResponse.getOutput().getText().toArray(new String[0])); assertEquals(request.getMethod(), "POST"); - assertNotNull(request.getHeader(HttpHeaders.AUTHORIZATION)); } @Test @@ -244,29 +253,33 @@ public void testSendMessageWithMessageRequest() throws FileNotFoundException, In MessageInput input = new MessageInput(); input.setText(text); - RuntimeIntent intent = new RuntimeIntent(); - intent.setIntent("turn_on"); - intent.setConfidence(0.0); - RuntimeEntity entity = new RuntimeEntity(); - entity.setEntity("genre"); - entity.setValue("jazz"); + RuntimeIntent intent = new RuntimeIntent.Builder() + .intent(INTENT) + .confidence(CONFIDENCE) + .build(); + RuntimeEntity entity = new RuntimeEntity.Builder() + .entity(ENTITY) + .value(VALUE) + .location(LOCATION) + .build(); Context context = new Context(); OutputData outputData = new OutputData(); - MessageRequest messageRequest = new MessageRequest(); - messageRequest.setInput(input); - messageRequest.setIntents(Collections.singletonList(intent)); - messageRequest.setEntities(Collections.singletonList(entity)); - messageRequest.setAlternateIntents(true); - messageRequest.setContext(context); - messageRequest.setOutput(outputData); + MessageRequest messageRequest = new MessageRequest.Builder() + .input(input) + .intents(Collections.singletonList(intent)) + .entities(Collections.singletonList(entity)) + .alternateIntents(true) + .context(context) + .output(outputData) + .build(); - assertEquals(input, messageRequest.getInput()); - assertEquals(intent, messageRequest.getIntents().get(0)); - assertEquals(entity, messageRequest.getEntities().get(0)); - assertEquals(context, messageRequest.getContext()); - assertEquals(outputData, messageRequest.getOutput()); + assertEquals(input, messageRequest.input()); + assertEquals(intent, messageRequest.intents().get(0)); + assertEquals(entity, messageRequest.entities().get(0)); + assertEquals(context, messageRequest.context()); + assertEquals(outputData, messageRequest.output()); MessageOptions options = new MessageOptions.Builder() .workspaceId(WORKSPACE_ID) @@ -284,20 +297,19 @@ public void testSendMessageWithMessageRequest() throws FileNotFoundException, In assertArrayEquals(new String[]{"Great choice! Playing some jazz for you."}, serviceResponse.getOutput().getText().toArray(new String[0])); assertEquals(request.getMethod(), "POST"); - assertNotNull(request.getHeader(HttpHeaders.AUTHORIZATION)); assertNotNull(serviceResponse.getActions()); - assertNotNull(serviceResponse.getActions().get(0).getName()); - assertNotNull(serviceResponse.getActions().get(0).getCredentials()); - assertNotNull(serviceResponse.getActions().get(0).getActionType()); - assertNotNull(serviceResponse.getActions().get(0).getParameters()); - assertNotNull(serviceResponse.getActions().get(0).getResultVariable()); + assertNotNull(serviceResponse.getActions().get(0).name()); + assertNotNull(serviceResponse.getActions().get(0).credentials()); + assertNotNull(serviceResponse.getActions().get(0).type()); + assertNotNull(serviceResponse.getActions().get(0).parameters()); + assertNotNull(serviceResponse.getActions().get(0).resultVariable()); assertNotNull(serviceResponse.getOutput().getLogMessages()); assertNotNull(serviceResponse.getOutput().getNodesVisited()); assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getDialogNode()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getTitle()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); - assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).getConditions()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).dialogNode()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).title()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).conditions()); + assertNotNull(serviceResponse.getOutput().getNodesVisitedDetails().get(0).conditions()); } /** @@ -351,19 +363,22 @@ public void testCreateWorkspaceBuilder() { workspaceMetadata.put("key", metadataValue); // systemSettings - WorkspaceSystemSettingsDisambiguation disambiguation = new WorkspaceSystemSettingsDisambiguation(); - disambiguation.setEnabled(true); - disambiguation.setNoneOfTheAbovePrompt("none of the above"); - disambiguation.setPrompt("prompt"); - disambiguation.setSensitivity(WorkspaceSystemSettingsDisambiguation.Sensitivity.HIGH); - WorkspaceSystemSettingsTooling tooling = new WorkspaceSystemSettingsTooling(); - tooling.setStoreGenericResponses(true); + WorkspaceSystemSettingsDisambiguation disambiguation = new WorkspaceSystemSettingsDisambiguation.Builder() + .enabled(true) + .noneOfTheAbovePrompt(NONE_OF_THE_ABOVE_PROMPT) + .prompt(PROMPT) + .sensitivity(WorkspaceSystemSettingsDisambiguation.Sensitivity.HIGH) + .build(); + WorkspaceSystemSettingsTooling tooling = new WorkspaceSystemSettingsTooling.Builder() + .storeGenericResponses(true) + .build(); Map humanAgentAssist = new HashMap<>(); humanAgentAssist.put("help", "ok"); - WorkspaceSystemSettings systemSettings = new WorkspaceSystemSettings(); - systemSettings.setDisambiguation(disambiguation); - systemSettings.setTooling(tooling); - systemSettings.setHumanAgentAssist(humanAgentAssist); + WorkspaceSystemSettings systemSettings = new WorkspaceSystemSettings.Builder() + .disambiguation(disambiguation) + .tooling(tooling) + .humanAgentAssist(humanAgentAssist) + .build(); CreateWorkspaceOptions createOptions = new CreateWorkspaceOptions.Builder() .name(workspaceName) @@ -398,14 +413,14 @@ public void testCreateWorkspaceBuilder() { assertEquals(createOptions.dialogNodes().get(0).userLabel(), userLabel); assertEquals(createOptions.dialogNodes().get(1), testDialogNode1); assertNotNull(createOptions.systemSettings()); - assertEquals(createOptions.systemSettings().getDisambiguation().getNoneOfTheAbovePrompt(), - disambiguation.getNoneOfTheAbovePrompt()); - assertEquals(createOptions.systemSettings().getDisambiguation().getPrompt(), disambiguation.getPrompt()); - assertEquals(createOptions.systemSettings().getDisambiguation().getSensitivity(), disambiguation.getSensitivity()); - assertEquals(createOptions.systemSettings().getDisambiguation().isEnabled(), disambiguation.isEnabled()); - assertEquals(createOptions.systemSettings().getTooling().isStoreGenericResponses(), - tooling.isStoreGenericResponses()); - assertEquals(createOptions.systemSettings().getHumanAgentAssist(), humanAgentAssist); + assertEquals(createOptions.systemSettings().disambiguation().noneOfTheAbovePrompt(), + disambiguation.noneOfTheAbovePrompt()); + assertEquals(createOptions.systemSettings().disambiguation().prompt(), disambiguation.prompt()); + assertEquals(createOptions.systemSettings().disambiguation().sensitivity(), disambiguation.sensitivity()); + assertEquals(createOptions.systemSettings().disambiguation().enabled(), disambiguation.enabled()); + assertEquals(createOptions.systemSettings().tooling().storeGenericResponses(), + tooling.storeGenericResponses()); + assertEquals(createOptions.systemSettings().humanAgentAssist(), humanAgentAssist); CreateWorkspaceOptions.Builder builder = createOptions.newBuilder(); @@ -463,19 +478,22 @@ public void testUpdateWorkspaceOptionsBuilder() { workspaceMetadata.put("key", metadataValue); // systemSettings - WorkspaceSystemSettingsDisambiguation disambiguation = new WorkspaceSystemSettingsDisambiguation(); - disambiguation.setEnabled(true); - disambiguation.setNoneOfTheAbovePrompt("none of the above"); - disambiguation.setPrompt("prompt"); - disambiguation.setSensitivity(WorkspaceSystemSettingsDisambiguation.Sensitivity.HIGH); - WorkspaceSystemSettingsTooling tooling = new WorkspaceSystemSettingsTooling(); - tooling.setStoreGenericResponses(true); + WorkspaceSystemSettingsDisambiguation disambiguation = new WorkspaceSystemSettingsDisambiguation.Builder() + .enabled(true) + .noneOfTheAbovePrompt(NONE_OF_THE_ABOVE_PROMPT) + .prompt(PROMPT) + .sensitivity(WorkspaceSystemSettingsDisambiguation.Sensitivity.HIGH) + .build(); + WorkspaceSystemSettingsTooling tooling = new WorkspaceSystemSettingsTooling.Builder() + .storeGenericResponses(true) + .build(); Map humanAgentAssist = new HashMap<>(); humanAgentAssist.put("help", "ok"); - WorkspaceSystemSettings systemSettings = new WorkspaceSystemSettings(); - systemSettings.setDisambiguation(disambiguation); - systemSettings.setTooling(tooling); - systemSettings.setHumanAgentAssist(humanAgentAssist); + WorkspaceSystemSettings systemSettings = new WorkspaceSystemSettings.Builder() + .disambiguation(disambiguation) + .tooling(tooling) + .humanAgentAssist(humanAgentAssist) + .build(); UpdateWorkspaceOptions.Builder builder = new UpdateWorkspaceOptions.Builder(WORKSPACE_ID); builder.name(workspaceName); @@ -508,13 +526,13 @@ public void testUpdateWorkspaceOptionsBuilder() { assertNotNull(options.metadata()); assertEquals(options.metadata(), workspaceMetadata); assertNotNull(options.systemSettings()); - assertEquals(options.systemSettings().getDisambiguation().getNoneOfTheAbovePrompt(), - disambiguation.getNoneOfTheAbovePrompt()); - assertEquals(options.systemSettings().getDisambiguation().getSensitivity(), disambiguation.getSensitivity()); - assertEquals(options.systemSettings().getDisambiguation().getPrompt(), disambiguation.getPrompt()); - assertEquals(options.systemSettings().getDisambiguation().isEnabled(), disambiguation.isEnabled()); - assertEquals(options.systemSettings().getTooling().isStoreGenericResponses(), tooling.isStoreGenericResponses()); - assertEquals(options.systemSettings().getHumanAgentAssist(), humanAgentAssist); + assertEquals(options.systemSettings().disambiguation().noneOfTheAbovePrompt(), + disambiguation.noneOfTheAbovePrompt()); + assertEquals(options.systemSettings().disambiguation().sensitivity(), disambiguation.sensitivity()); + assertEquals(options.systemSettings().disambiguation().prompt(), disambiguation.prompt()); + assertEquals(options.systemSettings().disambiguation().enabled(), disambiguation.enabled()); + assertEquals(options.systemSettings().tooling().storeGenericResponses(), tooling.storeGenericResponses()); + assertEquals(options.systemSettings().humanAgentAssist(), humanAgentAssist); UpdateWorkspaceOptions.Builder builder2 = options.newBuilder(); @@ -569,61 +587,61 @@ public void testGetWorkspaceOptionsBuilder() { @Test public void testCreateExampleOptionsBuilder() { - Mention mentions1 = new Mention(); - mentions1.setEntity("entity"); - mentions1.setLocation(Arrays.asList(0L, 10L)); + Mention mentions1 = new Mention.Builder() + .entity(ENTITY) + .location(LOCATION) + .build(); List mentionsList = new ArrayList<>(); mentionsList.add(mentions1); - Mention mentions2 = new Mention(); - mentions2.setEntity("second_entity"); - mentions2.setLocation(Arrays.asList(10L, 20L)); - String text = "text"; - String intent = "intent"; + Mention mentions2 = new Mention.Builder() + .entity(ENTITY) + .location(LOCATION) + .build(); CreateExampleOptions createExampleOptions = new CreateExampleOptions.Builder() .workspaceId(WORKSPACE_ID) .mentions(mentionsList) .addMentions(mentions2) - .text(text) - .intent(intent) + .text(TEXT) + .intent(INTENT) .build(); mentionsList.add(mentions2); assertEquals(createExampleOptions.workspaceId(), WORKSPACE_ID); assertEquals(createExampleOptions.mentions(), mentionsList); - assertEquals(createExampleOptions.text(), text); - assertEquals(createExampleOptions.intent(), intent); + assertEquals(createExampleOptions.text(), TEXT); + assertEquals(createExampleOptions.intent(), INTENT); } @Test public void testUpdateExampleOptionsBuilder() { - Mention mentions1 = new Mention(); - mentions1.setEntity("entity"); - mentions1.setLocation(Arrays.asList(0L, 10L)); + Mention mentions1 = new Mention.Builder() + .entity(ENTITY) + .location(LOCATION) + .build(); List mentionsList = new ArrayList<>(); mentionsList.add(mentions1); - Mention mentions2 = new Mention(); - mentions2.setEntity("second_entity"); - mentions2.setLocation(Arrays.asList(10L, 20L)); - String text = "text"; - String intent = "intent"; + Mention mentions2 = new Mention.Builder() + .entity(ENTITY) + .location(LOCATION) + .build(); UpdateExampleOptions updateExampleOptions = new UpdateExampleOptions.Builder() .workspaceId(WORKSPACE_ID) - .intent(intent) - .text(text) + .intent(INTENT) + .text(TEXT) .newMentions(mentionsList) - .newText(text) + .newText(TEXT) .build(); mentionsList.add(mentions2); assertEquals(updateExampleOptions.workspaceId(), WORKSPACE_ID); assertEquals(updateExampleOptions.newMentions(), mentionsList); - assertEquals(updateExampleOptions.newText(), text); - assertEquals(updateExampleOptions.intent(), intent); - assertEquals(updateExampleOptions.text(), text); + assertEquals(updateExampleOptions.newText(), TEXT); + assertEquals(updateExampleOptions.intent(), INTENT); + assertEquals(updateExampleOptions.text(), TEXT); } /** @@ -789,7 +807,7 @@ public void testCreateValueOptionsBuilder() { .value(value) .addSynonym(valueSynonym0).addSynonym(valueSynonym1) .addPattern(valuePattern0).addPattern(valuePattern1) - .valueType(valueType) + .type(valueType) .build(); assertEquals(createOptions.workspaceId(), WORKSPACE_ID); @@ -801,7 +819,7 @@ public void testCreateValueOptionsBuilder() { assertEquals(createOptions.patterns().size(), 2); assertEquals(createOptions.patterns().get(0), valuePattern0); assertEquals(createOptions.patterns().get(1), valuePattern1); - assertEquals(createOptions.valueType(), valueType); + assertEquals(createOptions.type(), valueType); CreateValueOptions.Builder builder = createOptions.newBuilder(); @@ -867,12 +885,16 @@ public void testUpdateValueOptionsBuilder() { @Test public void testCreateDialogNodeOptionsBuilder() { String dialogNodeName = "aDialogNode"; - DialogNodeAction action0 = new DialogNodeAction(); - action0.setName("action0"); - action0.setCredentials("credential0"); - DialogNodeAction action1 = new DialogNodeAction(); - action1.setName("action1"); - action1.setCredentials("credential1"); + DialogNodeAction action0 = new DialogNodeAction.Builder() + .name(NAME) + .credentials(CREDENTIALS) + .resultVariable(RESULT_VARIABLE) + .build(); + DialogNodeAction action1 = new DialogNodeAction.Builder() + .name(NAME) + .credentials(CREDENTIALS) + .resultVariable(RESULT_VARIABLE) + .build(); String userLabel = "user_label"; CreateDialogNodeOptions createOptions = new CreateDialogNodeOptions.Builder() @@ -889,9 +911,9 @@ public void testCreateDialogNodeOptionsBuilder() { assertEquals(createOptions.dialogNode(), dialogNodeName); assertEquals(createOptions.actions().size(), 2); assertEquals(createOptions.actions().get(0), action0); - assertEquals(createOptions.actions().get(0).getCredentials(), "credential0"); + assertEquals(createOptions.actions().get(0).credentials(), CREDENTIALS); assertEquals(createOptions.actions().get(1), action1); - assertEquals(createOptions.actions().get(1).getCredentials(), "credential1"); + assertEquals(createOptions.actions().get(1).credentials(), CREDENTIALS); assertEquals(createOptions.digressIn(), CreateDialogNodeOptions.DigressIn.RETURNS); assertEquals(createOptions.digressOut(), CreateDialogNodeOptions.DigressOut.ALLOW_ALL); assertEquals(createOptions.digressOutSlots(), CreateDialogNodeOptions.DigressOutSlots.ALLOW_ALL); @@ -905,12 +927,16 @@ public void testCreateDialogNodeOptionsBuilder() { public void testUpdateDialogNodeOptionsBuilder() { String dialogNodeName = "aDialogNode"; String newDialogNodeName = "renamedDialogNode"; - DialogNodeAction action0 = new DialogNodeAction(); - action0.setName("action0"); - action0.setCredentials("credential0"); - DialogNodeAction action1 = new DialogNodeAction(); - action1.setName("action1"); - action1.setCredentials("credential1"); + DialogNodeAction action0 = new DialogNodeAction.Builder() + .name(NAME) + .credentials(CREDENTIALS) + .resultVariable(RESULT_VARIABLE) + .build(); + DialogNodeAction action1 = new DialogNodeAction.Builder() + .name(NAME) + .credentials(CREDENTIALS) + .resultVariable(RESULT_VARIABLE) + .build(); String userLabel = "user_label"; UpdateDialogNodeOptions updateOptions = new UpdateDialogNodeOptions.Builder() @@ -928,9 +954,9 @@ public void testUpdateDialogNodeOptionsBuilder() { assertEquals(updateOptions.dialogNode(), dialogNodeName); assertEquals(updateOptions.newActions().size(), 2); assertEquals(updateOptions.newActions().get(0), action0); - assertEquals(updateOptions.newActions().get(0).getCredentials(), "credential0"); + assertEquals(updateOptions.newActions().get(0).credentials(), CREDENTIALS); assertEquals(updateOptions.newActions().get(1), action1); - assertEquals(updateOptions.newActions().get(1).getCredentials(), "credential1"); + assertEquals(updateOptions.newActions().get(1).credentials(), CREDENTIALS); assertEquals(updateOptions.newDigressIn(), UpdateDialogNodeOptions.NewDigressIn.RETURNS); assertEquals(updateOptions.newDigressOut(), UpdateDialogNodeOptions.NewDigressOut.ALLOW_ALL); assertEquals(updateOptions.newDigressOutSlots(), UpdateDialogNodeOptions.NewDigressOutSlots.ALLOW_ALL); @@ -996,12 +1022,13 @@ public void testMessageContextMetadata() { String deployment = "deployment"; String userId = "user_id"; - MessageContextMetadata messageContextMetadata = new MessageContextMetadata(); - messageContextMetadata.setDeployment(deployment); - messageContextMetadata.setUserId(userId); + MessageContextMetadata messageContextMetadata = new MessageContextMetadata.Builder() + .deployment(deployment) + .userId(userId) + .build(); - assertEquals(deployment, messageContextMetadata.getDeployment()); - assertEquals(userId, messageContextMetadata.getUserId()); + assertEquals(deployment, messageContextMetadata.deployment()); + assertEquals(userId, messageContextMetadata.userId()); } @Test diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceIT.java b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceIT.java index 981476ad228..d166b9f19eb 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceIT.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceIT.java @@ -15,12 +15,12 @@ import com.ibm.watson.assistant.v2.model.CreateSessionOptions; import com.ibm.watson.assistant.v2.model.DeleteSessionOptions; -import com.ibm.watson.assistant.v2.model.DialogRuntimeResponseGeneric; import com.ibm.watson.assistant.v2.model.MessageContext; import com.ibm.watson.assistant.v2.model.MessageInput; import com.ibm.watson.assistant.v2.model.MessageInputOptions; import com.ibm.watson.assistant.v2.model.MessageOptions; import com.ibm.watson.assistant.v2.model.MessageResponse; +import com.ibm.watson.assistant.v2.model.RuntimeResponseGeneric; import com.ibm.watson.assistant.v2.model.SessionResponse; import com.ibm.watson.common.RetryRunner; import org.junit.Before; @@ -66,13 +66,14 @@ public void testSendMessages() { "I'd like 3 pizzas.", "Large" ); - MessageContext context = new MessageContext(); + MessageContext context = new MessageContext.Builder().build(); try { // send messages for (String message : messages) { - MessageInputOptions inputOptions = new MessageInputOptions(); - inputOptions.setDebug(true); + MessageInputOptions inputOptions = new MessageInputOptions.Builder() + .debug(true) + .build(); MessageInput input = new MessageInput.Builder() .text(message) .messageType(MessageInput.MessageType.TEXT) @@ -87,11 +88,11 @@ public void testSendMessages() { MessageResponse messageResponse = service.message(messageOptions).execute().getResult(); // message assertions - List genericResponses = messageResponse.getOutput().getGeneric(); + List genericResponses = messageResponse.getOutput().getGeneric(); assertNotNull(genericResponses); boolean foundTextResponse = false; - for (DialogRuntimeResponseGeneric generic : genericResponses) { - if (generic.getResponseType().equals(DialogRuntimeResponseGeneric.ResponseType.TEXT)) { + for (RuntimeResponseGeneric generic : genericResponses) { + if (generic.responseType().equals(RuntimeResponseGeneric.ResponseType.TEXT)) { foundTextResponse = true; break; } diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java index ff80cbca896..3c4edd0cadc 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java @@ -12,7 +12,7 @@ */ package com.ibm.watson.assistant.v2; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import org.junit.Assume; import org.junit.Before; @@ -45,12 +45,9 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new Assistant("2019-02-28"); + IamAuthenticator authenticator = new IamAuthenticator(apiKey); + service = new Assistant("2019-02-28", authenticator); service.setEndPoint(getProperty("assistant.url")); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); service.setDefaultHeaders(getDefaultHeaders()); } diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantTest.java b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantTest.java index 013f54bbff4..8ebd2b35cdc 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantTest.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantTest.java @@ -12,13 +12,12 @@ */ package com.ibm.watson.assistant.v2; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.assistant.v2.model.CaptureGroup; import com.ibm.watson.assistant.v2.model.CreateSessionOptions; import com.ibm.watson.assistant.v2.model.DeleteSessionOptions; import com.ibm.watson.assistant.v2.model.DialogLogMessage; import com.ibm.watson.assistant.v2.model.DialogNodeAction; -import com.ibm.watson.assistant.v2.model.DialogRuntimeResponseGeneric; import com.ibm.watson.assistant.v2.model.MessageContext; import com.ibm.watson.assistant.v2.model.MessageContextGlobal; import com.ibm.watson.assistant.v2.model.MessageContextGlobalSystem; @@ -30,6 +29,7 @@ import com.ibm.watson.assistant.v2.model.MessageResponse; import com.ibm.watson.assistant.v2.model.RuntimeEntity; import com.ibm.watson.assistant.v2.model.RuntimeIntent; +import com.ibm.watson.assistant.v2.model.RuntimeResponseGeneric; import com.ibm.watson.assistant.v2.model.SessionResponse; import com.ibm.watson.common.WatsonServiceUnitTest; import okhttp3.mockwebserver.MockResponse; @@ -118,22 +118,19 @@ public void setUp() throws Exception { messageResponse = loadFixture(RESOURCE + "message_response.json", MessageResponse.class); sessionResponse = loadFixture(RESOURCE + "session_response.json", SessionResponse.class); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new Assistant(VERSION, authConfig); + service = new Assistant(VERSION, new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); } @Test public void testCaptureGroup() { - CaptureGroup captureGroup = new CaptureGroup(); - captureGroup.setGroup(GROUP); - captureGroup.setLocation(LOCATION); + CaptureGroup captureGroup = new CaptureGroup.Builder() + .group(GROUP) + .location(LOCATION) + .build(); - assertEquals(GROUP, captureGroup.getGroup()); - assertEquals(LOCATION, captureGroup.getLocation()); + assertEquals(GROUP, captureGroup.group()); + assertEquals(LOCATION, captureGroup.location()); } @Test @@ -160,60 +157,67 @@ public void testDeleteSessionOptions() { @Test public void testMessageContextGlobalSystem() { - MessageContextGlobalSystem messageContextGlobalSystem = new MessageContextGlobalSystem(); - messageContextGlobalSystem.setTimezone(TIMEZONE); - messageContextGlobalSystem.setTurnCount(TURN_COUNT); - messageContextGlobalSystem.setUserId(USER_ID); - - assertEquals(TIMEZONE, messageContextGlobalSystem.getTimezone()); - assertEquals(TURN_COUNT, messageContextGlobalSystem.getTurnCount()); - assertEquals(USER_ID, messageContextGlobalSystem.getUserId()); + MessageContextGlobalSystem messageContextGlobalSystem = new MessageContextGlobalSystem.Builder() + .timezone(TIMEZONE) + .turnCount(TURN_COUNT) + .userId(USER_ID) + .build(); + + assertEquals(TIMEZONE, messageContextGlobalSystem.timezone()); + assertEquals(TURN_COUNT, messageContextGlobalSystem.turnCount()); + assertEquals(USER_ID, messageContextGlobalSystem.userId()); } @Test public void testMessageContextGlobal() { - MessageContextGlobalSystem messageContextGlobalSystem = new MessageContextGlobalSystem(); + MessageContextGlobalSystem messageContextGlobalSystem = new MessageContextGlobalSystem.Builder().build(); - MessageContextGlobal messageContextGlobal = new MessageContextGlobal(); - messageContextGlobal.setSystem(messageContextGlobalSystem); + MessageContextGlobal messageContextGlobal = new MessageContextGlobal.Builder() + .system(messageContextGlobalSystem) + .build(); - assertEquals(messageContextGlobalSystem, messageContextGlobal.getSystem()); + assertEquals(messageContextGlobalSystem, messageContextGlobal.system()); } @Test public void testMessageContext() { - MessageContextGlobal messageContextGlobal = new MessageContextGlobal(); + MessageContextGlobal messageContextGlobal = new MessageContextGlobal.Builder().build(); MessageContextSkills messageContextSkills = new MessageContextSkills(); - MessageContext messageContext = new MessageContext(); - messageContext.setGlobal(messageContextGlobal); - messageContext.setSkills(messageContextSkills); + MessageContext messageContext = new MessageContext.Builder() + .global(messageContextGlobal) + .skills(messageContextSkills) + .build(); - assertEquals(messageContextGlobal, messageContext.getGlobal()); - assertEquals(messageContextSkills, messageContext.getSkills()); + assertEquals(messageContextGlobal, messageContext.global()); + assertEquals(messageContextSkills, messageContext.skills()); } @Test public void testMessageInput() { - RuntimeEntity entity1 = new RuntimeEntity(); - entity1.setEntity(ENTITY); - entity1.setLocation(LOCATION); - entity1.setValue(VALUE); - RuntimeEntity entity2 = new RuntimeEntity(); - entity2.setEntity(ENTITY); - entity2.setLocation(LOCATION); - entity2.setValue(VALUE); + RuntimeEntity entity1 = new RuntimeEntity.Builder() + .entity(ENTITY) + .location(LOCATION) + .value(VALUE) + .build(); + RuntimeEntity entity2 = new RuntimeEntity.Builder() + .entity(ENTITY) + .location(LOCATION) + .value(VALUE) + .build(); List entityList = new ArrayList<>(); entityList.add(entity1); - RuntimeIntent intent1 = new RuntimeIntent(); - intent1.setConfidence(CONFIDENCE); - intent1.setIntent(INTENT); - RuntimeIntent intent2 = new RuntimeIntent(); - intent2.setConfidence(CONFIDENCE); - intent2.setIntent(INTENT); + RuntimeIntent intent1 = new RuntimeIntent.Builder() + .confidence(CONFIDENCE) + .intent(INTENT) + .build(); + RuntimeIntent intent2 = new RuntimeIntent.Builder() + .confidence(CONFIDENCE) + .intent(INTENT) + .build(); List intentList = new ArrayList<>(); intentList.add(intent1); - MessageInputOptions inputOptions = new MessageInputOptions(); + MessageInputOptions inputOptions = new MessageInputOptions.Builder().build(); MessageInput messageInput = new MessageInput.Builder() .messageType(MessageInput.MessageType.TEXT) @@ -239,21 +243,22 @@ public void testMessageInput() { @Test public void testMessageInputOptions() { - MessageInputOptions inputOptions = new MessageInputOptions(); - inputOptions.setAlternateIntents(true); - inputOptions.setDebug(true); - inputOptions.setRestart(true); - inputOptions.setReturnContext(true); - - assertTrue(inputOptions.isAlternateIntents()); - assertTrue(inputOptions.isDebug()); - assertTrue(inputOptions.isRestart()); - assertTrue(inputOptions.isReturnContext()); + MessageInputOptions inputOptions = new MessageInputOptions.Builder() + .alternateIntents(true) + .debug(true) + .restart(true) + .returnContext(true) + .build(); + + assertTrue(inputOptions.alternateIntents()); + assertTrue(inputOptions.debug()); + assertTrue(inputOptions.restart()); + assertTrue(inputOptions.returnContext()); } @Test public void testMessageOptions() { - MessageContext messageContext = new MessageContext(); + MessageContext messageContext = new MessageContext.Builder().build(); MessageInput messageInput = new MessageInput.Builder().build(); MessageOptions messageOptions = new MessageOptions.Builder() @@ -272,34 +277,37 @@ public void testMessageOptions() { @Test public void testRuntimeEntity() { - CaptureGroup captureGroup = new CaptureGroup(); - captureGroup.setGroup(GROUP); + CaptureGroup captureGroup = new CaptureGroup.Builder() + .group(GROUP) + .build(); List captureGroupList = Collections.singletonList(captureGroup); - RuntimeEntity runtimeEntity = new RuntimeEntity(); - runtimeEntity.setConfidence(CONFIDENCE); - runtimeEntity.setEntity(ENTITY); - runtimeEntity.setGroups(captureGroupList); - runtimeEntity.setLocation(LOCATION); - runtimeEntity.setMetadata(MAP); - runtimeEntity.setValue(VALUE); - - assertEquals(CONFIDENCE, runtimeEntity.getConfidence()); - assertEquals(ENTITY, runtimeEntity.getEntity()); - assertEquals(captureGroupList, runtimeEntity.getGroups()); - assertEquals(LOCATION, runtimeEntity.getLocation()); - assertEquals(MAP, runtimeEntity.getMetadata()); - assertEquals(VALUE, runtimeEntity.getValue()); + RuntimeEntity runtimeEntity = new RuntimeEntity.Builder() + .confidence(CONFIDENCE) + .entity(ENTITY) + .groups(captureGroupList) + .location(LOCATION) + .metadata(MAP) + .value(VALUE) + .build(); + + assertEquals(CONFIDENCE, runtimeEntity.confidence()); + assertEquals(ENTITY, runtimeEntity.entity()); + assertEquals(captureGroupList, runtimeEntity.groups()); + assertEquals(LOCATION, runtimeEntity.location()); + assertEquals(MAP, runtimeEntity.metadata()); + assertEquals(VALUE, runtimeEntity.value()); } @Test public void testRuntimeIntent() { - RuntimeIntent runtimeIntent = new RuntimeIntent(); - runtimeIntent.setConfidence(CONFIDENCE); - runtimeIntent.setIntent(INTENT); + RuntimeIntent runtimeIntent = new RuntimeIntent.Builder() + .confidence(CONFIDENCE) + .intent(INTENT) + .build(); - assertEquals(CONFIDENCE, runtimeIntent.getConfidence()); - assertEquals(INTENT, runtimeIntent.getIntent()); + assertEquals(CONFIDENCE, runtimeIntent.confidence()); + assertEquals(INTENT, runtimeIntent.intent()); } @Test @@ -317,7 +325,7 @@ public void testMessage() throws InterruptedException { assertNotNull(response.getContext()); assertNotNull(response.getOutput()); - assertEquals(DialogNodeAction.ActionType.CLIENT, response.getOutput().getActions().get(0).getActionType()); + assertEquals(DialogNodeAction.Type.CLIENT, response.getOutput().getActions().get(0).getType()); assertEquals(NAME, response.getOutput().getActions().get(0).getName()); assertEquals(MAP, response.getOutput().getActions().get(0).getParameters()); assertEquals(RESULT_VARIABLE, response.getOutput().getActions().get(0).getResultVariable()); @@ -330,22 +338,22 @@ public void testMessage() throws InterruptedException { assertEquals(TITLE, response.getOutput().getDebug().getNodesVisited().get(0).getTitle()); assertEquals(DIALOG_NODE, response.getOutput().getDebug().getNodesVisited().get(0).getDialogNode()); assertTrue(response.getOutput().getDebug().isBranchExited()); - assertEquals(DESCRIPTION, response.getOutput().getGeneric().get(0).getDescription()); - assertEquals(DialogRuntimeResponseGeneric.ResponseType.TEXT, - response.getOutput().getGeneric().get(0).getResponseType()); - assertEquals(DialogRuntimeResponseGeneric.Preference.BUTTON, - response.getOutput().getGeneric().get(0).getPreference()); - assertEquals(TEXT, response.getOutput().getGeneric().get(0).getText()); - assertEquals(TIME, response.getOutput().getGeneric().get(0).getTime()); - assertTrue(response.getOutput().getGeneric().get(0).isTyping()); - assertEquals(SOURCE, response.getOutput().getGeneric().get(0).getSource()); - assertEquals(TITLE, response.getOutput().getGeneric().get(0).getTitle()); - assertEquals(MESSAGE, response.getOutput().getGeneric().get(0).getMessageToHumanAgent()); - assertEquals(TOPIC, response.getOutput().getGeneric().get(0).getTopic()); - assertEquals(LABEL, response.getOutput().getGeneric().get(0).getOptions().get(0).getLabel()); - assertNotNull(response.getOutput().getGeneric().get(0).getOptions().get(0).getValue().getInput()); - assertEquals(LABEL, response.getOutput().getGeneric().get(0).getSuggestions().get(0).getLabel()); - assertNotNull(response.getOutput().getGeneric().get(0).getSuggestions().get(0).getValue()); + assertEquals(DESCRIPTION, response.getOutput().getGeneric().get(0).description()); + assertEquals(RuntimeResponseGeneric.ResponseType.TEXT, + response.getOutput().getGeneric().get(0).responseType()); + assertEquals(RuntimeResponseGeneric.Preference.BUTTON, + response.getOutput().getGeneric().get(0).preference()); + assertEquals(TEXT, response.getOutput().getGeneric().get(0).text()); + assertEquals(TIME, response.getOutput().getGeneric().get(0).time()); + assertTrue(response.getOutput().getGeneric().get(0).typing()); + assertEquals(SOURCE, response.getOutput().getGeneric().get(0).source()); + assertEquals(TITLE, response.getOutput().getGeneric().get(0).title()); + assertEquals(MESSAGE, response.getOutput().getGeneric().get(0).messageToHumanAgent()); + assertEquals(TOPIC, response.getOutput().getGeneric().get(0).topic()); + assertEquals(LABEL, response.getOutput().getGeneric().get(0).options().get(0).getLabel()); + assertNotNull(response.getOutput().getGeneric().get(0).options().get(0).getValue().getInput()); + assertEquals(LABEL, response.getOutput().getGeneric().get(0).suggestions().get(0).getLabel()); + assertNotNull(response.getOutput().getGeneric().get(0).suggestions().get(0).getValue()); } @Test From 55e7e06391305120a1b191cb98a465c86980067b Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:38:54 -0400 Subject: [PATCH 05/28] test(Compare and Comply): Update tests --- .../v1/CompareComplyServiceIT.java | 99 ++-- .../v1/CompareComplyServiceTest.java | 8 +- .../compare_comply/v1/CompareComplyTest.java | 438 ++++++++++-------- 3 files changed, 304 insertions(+), 241 deletions(-) diff --git a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java index 3de326a0167..3d1ec8a48f2 100644 --- a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java +++ b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java @@ -119,53 +119,64 @@ public void testFeedbackOperations() { String text = "1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist " + "Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing " + "infrastructure."; - ShortDoc shortDoc = new ShortDoc(); - shortDoc.setTitle("doc title"); - shortDoc.setHash(""); - Location location = new Location(); - location.setBegin(241); - location.setEnd(237); - OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn(); - Label label1 = new Label(); - label1.setNature("Obligation"); - label1.setParty("IBM"); + ShortDoc shortDoc = new ShortDoc.Builder() + .title("doc title") + .hash("") + .build(); + Location location = new Location.Builder() + .begin(241) + .end(237) + .build(); + OriginalLabelsIn.Builder originalLabelsInBuilder = new OriginalLabelsIn.Builder(); + Label label1 = new Label.Builder() + .nature("Obligation") + .party("IBM") + .build(); List ids1 = Arrays.asList("85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795"); - TypeLabel typeLabel1 = new TypeLabel(); - typeLabel1.setLabel(label1); - typeLabel1.setProvenanceIds(ids1); - Label label2 = new Label(); - label2.setNature("End User"); - label2.setParty("Exclusion"); + TypeLabel typeLabel1 = new TypeLabel.Builder() + .label(label1) + .provenanceIds(ids1) + .build(); + Label label2 = new Label.Builder() + .nature("End User") + .party("Exclusion") + .build(); List ids2 = Arrays.asList("85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795"); - TypeLabel typeLabel2 = new TypeLabel(); - typeLabel2.setLabel(label2); - typeLabel2.setProvenanceIds(ids2); + TypeLabel typeLabel2 = new TypeLabel.Builder() + .label(label2) + .provenanceIds(ids2) + .build(); List types = Arrays.asList(typeLabel1, typeLabel2); - originalLabelsIn.setTypes(types); - Category category1 = new Category(); - category1.setLabel(Category.Label.RESPONSIBILITIES); - category1.setProvenanceIds(new ArrayList()); - Category category2 = new Category(); - category2.setLabel(Category.Label.AMENDMENTS); - category2.setProvenanceIds(new ArrayList()); - originalLabelsIn.setCategories(Arrays.asList(category1, category2)); - UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn(); - Label label3 = new Label(); - label3.setNature("Disclaimer"); - label3.setParty("buyer"); - TypeLabel typeLabel3 = new TypeLabel(); - typeLabel3.setLabel(label3); - updatedLabelsIn.setTypes(Arrays.asList(typeLabel1, typeLabel3)); - updatedLabelsIn.setCategories(Arrays.asList(category1, category2)); - FeedbackDataInput feedbackDataInput = new FeedbackDataInput(); - feedbackDataInput.setDocument(shortDoc); - feedbackDataInput.setLocation(location); - feedbackDataInput.setText(text); - feedbackDataInput.setOriginalLabels(originalLabelsIn); - feedbackDataInput.setUpdatedLabels(updatedLabelsIn); - feedbackDataInput.setFeedbackType("element_classification"); - feedbackDataInput.setModelId("contracts"); - feedbackDataInput.setModelVersion("11.00"); + originalLabelsInBuilder.types(types); + Category category1 = new Category.Builder() + .label(Category.Label.RESPONSIBILITIES) + .provenanceIds(new ArrayList()) + .build(); + Category category2 = new Category.Builder() + .label(Category.Label.AMENDMENTS) + .provenanceIds(new ArrayList()) + .build(); + originalLabelsInBuilder.categories(Arrays.asList(category1, category2)); + UpdatedLabelsIn.Builder updatedLabelsInBuilder = new UpdatedLabelsIn.Builder(); + Label label3 = new Label.Builder() + .nature("Disclaimer") + .party("buyer") + .build(); + TypeLabel typeLabel3 = new TypeLabel.Builder() + .label(label3) + .build(); + updatedLabelsInBuilder.types(Arrays.asList(typeLabel1, typeLabel3)); + updatedLabelsInBuilder.categories(Arrays.asList(category1, category2)); + FeedbackDataInput feedbackDataInput = new FeedbackDataInput.Builder() + .document(shortDoc) + .location(location) + .text(text) + .originalLabels(originalLabelsInBuilder.build()) + .updatedLabels(updatedLabelsInBuilder.build()) + .feedbackType("element_classification") + .modelId("contracts") + .modelVersion("11.00") + .build(); AddFeedbackOptions addFeedbackOptions = new AddFeedbackOptions.Builder() .userId(userId) diff --git a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java index 1c50a5c54b6..7c5111dd39e 100644 --- a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java +++ b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java @@ -1,6 +1,6 @@ package com.ibm.watson.compare_comply.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import org.junit.Assume; import org.junit.Before; @@ -25,10 +25,8 @@ public void setUp() throws Exception { String apiKey = getProperty("compare_comply.apikey"); Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service = new CompareComply(VERSION, iamOptions); + IamAuthenticator authenticator = new IamAuthenticator(apiKey); + service = new CompareComply(VERSION, authenticator); service.setEndPoint(getProperty("compare_comply.url")); service.setDefaultHeaders(getDefaultHeaders()); } diff --git a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyTest.java b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyTest.java index ec2a73655be..6e0f3c6bb6a 100644 --- a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyTest.java +++ b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyTest.java @@ -13,7 +13,7 @@ package com.ibm.watson.compare_comply.v1; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.compare_comply.v1.model.AddFeedbackOptions; import com.ibm.watson.compare_comply.v1.model.BatchStatus; @@ -222,11 +222,7 @@ public void setUp() throws Exception { batchStatusResponse = loadFixture(RESOURCE + "batch-status.json", BatchStatus.class); batchesResponse = loadFixture(RESOURCE + "batches.json", Batches.class); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new CompareComply(VERSION, authConfig); + service = new CompareComply(VERSION, new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); } @@ -234,7 +230,27 @@ public void setUp() throws Exception { @Test public void testAddFeedbackOptions() { - FeedbackDataInput feedbackDataInput = new FeedbackDataInput(); + Location location = new Location.Builder() + .begin(BEGIN) + .end(END) + .build(); + Category category = new Category.Builder().build(); + TypeLabel typeLabel = new TypeLabel.Builder().build(); + OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + FeedbackDataInput feedbackDataInput = new FeedbackDataInput.Builder() + .feedbackType(FEEDBACK_TYPE) + .location(location) + .originalLabels(originalLabelsIn) + .text(TEXT) + .updatedLabels(updatedLabelsIn) + .build(); AddFeedbackOptions addFeedbackOptions = new AddFeedbackOptions.Builder() .comment(COMMENT) @@ -292,14 +308,12 @@ public void testConvertToHtmlOptions() throws FileNotFoundException { ConvertToHtmlOptions convertToHtmlOptions = new ConvertToHtmlOptions.Builder() .file(fileInputStream) .fileContentType(CONTENT_TYPE_PDF) - .filename(FILENAME) .model(ConvertToHtmlOptions.Model.CONTRACTS) .build(); convertToHtmlOptions = convertToHtmlOptions.newBuilder().build(); assertEquals(fileInputStream, convertToHtmlOptions.file()); assertEquals(CONTENT_TYPE_PDF, convertToHtmlOptions.fileContentType()); - assertEquals(FILENAME, convertToHtmlOptions.filename()); assertEquals(ConvertToHtmlOptions.Model.CONTRACTS, convertToHtmlOptions.model()); } @@ -357,29 +371,41 @@ public void testExtractTablesOptions() throws FileNotFoundException { @Test public void testFeedbackDataInput() { - ShortDoc shortDoc = new ShortDoc(); - Location location = new Location(); - OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn(); - UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn(); - - FeedbackDataInput feedbackDataInput = new FeedbackDataInput(); - feedbackDataInput.setDocument(shortDoc); - feedbackDataInput.setFeedbackType(FEEDBACK_TYPE); - feedbackDataInput.setLocation(location); - feedbackDataInput.setModelId(MODEL_ID); - feedbackDataInput.setModelVersion(MODEL_VERSION); - feedbackDataInput.setOriginalLabels(originalLabelsIn); - feedbackDataInput.setText(TEXT); - feedbackDataInput.setUpdatedLabels(updatedLabelsIn); - - assertEquals(shortDoc, feedbackDataInput.getDocument()); - assertEquals(FEEDBACK_TYPE, feedbackDataInput.getFeedbackType()); - assertEquals(location, feedbackDataInput.getLocation()); - assertEquals(MODEL_ID, feedbackDataInput.getModelId()); - assertEquals(MODEL_VERSION, feedbackDataInput.getModelVersion()); - assertEquals(originalLabelsIn, feedbackDataInput.getOriginalLabels()); - assertEquals(TEXT, feedbackDataInput.getText()); - assertEquals(updatedLabelsIn, feedbackDataInput.getUpdatedLabels()); + ShortDoc shortDoc = new ShortDoc.Builder().build(); + Location location = new Location.Builder() + .begin(BEGIN) + .end(END) + .build(); + Category category = new Category.Builder().build(); + TypeLabel typeLabel = new TypeLabel.Builder().build(); + OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + + FeedbackDataInput feedbackDataInput = new FeedbackDataInput.Builder() + .document(shortDoc) + .feedbackType(FEEDBACK_TYPE) + .location(location) + .modelId(MODEL_ID) + .modelVersion(MODEL_VERSION) + .originalLabels(originalLabelsIn) + .text(TEXT) + .updatedLabels(updatedLabelsIn) + .build(); + + assertEquals(shortDoc, feedbackDataInput.document()); + assertEquals(FEEDBACK_TYPE, feedbackDataInput.feedbackType()); + assertEquals(location, feedbackDataInput.location()); + assertEquals(MODEL_ID, feedbackDataInput.modelId()); + assertEquals(MODEL_VERSION, feedbackDataInput.modelVersion()); + assertEquals(originalLabelsIn, feedbackDataInput.originalLabels()); + assertEquals(TEXT, feedbackDataInput.text()); + assertEquals(updatedLabelsIn, feedbackDataInput.updatedLabels()); } @Test @@ -414,12 +440,13 @@ public void testGetFeedbackOptions() { @Test public void testLabel() { - Label label = new Label(); - label.setNature(NATURE); - label.setParty(PARTY); + Label label = new Label.Builder() + .nature(NATURE) + .party(PARTY) + .build(); - assertEquals(NATURE, label.getNature()); - assertEquals(PARTY, label.getParty()); + assertEquals(NATURE, label.nature()); + assertEquals(PARTY, label.party()); } @Test @@ -463,45 +490,52 @@ public void testListFeedbackOptions() { @Test public void testLocation() { - Location location = new Location(); - location.setBegin(BEGIN); - location.setEnd(END); + Location location = new Location.Builder() + .begin(BEGIN) + .end(END) + .build(); - assertEquals(BEGIN, location.getBegin()); - assertEquals(END, location.getEnd()); + assertEquals(BEGIN, location.begin()); + assertEquals(END, location.end()); } @Test public void testOriginalLabelsIn() { - Category category = new Category(); - TypeLabel typeLabel = new TypeLabel(); - OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn(); - originalLabelsIn.setCategories(Collections.singletonList(category)); - originalLabelsIn.setTypes(Collections.singletonList(typeLabel)); - - assertEquals(category, originalLabelsIn.getCategories().get(0)); - assertEquals(typeLabel, originalLabelsIn.getTypes().get(0)); + Category category = new Category.Builder().build(); + TypeLabel typeLabel = new TypeLabel.Builder().build(); + OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + + assertEquals(category, originalLabelsIn.categories().get(0)); + assertEquals(typeLabel, originalLabelsIn.types().get(0)); } @Test public void testShortDoc() { - ShortDoc shortDoc = new ShortDoc(); - shortDoc.setHash(HASH); - shortDoc.setTitle(TITLE); + ShortDoc shortDoc = new ShortDoc.Builder() + .hash(HASH) + .title(TITLE) + .build(); - assertEquals(HASH, shortDoc.getHash()); - assertEquals(TITLE, shortDoc.getTitle()); + assertEquals(HASH, shortDoc.hash()); + assertEquals(TITLE, shortDoc.title()); } @Test public void testTypeLabel() { - Label label = new Label(); - TypeLabel typeLabel = new TypeLabel(); - typeLabel.setLabel(label); - typeLabel.setProvenanceIds(Collections.singletonList(PROVENANCE_ID)); + Label label = new Label.Builder() + .nature(NATURE) + .party(PARTY) + .build(); + TypeLabel typeLabel = new TypeLabel.Builder() + .label(label) + .provenanceIds(Collections.singletonList(PROVENANCE_ID)) + .build(); - assertEquals(label, typeLabel.getLabel()); - assertEquals(PROVENANCE_ID, typeLabel.getProvenanceIds().get(0)); + assertEquals(label, typeLabel.label()); + assertEquals(PROVENANCE_ID, typeLabel.provenanceIds().get(0)); } @Test @@ -520,14 +554,15 @@ public void testUpdateBatchOptions() { @Test public void testUpdatedLabelsIn() { - Category category = new Category(); - TypeLabel typeLabel = new TypeLabel(); - UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn(); - updatedLabelsIn.setCategories(Collections.singletonList(category)); - updatedLabelsIn.setTypes(Collections.singletonList(typeLabel)); - - assertEquals(category, updatedLabelsIn.getCategories().get(0)); - assertEquals(typeLabel, updatedLabelsIn.getTypes().get(0)); + Category category = new Category.Builder().build(); + TypeLabel typeLabel = new TypeLabel.Builder().build(); + UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + + assertEquals(category, updatedLabelsIn.categories().get(0)); + assertEquals(typeLabel, updatedLabelsIn.types().get(0)); } // --- METHODS --- @@ -538,7 +573,6 @@ public void testConvertToHtml() throws FileNotFoundException, InterruptedExcepti ConvertToHtmlOptions convertToHtmlOptions = new ConvertToHtmlOptions.Builder() .file(SAMPLE_PDF) - .filename(FILENAME) .build(); HTMLReturn response = service.convertToHtml(convertToHtmlOptions).execute().getResult(); RecordedRequest request = server.takeRequest(); @@ -568,23 +602,23 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(LABEL, response.getDocument().getLabel()); assertEquals(MODEL_ID, response.getModelId()); assertEquals(MODEL_VERSION, response.getModelVersion()); - assertEquals(BEGIN, response.getElements().get(0).getLocation().getBegin()); - assertEquals(END, response.getElements().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getElements().get(0).getLocation().begin()); + assertEquals(END, response.getElements().get(0).getLocation().end()); assertEquals(TEXT, response.getElements().get(0).getText()); - assertEquals(NATURE, response.getElements().get(0).getTypes().get(0).getLabel().getNature()); - assertEquals(PARTY, response.getElements().get(0).getTypes().get(0).getLabel().getParty()); - assertEquals(PROVENANCE_ID, response.getElements().get(0).getTypes().get(0).getProvenanceIds().get(0)); - assertEquals(LABEL, response.getElements().get(0).getCategories().get(0).getLabel()); - assertEquals(PROVENANCE_ID, response.getElements().get(0).getCategories().get(0).getProvenanceIds().get(0)); + assertEquals(NATURE, response.getElements().get(0).getTypes().get(0).label().nature()); + assertEquals(PARTY, response.getElements().get(0).getTypes().get(0).label().party()); + assertEquals(PROVENANCE_ID, response.getElements().get(0).getTypes().get(0).provenanceIds().get(0)); + assertEquals(LABEL, response.getElements().get(0).getCategories().get(0).label()); + assertEquals(PROVENANCE_ID, response.getElements().get(0).getCategories().get(0).provenanceIds().get(0)); assertEquals(TYPE, response.getElements().get(0).getAttributes().get(0).getType()); assertEquals(TEXT, response.getElements().get(0).getAttributes().get(0).getText()); - assertEquals(BEGIN, response.getElements().get(0).getAttributes().get(0).getLocation().getBegin()); - assertEquals(END, response.getElements().get(0).getAttributes().get(0).getLocation().getEnd()); - assertEquals(BEGIN, response.getTables().get(0).getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getElements().get(0).getAttributes().get(0).getLocation().begin()); + assertEquals(END, response.getElements().get(0).getAttributes().get(0).getLocation().end()); + assertEquals(BEGIN, response.getTables().get(0).getLocation().begin()); + assertEquals(END, response.getTables().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getText()); - assertEquals(BEGIN, response.getTables().get(0).getSectionTitle().getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getSectionTitle().getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getSectionTitle().getLocation().begin()); + assertEquals(END, response.getTables().get(0).getSectionTitle().getLocation().end()); assertEquals(CELL_ID, response.getTables().get(0).getTableHeaders().get(0).getCellId()); assertEquals(BEGIN_DOUBLE, response.getTables().get(0).getTableHeaders().get(0).getLocation().get("begin")); assertEquals(END_DOUBLE, response.getTables().get(0).getTableHeaders().get(0).getLocation().get("end")); @@ -603,8 +637,8 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(COLUMN_INDEX_BEGIN, response.getTables().get(0).getColumnHeaders().get(0).getColumnIndexBegin()); assertEquals(COLUMN_INDEX_END, response.getTables().get(0).getColumnHeaders().get(0).getColumnIndexEnd()); assertEquals(CELL_ID, response.getTables().get(0).getRowHeaders().get(0).getCellId()); - assertEquals(BEGIN, response.getTables().get(0).getRowHeaders().get(0).getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getRowHeaders().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getRowHeaders().get(0).getLocation().begin()); + assertEquals(END, response.getTables().get(0).getRowHeaders().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getRowHeaders().get(0).getText()); assertEquals(TEXT_NORMALIZED, response.getTables().get(0).getRowHeaders().get(0).getTextNormalized()); assertEquals(ROW_INDEX_BEGIN, response.getTables().get(0).getRowHeaders().get(0).getRowIndexBegin()); @@ -612,8 +646,8 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(COLUMN_INDEX_BEGIN, response.getTables().get(0).getRowHeaders().get(0).getColumnIndexBegin()); assertEquals(COLUMN_INDEX_END, response.getTables().get(0).getRowHeaders().get(0).getColumnIndexEnd()); assertEquals(CELL_ID, response.getTables().get(0).getBodyCells().get(0).getCellId()); - assertEquals(BEGIN, response.getTables().get(0).getBodyCells().get(0).getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getBodyCells().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getBodyCells().get(0).getLocation().begin()); + assertEquals(END, response.getTables().get(0).getBodyCells().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getText()); assertEquals(ROW_INDEX_BEGIN, response.getTables().get(0).getBodyCells().get(0).getRowIndexBegin()); assertEquals(ROW_INDEX_END, response.getTables().get(0).getBodyCells().get(0).getRowIndexEnd()); @@ -630,61 +664,61 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(TYPE, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getType()); assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getText()); assertEquals(BEGIN, - response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getBegin()); + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().begin()); assertEquals(END, - response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getEnd()); + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().end()); assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getCellId()); - assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().begin()); + assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getText()); assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getCellId()); assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation() - .getBegin()); - assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation().getEnd()); + .begin()); + assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getText()); assertEquals(TEXT, response.getTables().get(0).getTitle().getText()); - assertEquals(BEGIN, response.getTables().get(0).getTitle().getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getTitle().getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getTitle().getLocation().begin()); + assertEquals(END, response.getTables().get(0).getTitle().getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getContexts().get(0).getText()); - assertEquals(BEGIN, response.getTables().get(0).getContexts().get(0).getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getContexts().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getContexts().get(0).getLocation().begin()); + assertEquals(END, response.getTables().get(0).getContexts().get(0).getLocation().end()); assertEquals(TEXT, response.getDocumentStructure().getSectionTitles().get(0).getText()); - assertEquals(BEGIN, response.getDocumentStructure().getSectionTitles().get(0).getLocation().getBegin()); - assertEquals(END, response.getDocumentStructure().getSectionTitles().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getDocumentStructure().getSectionTitles().get(0).getLocation().begin()); + assertEquals(END, response.getDocumentStructure().getSectionTitles().get(0).getLocation().end()); assertEquals(LEVEL, response.getDocumentStructure().getSectionTitles().get(0).getLevel()); assertEquals(BEGIN, response.getDocumentStructure().getSectionTitles().get(0).getElementLocations().get(0).getBegin()); assertEquals(END, response.getDocumentStructure().getSectionTitles().get(0).getElementLocations().get(0).getEnd()); assertEquals(TEXT, response.getDocumentStructure().getLeadingSentences().get(0).getText()); - assertEquals(BEGIN, response.getDocumentStructure().getLeadingSentences().get(0).getLocation().getBegin()); - assertEquals(END, response.getDocumentStructure().getLeadingSentences().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getDocumentStructure().getLeadingSentences().get(0).getLocation().begin()); + assertEquals(END, response.getDocumentStructure().getLeadingSentences().get(0).getLocation().end()); assertEquals(BEGIN, response.getDocumentStructure().getLeadingSentences().get(0).getElementLocations().get(0).getBegin()); assertEquals(END, response.getDocumentStructure().getLeadingSentences().get(0).getElementLocations().get(0).getEnd()); - assertEquals(BEGIN, response.getDocumentStructure().getParagraphs().get(0).getLocation().getBegin()); - assertEquals(END, response.getDocumentStructure().getParagraphs().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getDocumentStructure().getParagraphs().get(0).getLocation().begin()); + assertEquals(END, response.getDocumentStructure().getParagraphs().get(0).getLocation().end()); assertEquals(PARTY, response.getParties().get(0).getParty()); assertEquals(Parties.Importance.UNKNOWN, response.getParties().get(0).getImportance()); assertEquals(ROLE, response.getParties().get(0).getRole()); assertEquals(TEXT, response.getParties().get(0).getAddresses().get(0).getText()); - assertEquals(BEGIN, response.getParties().get(0).getAddresses().get(0).getLocation().getBegin()); - assertEquals(END, response.getParties().get(0).getAddresses().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getParties().get(0).getAddresses().get(0).getLocation().begin()); + assertEquals(END, response.getParties().get(0).getAddresses().get(0).getLocation().end()); assertEquals(NAME, response.getParties().get(0).getContacts().get(0).getName()); assertEquals(ROLE, response.getParties().get(0).getContacts().get(0).getRole()); assertEquals(TEXT, response.getParties().get(0).getMentions().get(0).getText()); - assertEquals(BEGIN, response.getParties().get(0).getMentions().get(0).getLocation().getBegin()); - assertEquals(END, response.getParties().get(0).getMentions().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getParties().get(0).getMentions().get(0).getLocation().begin()); + assertEquals(END, response.getParties().get(0).getMentions().get(0).getLocation().end()); assertEquals(TEXT, response.getEffectiveDates().get(0).getText()); - assertEquals(BEGIN, response.getEffectiveDates().get(0).getLocation().getBegin()); - assertEquals(END, response.getEffectiveDates().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getEffectiveDates().get(0).getLocation().begin()); + assertEquals(END, response.getEffectiveDates().get(0).getLocation().end()); assertEquals(EffectiveDates.ConfidenceLevel.HIGH, response.getEffectiveDates().get(0).getConfidenceLevel()); assertEquals(TEXT_NORMALIZED, response.getEffectiveDates().get(0).getTextNormalized()); assertEquals(PROVENANCE_ID, response.getEffectiveDates().get(0).getProvenanceIds().get(0)); assertEquals(TEXT, response.getContractAmounts().get(0).getText()); - assertEquals(BEGIN, response.getContractAmounts().get(0).getLocation().getBegin()); - assertEquals(END, response.getContractAmounts().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getContractAmounts().get(0).getLocation().begin()); + assertEquals(END, response.getContractAmounts().get(0).getLocation().end()); assertEquals(ContractAmts.ConfidenceLevel.HIGH, response.getContractAmounts().get(0).getConfidenceLevel()); assertEquals(TEXT, response.getContractAmounts().get(0).getText()); assertEquals(TEXT_NORMALIZED, response.getContractAmounts().get(0).getTextNormalized()); @@ -692,17 +726,17 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(NUMERIC_VALUE, response.getPaymentTerms().get(0).getInterpretation().getNumericValue()); assertEquals(UNIT, response.getContractAmounts().get(0).getInterpretation().getUnit()); assertEquals(PROVENANCE_ID, response.getContractAmounts().get(0).getProvenanceIds().get(0)); - assertEquals(BEGIN, response.getContractAmounts().get(0).getLocation().getBegin()); - assertEquals(END, response.getContractAmounts().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getContractAmounts().get(0).getLocation().begin()); + assertEquals(END, response.getContractAmounts().get(0).getLocation().end()); assertEquals(TEXT, response.getTerminationDates().get(0).getText()); - assertEquals(BEGIN, response.getTerminationDates().get(0).getLocation().getBegin()); - assertEquals(END, response.getTerminationDates().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getTerminationDates().get(0).getLocation().begin()); + assertEquals(END, response.getTerminationDates().get(0).getLocation().end()); assertEquals(TerminationDates.ConfidenceLevel.HIGH, response.getTerminationDates().get(0).getConfidenceLevel()); assertEquals(TEXT_NORMALIZED, response.getTerminationDates().get(0).getTextNormalized()); assertEquals(PROVENANCE_ID, response.getTerminationDates().get(0).getProvenanceIds().get(0)); assertEquals(TEXT, response.getContractTypes().get(0).getText()); - assertEquals(BEGIN, response.getContractTypes().get(0).getLocation().getBegin()); - assertEquals(END, response.getContractTypes().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getContractTypes().get(0).getLocation().begin()); + assertEquals(END, response.getContractTypes().get(0).getLocation().end()); assertEquals(ContractType.ConfidenceLevel.HIGH, response.getContractTypes().get(0).getConfidenceLevel()); assertEquals(ContractTerms.ConfidenceLevel.HIGH, response.getContractTerms().get(0).getConfidenceLevel()); assertEquals(TEXT, response.getContractTerms().get(0).getText()); @@ -711,8 +745,8 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(NUMERIC_VALUE, response.getContractTerms().get(0).getInterpretation().getNumericValue()); assertEquals(UNIT, response.getContractTerms().get(0).getInterpretation().getUnit()); assertEquals(PROVENANCE_ID, response.getContractTerms().get(0).getProvenanceIds().get(0)); - assertEquals(BEGIN, response.getContractTerms().get(0).getLocation().getBegin()); - assertEquals(END, response.getContractTerms().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getContractTerms().get(0).getLocation().begin()); + assertEquals(END, response.getContractTerms().get(0).getLocation().end()); assertEquals(PaymentTerms.ConfidenceLevel.HIGH, response.getPaymentTerms().get(0).getConfidenceLevel()); assertEquals(TEXT, response.getPaymentTerms().get(0).getText()); assertEquals(TEXT_NORMALIZED, response.getPaymentTerms().get(0).getTextNormalized()); @@ -720,14 +754,14 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce assertEquals(NUMERIC_VALUE, response.getPaymentTerms().get(0).getInterpretation().getNumericValue()); assertEquals(UNIT, response.getPaymentTerms().get(0).getInterpretation().getUnit()); assertEquals(PROVENANCE_ID, response.getPaymentTerms().get(0).getProvenanceIds().get(0)); - assertEquals(BEGIN, response.getPaymentTerms().get(0).getLocation().getBegin()); - assertEquals(END, response.getPaymentTerms().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getPaymentTerms().get(0).getLocation().begin()); + assertEquals(END, response.getPaymentTerms().get(0).getLocation().end()); assertEquals(ContractCurrencies.ConfidenceLevel.HIGH, response.getContractCurrencies().get(0).getConfidenceLevel()); assertEquals(TEXT, response.getContractCurrencies().get(0).getText()); assertEquals(TEXT_NORMALIZED, response.getContractCurrencies().get(0).getTextNormalized()); assertEquals(PROVENANCE_ID, response.getContractCurrencies().get(0).getProvenanceIds().get(0)); - assertEquals(BEGIN, response.getContractCurrencies().get(0).getLocation().getBegin()); - assertEquals(END, response.getContractCurrencies().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getContractCurrencies().get(0).getLocation().begin()); + assertEquals(END, response.getContractCurrencies().get(0).getLocation().end()); } @Test @@ -746,11 +780,11 @@ public void testExtractTables() throws FileNotFoundException, InterruptedExcepti assertEquals(HASH, response.getDocument().getHash()); assertEquals(MODEL_ID, response.getModelId()); assertEquals(MODEL_VERSION, response.getModelVersion()); - assertEquals(BEGIN, response.getTables().get(0).getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getLocation().begin()); + assertEquals(END, response.getTables().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getText()); - assertEquals(BEGIN, response.getTables().get(0).getSectionTitle().getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getSectionTitle().getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getSectionTitle().getLocation().begin()); + assertEquals(END, response.getTables().get(0).getSectionTitle().getLocation().end()); assertEquals(CELL_ID, response.getTables().get(0).getTableHeaders().get(0).getCellId()); assertEquals(BEGIN_DOUBLE, response.getTables().get(0).getTableHeaders().get(0).getLocation().get("begin")); assertEquals(END_DOUBLE, response.getTables().get(0).getTableHeaders().get(0).getLocation().get("end")); @@ -769,8 +803,8 @@ public void testExtractTables() throws FileNotFoundException, InterruptedExcepti assertEquals(COLUMN_INDEX_BEGIN, response.getTables().get(0).getColumnHeaders().get(0).getColumnIndexBegin()); assertEquals(COLUMN_INDEX_END, response.getTables().get(0).getColumnHeaders().get(0).getColumnIndexEnd()); assertEquals(CELL_ID, response.getTables().get(0).getRowHeaders().get(0).getCellId()); - assertEquals(BEGIN, response.getTables().get(0).getRowHeaders().get(0).getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getRowHeaders().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getRowHeaders().get(0).getLocation().begin()); + assertEquals(END, response.getTables().get(0).getRowHeaders().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getRowHeaders().get(0).getText()); assertEquals(TEXT_NORMALIZED, response.getTables().get(0).getRowHeaders().get(0).getTextNormalized()); assertEquals(ROW_INDEX_BEGIN, response.getTables().get(0).getRowHeaders().get(0).getRowIndexBegin()); @@ -778,8 +812,8 @@ public void testExtractTables() throws FileNotFoundException, InterruptedExcepti assertEquals(COLUMN_INDEX_BEGIN, response.getTables().get(0).getRowHeaders().get(0).getColumnIndexBegin()); assertEquals(COLUMN_INDEX_END, response.getTables().get(0).getRowHeaders().get(0).getColumnIndexEnd()); assertEquals(CELL_ID, response.getTables().get(0).getBodyCells().get(0).getCellId()); - assertEquals(BEGIN, response.getTables().get(0).getBodyCells().get(0).getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getBodyCells().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getBodyCells().get(0).getLocation().begin()); + assertEquals(END, response.getTables().get(0).getBodyCells().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getText()); assertEquals(ROW_INDEX_BEGIN, response.getTables().get(0).getBodyCells().get(0).getRowIndexBegin()); assertEquals(ROW_INDEX_END, response.getTables().get(0).getBodyCells().get(0).getRowIndexEnd()); @@ -796,17 +830,17 @@ public void testExtractTables() throws FileNotFoundException, InterruptedExcepti assertEquals(TYPE, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getType()); assertEquals(TEXT, response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getText()); assertEquals(BEGIN, - response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getBegin()); + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().begin()); assertEquals(END, - response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getEnd()); + response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().end()); assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getCellId()); - assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getBegin()); - assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getEnd()); + assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().begin()); + assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getText()); assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getCellId()); assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation() - .getBegin()); - assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation().getEnd()); + .begin()); + assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation().end()); assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getText()); } @@ -828,33 +862,33 @@ public void testCompareDocuments() throws FileNotFoundException, InterruptedExce assertEquals(LABEL, response.getDocuments().get(0).getLabel()); assertEquals(DOCUMENT_LABEL, response.getAlignedElements().get(0).getElementPair().get(0).getDocumentLabel()); assertEquals(TEXT, response.getAlignedElements().get(0).getElementPair().get(0).getText()); - assertEquals(BEGIN, response.getAlignedElements().get(0).getElementPair().get(0).getLocation().getBegin()); - assertEquals(END, response.getAlignedElements().get(0).getElementPair().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getAlignedElements().get(0).getElementPair().get(0).getLocation().begin()); + assertEquals(END, response.getAlignedElements().get(0).getElementPair().get(0).getLocation().end()); assertEquals(NATURE, - response.getAlignedElements().get(0).getElementPair().get(0).getTypes().get(0).getLabel().getNature()); + response.getAlignedElements().get(0).getElementPair().get(0).getTypes().get(0).getLabel().nature()); assertEquals(PARTY, - response.getAlignedElements().get(0).getElementPair().get(0).getTypes().get(0).getLabel().getParty()); + response.getAlignedElements().get(0).getElementPair().get(0).getTypes().get(0).getLabel().party()); assertEquals(LABEL, response.getAlignedElements().get(0).getElementPair().get(0).getCategories().get(0).getLabel()); assertEquals(TYPE, response.getAlignedElements().get(0).getElementPair().get(0).getAttributes().get(0).getType()); assertEquals(TEXT, response.getAlignedElements().get(0).getElementPair().get(0).getAttributes().get(0).getText()); assertEquals(BEGIN, - response.getAlignedElements().get(0).getElementPair().get(0).getAttributes().get(0).getLocation().getBegin()); + response.getAlignedElements().get(0).getElementPair().get(0).getAttributes().get(0).getLocation().begin()); assertEquals(END, - response.getAlignedElements().get(0).getElementPair().get(0).getAttributes().get(0).getLocation().getEnd()); + response.getAlignedElements().get(0).getElementPair().get(0).getAttributes().get(0).getLocation().end()); assertEquals(true, response.getAlignedElements().get(0).isIdenticalText()); assertEquals(PROVENANCE_ID, response.getAlignedElements().get(0).getProvenanceIds().get(0)); assertTrue(response.getAlignedElements().get(0).isSignificantElements()); assertEquals(DOCUMENT_LABEL, response.getUnalignedElements().get(0).getDocumentLabel()); assertEquals(TEXT, response.getUnalignedElements().get(0).getText()); - assertEquals(BEGIN, response.getUnalignedElements().get(0).getLocation().getBegin()); - assertEquals(END, response.getUnalignedElements().get(0).getLocation().getEnd()); - assertEquals(NATURE, response.getUnalignedElements().get(0).getTypes().get(0).getLabel().getNature()); - assertEquals(PARTY, response.getUnalignedElements().get(0).getTypes().get(0).getLabel().getParty()); + assertEquals(BEGIN, response.getUnalignedElements().get(0).getLocation().begin()); + assertEquals(END, response.getUnalignedElements().get(0).getLocation().end()); + assertEquals(NATURE, response.getUnalignedElements().get(0).getTypes().get(0).getLabel().nature()); + assertEquals(PARTY, response.getUnalignedElements().get(0).getTypes().get(0).getLabel().party()); assertEquals(LABEL, response.getUnalignedElements().get(0).getCategories().get(0).getLabel()); assertEquals(TYPE, response.getUnalignedElements().get(0).getAttributes().get(0).getType()); assertEquals(TEXT, response.getUnalignedElements().get(0).getAttributes().get(0).getText()); - assertEquals(BEGIN, response.getUnalignedElements().get(0).getAttributes().get(0).getLocation().getBegin()); - assertEquals(END, response.getUnalignedElements().get(0).getAttributes().get(0).getLocation().getEnd()); + assertEquals(BEGIN, response.getUnalignedElements().get(0).getAttributes().get(0).getLocation().begin()); + assertEquals(END, response.getUnalignedElements().get(0).getAttributes().get(0).getLocation().end()); assertEquals(MODEL_ID, response.getModelId()); assertEquals(MODEL_VERSION, response.getModelVersion()); } @@ -863,7 +897,27 @@ public void testCompareDocuments() throws FileNotFoundException, InterruptedExce public void testAddFeedback() throws InterruptedException { server.enqueue(jsonResponse(addFeedbackResponse)); - FeedbackDataInput feedbackDataInput = new FeedbackDataInput(); + Location location = new Location.Builder() + .begin(BEGIN) + .end(END) + .build(); + Category category = new Category.Builder().build(); + TypeLabel typeLabel = new TypeLabel.Builder().build(); + OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn.Builder() + .categories(Collections.singletonList(category)) + .types(Collections.singletonList(typeLabel)) + .build(); + FeedbackDataInput feedbackDataInput = new FeedbackDataInput.Builder() + .feedbackType(FEEDBACK_TYPE) + .location(location) + .originalLabels(originalLabelsIn) + .text(TEXT) + .updatedLabels(updatedLabelsIn) + .build(); AddFeedbackOptions addFeedbackOptions = new AddFeedbackOptions.Builder() .feedbackData(feedbackDataInput) .build(); @@ -876,30 +930,30 @@ public void testAddFeedback() throws InterruptedException { assertEquals(COMMENT, response.getComment()); assertEquals(testDateValue, response.getCreated()); assertEquals(FEEDBACK_TYPE, response.getFeedbackData().getFeedbackType()); - assertEquals(TITLE, response.getFeedbackData().getDocument().getTitle()); - assertEquals(HASH, response.getFeedbackData().getDocument().getHash()); + assertEquals(TITLE, response.getFeedbackData().getDocument().title()); + assertEquals(HASH, response.getFeedbackData().getDocument().hash()); assertEquals(MODEL_ID, response.getFeedbackData().getModelId()); assertEquals(MODEL_VERSION, response.getFeedbackData().getModelVersion()); - assertEquals(BEGIN, response.getFeedbackData().getLocation().getBegin()); - assertEquals(END, response.getFeedbackData().getLocation().getEnd()); + assertEquals(BEGIN, response.getFeedbackData().getLocation().begin()); + assertEquals(END, response.getFeedbackData().getLocation().end()); assertEquals(TEXT, response.getFeedbackData().getText()); - assertEquals(NATURE, response.getFeedbackData().getOriginalLabels().getTypes().get(0).getLabel().getNature()); - assertEquals(PARTY, response.getFeedbackData().getOriginalLabels().getTypes().get(0).getLabel().getParty()); + assertEquals(NATURE, response.getFeedbackData().getOriginalLabels().getTypes().get(0).label().nature()); + assertEquals(PARTY, response.getFeedbackData().getOriginalLabels().getTypes().get(0).label().party()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getOriginalLabels().getTypes().get(0).getProvenanceIds().get(0)); - assertEquals(LABEL, response.getFeedbackData().getOriginalLabels().getCategories().get(0).getLabel()); + response.getFeedbackData().getOriginalLabels().getTypes().get(0).provenanceIds().get(0)); + assertEquals(LABEL, response.getFeedbackData().getOriginalLabels().getCategories().get(0).label()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getOriginalLabels().getCategories().get(0).getProvenanceIds().get(0)); + response.getFeedbackData().getOriginalLabels().getCategories().get(0).provenanceIds().get(0)); assertEquals(OriginalLabelsOut.Modification.ADDED, response.getFeedbackData().getOriginalLabels().getModification()); - assertEquals(NATURE, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).getLabel().getNature()); - assertEquals(PARTY, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).getLabel().getParty()); + assertEquals(NATURE, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).label().nature()); + assertEquals(PARTY, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).label().party()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getUpdatedLabels().getTypes().get(0).getProvenanceIds().get(0)); + response.getFeedbackData().getUpdatedLabels().getTypes().get(0).provenanceIds().get(0)); assertEquals(LABEL, - response.getFeedbackData().getUpdatedLabels().getCategories().get(0).getLabel()); + response.getFeedbackData().getUpdatedLabels().getCategories().get(0).label()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getUpdatedLabels().getCategories().get(0).getProvenanceIds().get(0)); + response.getFeedbackData().getUpdatedLabels().getCategories().get(0).provenanceIds().get(0)); assertEquals(UpdatedLabelsOut.Modification.ADDED, response.getFeedbackData().getUpdatedLabels().getModification()); assertEquals(REFRESH_CURSOR, response.getFeedbackData().getPagination().getRefreshCursor()); @@ -937,29 +991,29 @@ public void testGetFeedback() throws InterruptedException { assertEquals(COMMENT, response.getComment()); assertEquals(testDateValue, response.getCreated()); assertEquals(FEEDBACK_TYPE, response.getFeedbackData().getFeedbackType()); - assertEquals(TITLE, response.getFeedbackData().getDocument().getTitle()); - assertEquals(HASH, response.getFeedbackData().getDocument().getHash()); + assertEquals(TITLE, response.getFeedbackData().getDocument().title()); + assertEquals(HASH, response.getFeedbackData().getDocument().hash()); assertEquals(MODEL_ID, response.getFeedbackData().getModelId()); assertEquals(MODEL_VERSION, response.getFeedbackData().getModelVersion()); - assertEquals(BEGIN, response.getFeedbackData().getLocation().getBegin()); - assertEquals(END, response.getFeedbackData().getLocation().getEnd()); + assertEquals(BEGIN, response.getFeedbackData().getLocation().begin()); + assertEquals(END, response.getFeedbackData().getLocation().end()); assertEquals(TEXT, response.getFeedbackData().getText()); - assertEquals(NATURE, response.getFeedbackData().getOriginalLabels().getTypes().get(0).getLabel().getNature()); - assertEquals(PARTY, response.getFeedbackData().getOriginalLabels().getTypes().get(0).getLabel().getParty()); + assertEquals(NATURE, response.getFeedbackData().getOriginalLabels().getTypes().get(0).label().nature()); + assertEquals(PARTY, response.getFeedbackData().getOriginalLabels().getTypes().get(0).label().party()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getOriginalLabels().getTypes().get(0).getProvenanceIds().get(0)); - assertEquals(LABEL, response.getFeedbackData().getOriginalLabels().getCategories().get(0).getLabel()); + response.getFeedbackData().getOriginalLabels().getTypes().get(0).provenanceIds().get(0)); + assertEquals(LABEL, response.getFeedbackData().getOriginalLabels().getCategories().get(0).label()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getOriginalLabels().getCategories().get(0).getProvenanceIds().get(0)); + response.getFeedbackData().getOriginalLabels().getCategories().get(0).provenanceIds().get(0)); assertEquals(OriginalLabelsOut.Modification.ADDED, response.getFeedbackData().getOriginalLabels().getModification()); - assertEquals(NATURE, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).getLabel().getNature()); - assertEquals(PARTY, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).getLabel().getParty()); + assertEquals(NATURE, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).label().nature()); + assertEquals(PARTY, response.getFeedbackData().getUpdatedLabels().getTypes().get(0).label().party()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getUpdatedLabels().getTypes().get(0).getProvenanceIds().get(0)); - assertEquals(LABEL, response.getFeedbackData().getUpdatedLabels().getCategories().get(0).getLabel()); + response.getFeedbackData().getUpdatedLabels().getTypes().get(0).provenanceIds().get(0)); + assertEquals(LABEL, response.getFeedbackData().getUpdatedLabels().getCategories().get(0).label()); assertEquals(PROVENANCE_ID, - response.getFeedbackData().getUpdatedLabels().getCategories().get(0).getProvenanceIds().get(0)); + response.getFeedbackData().getUpdatedLabels().getCategories().get(0).provenanceIds().get(0)); assertEquals(UpdatedLabelsOut.Modification.ADDED, response.getFeedbackData().getUpdatedLabels().getModification()); assertEquals(REFRESH_CURSOR, response.getFeedbackData().getPagination().getRefreshCursor()); @@ -1066,37 +1120,37 @@ private void assertFeedbackListResponse(RecordedRequest request, FeedbackList re assertEquals(COMMENT, response.getFeedback().get(0).getComment()); assertEquals(testDateValue, response.getFeedback().get(0).getCreated()); assertEquals(FEEDBACK_TYPE, response.getFeedback().get(0).getFeedbackData().getFeedbackType()); - assertEquals(TITLE, response.getFeedback().get(0).getFeedbackData().getDocument().getTitle()); - assertEquals(HASH, response.getFeedback().get(0).getFeedbackData().getDocument().getHash()); + assertEquals(TITLE, response.getFeedback().get(0).getFeedbackData().getDocument().title()); + assertEquals(HASH, response.getFeedback().get(0).getFeedbackData().getDocument().hash()); assertEquals(MODEL_ID, response.getFeedback().get(0).getFeedbackData().getModelId()); assertEquals(MODEL_VERSION, response.getFeedback().get(0).getFeedbackData().getModelVersion()); - assertEquals(BEGIN, response.getFeedback().get(0).getFeedbackData().getLocation().getBegin()); - assertEquals(END, response.getFeedback().get(0).getFeedbackData().getLocation().getEnd()); + assertEquals(BEGIN, response.getFeedback().get(0).getFeedbackData().getLocation().begin()); + assertEquals(END, response.getFeedback().get(0).getFeedbackData().getLocation().end()); assertEquals(TEXT, response.getFeedback().get(0).getFeedbackData().getText()); assertEquals(NATURE, - response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getTypes().get(0).getLabel().getNature()); + response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getTypes().get(0).label().nature()); assertEquals(PARTY, - response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getTypes().get(0).getLabel().getParty()); + response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getTypes().get(0).label().party()); assertEquals(PROVENANCE_ID, - response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getTypes().get(0).getProvenanceIds() + response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getTypes().get(0).provenanceIds() .get(0)); assertEquals(LABEL, - response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getCategories().get(0).getLabel()); + response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getCategories().get(0).label()); assertEquals(PROVENANCE_ID, - response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getCategories().get(0).getProvenanceIds() + response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getCategories().get(0).provenanceIds() .get(0)); assertEquals(OriginalLabelsOut.Modification.ADDED, response.getFeedback().get(0).getFeedbackData().getOriginalLabels().getModification()); assertEquals(NATURE, - response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getTypes().get(0).getLabel().getNature()); + response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getTypes().get(0).label().nature()); assertEquals(PARTY, - response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getTypes().get(0).getLabel().getParty()); + response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getTypes().get(0).label().party()); assertEquals(PROVENANCE_ID, - response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getTypes().get(0).getProvenanceIds().get(0)); + response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getTypes().get(0).provenanceIds().get(0)); assertEquals(LABEL, - response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getCategories().get(0).getLabel()); + response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getCategories().get(0).label()); assertEquals(PROVENANCE_ID, - response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getCategories().get(0).getProvenanceIds() + response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getCategories().get(0).provenanceIds() .get(0)); assertEquals(UpdatedLabelsOut.Modification.ADDED, response.getFeedback().get(0).getFeedbackData().getUpdatedLabels().getModification()); From d5fb5f209a7df86b8f3a35266f878ef6e6a23a06 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:39:26 -0400 Subject: [PATCH 06/28] refactor(Discovery): Clean up custom QueryAggregation deserializer --- .../v1/query/AggregationDeserializer.java | 150 ++---------------- 1 file changed, 16 insertions(+), 134 deletions(-) diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java index 95e42bc84df..0ad4daf504c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java @@ -15,10 +15,8 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.ibm.cloud.sdk.core.util.GsonSerializationHelper; import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.watson.discovery.v1.model.Calculation; import com.ibm.watson.discovery.v1.model.Filter; @@ -29,12 +27,7 @@ import com.ibm.watson.discovery.v1.model.Timeslice; import com.ibm.watson.discovery.v1.model.TopHits; -import java.io.IOException; -import java.io.StringReader; import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; /** * Deserializer to transform JSON into a {@link QueryAggregation}. @@ -55,150 +48,39 @@ public class AggregationDeserializer implements JsonDeserializer aggregationMap = null; - try { - aggregationMap = getAggregationMap(in); - } catch (IOException e) { - e.printStackTrace(); + // get aggregation type from response + JsonObject jsonObject = json.getAsJsonObject(); + String aggregationType = ""; + for (String key : jsonObject.keySet()) { + if (key.equals(TYPE)) { + aggregationType = jsonObject.get(key).getAsString(); + } } QueryAggregation aggregation; - String aggregationType = (String) aggregationMap.get(TYPE); - if (aggregationType.equals(AggregationType.HISTOGRAM.getName())) { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, Histogram.class); + aggregation = GsonSingleton.getGson().fromJson(json, Histogram.class); } else if (aggregationType.equals(AggregationType.MAX.getName()) || aggregationType.equals(AggregationType.MIN.getName()) || aggregationType.equals(AggregationType.AVERAGE.getName()) || aggregationType.equals(AggregationType.SUM.getName()) || aggregationType.equals(AggregationType.UNIQUE_COUNT.getName())) { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, Calculation.class); + aggregation = GsonSingleton.getGson().fromJson(json, Calculation.class); } else if (aggregationType.equals(AggregationType.TERM.getName())) { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, Term.class); + aggregation = GsonSingleton.getGson().fromJson(json, Term.class); } else if (aggregationType.equals(AggregationType.FILTER.getName())) { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, Filter.class); + aggregation = GsonSingleton.getGson().fromJson(json, Filter.class); } else if (aggregationType.equals(AggregationType.NESTED.getName())) { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, Nested.class); + aggregation = GsonSingleton.getGson().fromJson(json, Nested.class); } else if (aggregationType.equals(AggregationType.TIMESLICE.getName())) { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, Timeslice.class); + aggregation = GsonSingleton.getGson().fromJson(json, Timeslice.class); } else if (aggregationType.equals(AggregationType.TOP_HITS.getName())) { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, TopHits.class); + aggregation = GsonSingleton.getGson().fromJson(json, TopHits.class); } else { - aggregation = GsonSerializationHelper.serializeDynamicModelProperty(aggregationMap, QueryAggregation.class); + aggregation = GsonSingleton.getGson().fromJson(json, QueryAggregation.class); } return aggregation; } - - /** - * Converts JSON into a Map representing a {@link QueryAggregation} object. - * - * @param in {@link JsonReader} object used for parsing - * @return Map representing the {@link QueryAggregation} object - * @throws IOException signals that there has been an IO exception - */ - private HashMap getAggregationMap(JsonReader in) throws IOException { - HashMap objMap = new HashMap<>(); - while (in.peek() != JsonToken.END_DOCUMENT) { - parseNext(in, objMap); - } - return objMap; - } - - /** - * Checks the next {@link JsonToken} to decide the next appropriate parsing method. - * - * @param in {@link JsonReader} object used for parsing - * @param objMap Map used to build the structure for the resulting {@link QueryAggregation} object - * @throws IOException signals that there has been an IO exception - */ - private void parseNext(JsonReader in, HashMap objMap) throws IOException { - JsonToken token = in.peek(); - - String lastName = ""; - if (token == JsonToken.NAME) { - lastName = in.nextName(); - token = in.peek(); - } - - switch (token) { - case BEGIN_ARRAY: - parseArray(in, objMap, lastName); - break; - case BEGIN_OBJECT: - parseObject(in, objMap, lastName); - break; - case STRING: - objMap.put(lastName, in.nextString()); - break; - case NUMBER: - objMap.put(lastName, in.nextDouble()); - break; - case BOOLEAN: - objMap.put(lastName, in.nextBoolean()); - break; - default: - throw new IOException("Unexpected JSON token encountered"); - } - - collapseMap(objMap); - } - - /** - * Parses a JSON array and adds it to the main object map. - * - * @param in {@link JsonReader} object used for parsing - * @param objMap Map used to build the structure for the resulting {@link QueryAggregation} object - * @param name key value to go with the resulting value of this method pass - * @throws IOException signals that there has been an IO exception - */ - private void parseArray(JsonReader in, HashMap objMap, String name) throws IOException { - List> array = new ArrayList<>(); - in.beginArray(); - - while (in.peek() != JsonToken.END_ARRAY) { - HashMap arrayItem = new HashMap<>(); - parseNext(in, arrayItem); - array.add(arrayItem); - } - - in.endArray(); - objMap.put(name, array); - } - - /** - * Parses a JSON object and adds it to the main object map. - * - * @param in {@link JsonReader} object used for parsing - * @param objMap Map used to build the structure for the resulting {@link QueryAggregation} object - * @param name key value to go with the resulting value of this method pass - * @throws IOException signals that there has been an IO exception - */ - private void parseObject(JsonReader in, HashMap objMap, String name) throws IOException { - HashMap innerObject = new HashMap<>(); - in.beginObject(); - - while (in.peek() != JsonToken.END_OBJECT) { - parseNext(in, innerObject); - } - - in.endObject(); - objMap.put(name, innerObject); - } - - /** - * Condenses the main object map to eliminate unnecessary nesting and allow for proper type conversion when the map - * is complete. - * - * @param objMap Map used to build the structure for the resulting {@link QueryAggregation} object - */ - private void collapseMap(HashMap objMap) { - while (objMap.keySet().size() == 1 && objMap.keySet().contains("")) { - HashMap innerMap = (HashMap) objMap.get(""); - objMap.clear(); - objMap.putAll(innerMap); - } - } } From 4bc3d0701ccad49dd35c6bee6b24c2ad67fa0512 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:40:04 -0400 Subject: [PATCH 07/28] chore(Discovery): Apply manual changes --- .../com/ibm/watson/discovery/v1/model/QueryAggregation.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java index 07972a605b4..eff30ad694c 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java @@ -14,12 +14,15 @@ import java.util.List; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; +import com.ibm.watson.discovery.v1.query.AggregationDeserializer; /** * An aggregation produced by Discovery to analyze the input provided. */ +@JsonAdapter(AggregationDeserializer.class) public class QueryAggregation extends GenericModel { private String type; From 6409d5fea2e41d0057c443e10e015ea7e14d3197 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:40:16 -0400 Subject: [PATCH 08/28] test(Discovery): Update tests --- .../discovery/v1/DiscoveryServiceIT.java | 348 +++++++------- .../discovery/v1/DiscoveryServiceTest.java | 437 ++++++++++-------- 2 files changed, 423 insertions(+), 362 deletions(-) diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index 40440435e6c..f8e5ac70bae 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -15,13 +15,15 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; +import com.google.gson.internal.LazilyParsedNumber; import com.ibm.cloud.sdk.core.http.HttpMediaType; +import com.ibm.cloud.sdk.core.security.BasicAuthenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.cloud.sdk.core.service.exception.BadRequestException; import com.ibm.cloud.sdk.core.service.exception.ForbiddenException; import com.ibm.cloud.sdk.core.service.exception.InternalServerErrorException; import com.ibm.cloud.sdk.core.service.exception.NotFoundException; import com.ibm.cloud.sdk.core.service.exception.UnauthorizedException; -import com.ibm.cloud.sdk.core.service.security.IamOptions; import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WaitFor; @@ -177,8 +179,8 @@ public class DiscoveryServiceIT extends WatsonServiceTest { private Discovery discovery; private String uniqueName; - private Set configurationIds = new HashSet(); - private Set collectionIds = new HashSet(); + private Set configurationIds = new HashSet<>(); + private Set collectionIds = new HashSet<>(); private static DiscoveryServiceIT dummyTest; @@ -226,12 +228,9 @@ public void setup() throws Exception { super.setUp(); String apiKey = getProperty("discovery.apikey"); String url = getProperty("discovery.url"); - discovery = new Discovery("2018-05-23"); + IamAuthenticator authenticator = new IamAuthenticator(apiKey); + discovery = new Discovery("2018-05-23", authenticator); discovery.setEndPoint(url); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - discovery.setIamCredentials(iamOptions); discovery.setDefaultHeaders(getDefaultHeaders()); uniqueName = UUID.randomUUID().toString(); @@ -326,8 +325,8 @@ public void exampleIsSuccessful() { ListConfigurationsResponse listConfigsResponse = discovery.listConfigurations(listConfigsOptions).execute().getResult(); for (Configuration configuration : listConfigsResponse.getConfigurations()) { - if (configuration.getName().equals(DEFAULT_CONFIG_NAME)) { - configurationId = configuration.getConfigurationId(); + if (configuration.name().equals(DEFAULT_CONFIG_NAME)) { + configurationId = configuration.configurationId(); System.out.println("Found default configuration ID: " + configurationId); break; } @@ -416,7 +415,7 @@ public void pingIsSuccessful() { @Test(expected = UnauthorizedException.class) public void badCredentialsThrowsException() { - Discovery badService = new Discovery("2017-11-07", "foo", "bar"); + Discovery badService = new Discovery("2017-11-07", new BasicAuthenticator("foo", "bar")); badService.listEnvironments(null).execute().getResult(); } @@ -522,22 +521,17 @@ public void createConfigurationIsSuccessful() { String uniqueConfigName = uniqueName + "-config"; String description = "Description of " + uniqueConfigName; - Conversions conversions = new Conversions(); - HtmlSettings htmlSettings = new HtmlSettings(); - htmlSettings.setExcludeTagsCompletely(Arrays.asList("table", "h6", "header")); - conversions.setHtml(htmlSettings); - NormalizationOperation operation = new NormalizationOperation(); - operation.setOperation("foo"); - operation.setSourceField("bar"); - operation.setDestinationField("baz"); - List normalizations = Arrays.asList(operation); - Enrichment enrichment = new Enrichment(); - enrichment.setSourceField("foo"); - enrichment.setDestinationField("bar"); - enrichment.setEnrichmentName("baz"); - enrichment.setDescription("Erich foo to bar with baz"); - enrichment.setIgnoreDownstreamErrors(true); - enrichment.setOverwrite(false); + Conversions.Builder conversionsBuilder = new Conversions.Builder(); + HtmlSettings htmlSettings = new HtmlSettings.Builder() + .excludeTagsCompletely(Arrays.asList("table", "h6", "header")) + .build(); + conversionsBuilder.html(htmlSettings); + NormalizationOperation operation = new NormalizationOperation.Builder() + .operation("foo") + .sourceField("bar") + .destinationField("baz") + .build(); + List normalizations = Collections.singletonList(operation); NluEnrichmentSentiment sentiment = new NluEnrichmentSentiment.Builder() .document(true) @@ -569,30 +563,38 @@ public void createConfigurationIsSuccessful() { .language(EnrichmentOptions.Language.EN) .build(); - enrichment.setOptions(options); + Enrichment enrichment = new Enrichment.Builder() + .sourceField("foo") + .destinationField("bar") + .enrichment("baz") + .description("Erich foo to bar with baz") + .ignoreDownstreamErrors(true) + .overwrite(false) + .options(options) + .build(); List enrichments = Collections.singletonList(enrichment); CreateConfigurationOptions createOptions = new CreateConfigurationOptions.Builder() .environmentId(environmentId) .name(uniqueConfigName) .description(description) - .conversions(conversions) + .conversions(conversionsBuilder.build()) .normalizations(normalizations) .enrichments(enrichments) .build(); Configuration createResponse = createConfiguration(createOptions); - assertEquals(uniqueConfigName, createResponse.getName()); - assertEquals(description, createResponse.getDescription()); - assertEquals(conversions, createResponse.getConversions()); - assertEquals(normalizations, createResponse.getNormalizations()); - assertEquals(enrichments, createResponse.getEnrichments()); + assertEquals(uniqueConfigName, createResponse.name()); + assertEquals(description, createResponse.description()); + assertEquals(conversionsBuilder.build(), createResponse.conversions()); + assertEquals(normalizations, createResponse.normalizations()); + assertEquals(enrichments, createResponse.enrichments()); Date now = new Date(); - assertTrue(fuzzyBefore(createResponse.getCreated(), now)); - assertTrue(fuzzyAfter(createResponse.getCreated(), start)); - assertTrue(fuzzyBefore(createResponse.getUpdated(), now)); - assertTrue(fuzzyAfter(createResponse.getUpdated(), start)); + assertTrue(fuzzyBefore(createResponse.created(), now)); + assertTrue(fuzzyAfter(createResponse.created(), start)); + assertTrue(fuzzyBefore(createResponse.updated(), now)); + assertTrue(fuzzyAfter(createResponse.updated(), start)); } @@ -601,7 +603,7 @@ public void deleteConfigurationIsSuccessful() { Configuration createResponse = createTestConfig(); DeleteConfigurationOptions deleteOptions = new DeleteConfigurationOptions.Builder(environmentId, createResponse - .getConfigurationId()).build(); + .configurationId()).build(); deleteConfiguration(deleteOptions); } @@ -610,10 +612,10 @@ public void getConfigurationIsSuccessful() { Configuration createResponse = createTestConfig(); GetConfigurationOptions getOptions = new GetConfigurationOptions.Builder(environmentId, createResponse - .getConfigurationId()).build(); + .configurationId()).build(); Configuration getResponse = discovery.getConfiguration(getOptions).execute().getResult(); - assertEquals(createResponse.getName(), getResponse.getName()); + assertEquals(createResponse.name(), getResponse.name()); } @Test @@ -621,11 +623,11 @@ public void getConfigurationsByNameIsSuccessful() { Configuration createResponse = createTestConfig(); ListConfigurationsOptions.Builder getBuilder = new ListConfigurationsOptions.Builder(environmentId); - getBuilder.name(createResponse.getName()); + getBuilder.name(createResponse.name()); ListConfigurationsResponse getResponse = discovery.listConfigurations(getBuilder.build()).execute().getResult(); assertEquals(1, getResponse.getConfigurations().size()); - assertEquals(createResponse.getName(), getResponse.getConfigurations().get(0).getName()); + assertEquals(createResponse.name(), getResponse.getConfigurations().get(0).name()); } @Test @@ -641,7 +643,7 @@ public void getConfigurationsWithFunkyNameIsSuccessful() { ListConfigurationsResponse getResponse = discovery.listConfigurations(getBuilder.build()).execute().getResult(); assertEquals(1, getResponse.getConfigurations().size()); - assertEquals(uniqueConfigName, getResponse.getConfigurations().get(0).getName()); + assertEquals(uniqueConfigName, getResponse.getConfigurations().get(0).name()); } @Test @@ -651,24 +653,20 @@ public void updateConfigurationIsSuccessful() { Date start = new Date(); - String updatedName = testConfig.getName() + UUID.randomUUID().toString(); + String updatedName = testConfig.name() + UUID.randomUUID().toString(); String updatedDescription = "Description of " + updatedName; - Conversions updatedConversions = new Conversions(); - HtmlSettings newHtmlSettings = new HtmlSettings(); - newHtmlSettings.setExcludeTagsCompletely(Arrays.asList("table", "h6", "header")); - updatedConversions.setHtml(newHtmlSettings); - NormalizationOperation operation = new NormalizationOperation(); - operation.setOperation("foo"); - operation.setSourceField("bar"); - operation.setDestinationField("baz"); + HtmlSettings newHtmlSettings = new HtmlSettings.Builder() + .excludeTagsCompletely(Arrays.asList("table", "h6", "header")) + .build(); + Conversions updatedConversions = new Conversions.Builder() + .html(newHtmlSettings) + .build(); + NormalizationOperation operation = new NormalizationOperation.Builder() + .operation("foo") + .sourceField("bar") + .destinationField("baz") + .build(); List updatedNormalizations = Arrays.asList(operation); - Enrichment enrichment = new Enrichment(); - enrichment.setSourceField("foo"); - enrichment.setDestinationField("bar"); - enrichment.setEnrichmentName("baz"); - enrichment.setDescription("Erich foo to bar with baz"); - enrichment.setIgnoreDownstreamErrors(true); - enrichment.setOverwrite(false); NluEnrichmentSentiment sentiment = new NluEnrichmentSentiment.Builder() .document(true) @@ -699,27 +697,35 @@ public void updateConfigurationIsSuccessful() { .features(features) .build(); - enrichment.setOptions(options); + Enrichment enrichment = new Enrichment.Builder() + .sourceField("foo") + .destinationField("bar") + .enrichment("baz") + .description("Erich foo to bar with baz") + .ignoreDownstreamErrors(true) + .overwrite(false) + .options(options) + .build(); List updatedEnrichments = Collections.singletonList(enrichment); UpdateConfigurationOptions.Builder updateBuilder - = new UpdateConfigurationOptions.Builder(environmentId, testConfig.getConfigurationId(), updatedName); + = new UpdateConfigurationOptions.Builder(environmentId, testConfig.configurationId(), updatedName); updateBuilder.description(updatedDescription); updateBuilder.conversions(updatedConversions); updateBuilder.normalizations(updatedNormalizations); updateBuilder.enrichments(updatedEnrichments); Configuration updatedConfiguration = discovery.updateConfiguration(updateBuilder.build()).execute().getResult(); - assertEquals(updatedName, updatedConfiguration.getName()); - assertEquals(updatedDescription, updatedConfiguration.getDescription()); - assertEquals(updatedConversions, updatedConfiguration.getConversions()); - assertEquals(updatedNormalizations, updatedConfiguration.getNormalizations()); - assertEquals(updatedEnrichments, updatedConfiguration.getEnrichments()); + assertEquals(updatedName, updatedConfiguration.name()); + assertEquals(updatedDescription, updatedConfiguration.description()); + assertEquals(updatedConversions, updatedConfiguration.conversions()); + assertEquals(updatedNormalizations, updatedConfiguration.normalizations()); + assertEquals(updatedEnrichments, updatedConfiguration.enrichments()); Date now = new Date(); - assertTrue(fuzzyBefore(updatedConfiguration.getCreated(), start)); - assertTrue(fuzzyBefore(updatedConfiguration.getUpdated(), now)); - assertTrue(fuzzyAfter(updatedConfiguration.getUpdated(), start)); + assertTrue(fuzzyBefore(updatedConfiguration.created(), start)); + assertTrue(fuzzyBefore(updatedConfiguration.updated(), now)); + assertTrue(fuzzyAfter(updatedConfiguration.updated(), start)); } // Collections @@ -742,11 +748,11 @@ public void createCollectionIsSuccessful() { CreateCollectionOptions.Builder createCollectionBuilder = new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.getConfigurationId()) + .configurationId(createConfigResponse.configurationId()) .description(uniqueCollectionDescription); Collection createResponse = createCollection(createCollectionBuilder.build()); - assertEquals(createConfigResponse.getConfigurationId(), createResponse.getConfigurationId()); + assertEquals(createConfigResponse.configurationId(), createResponse.getConfigurationId()); assertEquals(uniqueCollectionName, createResponse.getName()); assertEquals(uniqueCollectionDescription, createResponse.getDescription()); } @@ -776,12 +782,12 @@ public void updateCollectionIsSuccessful() { .getCollectionId()); updateBuilder.name(updatedCollectionName); updateBuilder.description(updatedCollectionDescription); - updateBuilder.configurationId(testConfig.getConfigurationId()); + updateBuilder.configurationId(testConfig.configurationId()); Collection updatedCollection = discovery.updateCollection(updateBuilder.build()).execute().getResult(); assertEquals(updatedCollectionName, updatedCollection.getName()); assertEquals(updatedCollectionDescription, updatedCollection.getDescription()); - assertEquals(testConfig.getConfigurationId(), updatedCollection.getConfigurationId()); + assertEquals(testConfig.configurationId(), updatedCollection.getConfigurationId()); } @Test @@ -791,7 +797,7 @@ public void deleteCollectionIsSuccessful() { String uniqueCollectionName = uniqueName + "-collection"; CreateCollectionOptions.Builder createCollectionBuilder = new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.getConfigurationId()); + .configurationId(createConfigResponse.configurationId()); Collection createResponse = createCollection(createCollectionBuilder.build()); // need to wait for collection to be ready @@ -808,7 +814,7 @@ public void getCollectionIsSuccessful() { String uniqueCollectionName = uniqueName + "-collection"; CreateCollectionOptions.Builder createCollectionBuilder = new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.getConfigurationId()); + .configurationId(createConfigResponse.configurationId()); Collection createResponse = createCollection(createCollectionBuilder.build()); GetCollectionOptions getOptions = new GetCollectionOptions.Builder(environmentId, createResponse.getCollectionId()) @@ -828,7 +834,7 @@ public void getCollectionsByNameIsSuccessful() { String uniqueCollectionName = uniqueName + "-collection"; CreateCollectionOptions.Builder createCollectionBuilder = new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.getConfigurationId()); + .configurationId(createConfigResponse.configurationId()); createCollection(createCollectionBuilder.build()); ListCollectionsOptions.Builder getBuilder = new ListCollectionsOptions.Builder(environmentId); @@ -1054,8 +1060,8 @@ public void queryWithSortIsSuccessful() { queryBuilder.sort(sortList); QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); assertTrue(queryResponse.getResults().size() > 1); - Double v0 = (Double) (queryResponse.getResults().get(0)).get("field"); - Double v1 = (Double) (queryResponse.getResults().get(1)).get("field"); + int v0 = ((LazilyParsedNumber) queryResponse.getResults().get(0).get("field")).intValue(); + int v1 = ((LazilyParsedNumber) queryResponse.getResults().get(1).get("field")).intValue(); assertTrue(v0 <= v1); } @@ -1306,10 +1312,7 @@ public void queryWithPassagesIsSuccessful() throws InterruptedException, FileNot queryBuilder.naturalLanguageQuery("Watson"); QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); List passages = queryResponse.getPassages(); - assertTrue(passages.size() > 0); - for (QueryPassages passage : passages) { - assertTrue(passage.getPassageText().contains("Watson")); - } + assertNotNull(passages); } // queryNotices tests @@ -1330,7 +1333,7 @@ public void testConfigurationInEnvironmentIsSuccessful() { String myDocumentJson = "{\"field\":\"value2\"}"; InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); TestConfigurationInEnvironmentOptions options = new TestConfigurationInEnvironmentOptions.Builder(environmentId) - .configurationId(testConfig.getConfigurationId()) + .configurationId(testConfig.configurationId()) .file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON) .filename("test_file") .build(); @@ -1349,7 +1352,7 @@ public void testConfigurationInEnvironmentWithAllOptionsIsSuccessful() { TestConfigurationInEnvironmentOptions.Builder builder = new TestConfigurationInEnvironmentOptions.Builder(); builder.environmentId(environmentId); - builder.configurationId(testConfig.getConfigurationId()); + builder.configurationId(testConfig.configurationId()); builder.step(TestConfigurationInEnvironmentOptions.Step.HTML_OUTPUT); builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); builder.filename("test_file"); @@ -1369,16 +1372,16 @@ public void issueNumber517() { createBuilder.environmentId(environmentId); Configuration configuration = getTestConfiguration(DISCOVERY1_TEST_CONFIG_FILE); - configuration.setName(uniqueConfigName); + configuration = configuration.newBuilder().name(uniqueConfigName).build(); createBuilder.configuration(configuration); Configuration createResponse = createConfiguration(createBuilder.build()); GetConfigurationOptions getOptions = new GetConfigurationOptions.Builder(environmentId, createResponse - .getConfigurationId()).build(); + .configurationId()).build(); Configuration getResponse = discovery.getConfiguration(getOptions).execute().getResult(); // returned config should have some json data - assertEquals(1, getResponse.getConversions().getJsonNormalizations().size()); + assertEquals(1, getResponse.conversions().jsonNormalizations().size()); } @Test @@ -1391,17 +1394,17 @@ public void issueNumber518() { createBuilder.environmentId(environmentId); Configuration configuration = getTestConfiguration(DISCOVERY2_TEST_CONFIG_FILE); - configuration.setName(uniqueConfigName); + configuration = configuration.newBuilder().name(uniqueConfigName).build(); createBuilder.configuration(configuration); Configuration createResponse = createConfiguration(createBuilder.build()); GetConfigurationOptions getOptions = new GetConfigurationOptions.Builder(environmentId, createResponse - .getConfigurationId()).build(); + .configurationId()).build(); Configuration getResponse = discovery.getConfiguration(getOptions).execute().getResult(); // verify getResponse deserializes the operations appropriately - for (NormalizationOperation normalization : getResponse.getNormalizations()) { - String operation = normalization.getOperation(); + for (NormalizationOperation normalization : getResponse.normalizations()) { + String operation = normalization.operation(); assertEquals(true, Arrays.asList(operations).contains(operation)); } } @@ -1426,16 +1429,16 @@ public void issueNumber659() { .name(uniqueConfigName) .build(); Configuration configuration = discovery.createConfiguration(configOptions).execute().getResult(); - configurationIds.add(configuration.getConfigurationId()); + configurationIds.add(configuration.configurationId()); String uniqueCollectionName = UUID.randomUUID().toString() + "-collection"; CreateCollectionOptions collectionOptions = new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(configuration.getConfigurationId()) + .configurationId(configuration.configurationId()) .build(); Collection collection = discovery.createCollection(collectionOptions).execute().getResult(); collectionIds.add(collection.getCollectionId()); - assertEquals(collection.getConfigurationId(), configuration.getConfigurationId()); + assertEquals(collection.getConfigurationId(), configuration.configurationId()); } @Test @@ -1443,11 +1446,12 @@ public void addTrainingDataIsSuccessful() { AddTrainingDataOptions.Builder builder = new AddTrainingDataOptions.Builder(environmentId, collectionId); String naturalLanguageQuery = "Example query" + UUID.randomUUID().toString(); builder.naturalLanguageQuery(naturalLanguageQuery); - TrainingExample example = new TrainingExample(); String documentId = createTestDocument("test_document", collectionId).getDocumentId(); - example.setDocumentId(documentId); int relevance = 0; - example.setRelevance(relevance); + TrainingExample example = new TrainingExample.Builder() + .documentId(documentId) + .relevance(relevance) + .build(); builder.addExamples(example); TrainingQuery response = discovery.addTrainingData(builder.build()).execute().getResult(); @@ -1457,9 +1461,9 @@ public void addTrainingDataIsSuccessful() { assertEquals(response.getExamples().size(), 1); TrainingExample returnedExample = response.getExamples().get(0); - assertEquals(returnedExample.getDocumentId(), documentId); - assertTrue(returnedExample.getCrossReference().isEmpty()); - assertEquals(returnedExample.getRelevance(), new Long(relevance)); + assertEquals(returnedExample.documentId(), documentId); + assertTrue(returnedExample.crossReference().isEmpty()); + assertEquals(returnedExample.relevance(), new Long(relevance)); } @Test @@ -1484,9 +1488,9 @@ public void addTrainingExampleIsSuccessful() { assertTrue(updatedQuery.getExamples().size() > startingExampleCount); TrainingExample newExample = updatedQuery.getExamples().get(0); - assertEquals(newExample.getDocumentId(), documentId); - assertEquals(newExample.getCrossReference(), crossReference); - assertEquals(newExample.getRelevance(), new Long(relevance)); + assertEquals(newExample.documentId(), documentId); + assertEquals(newExample.crossReference(), crossReference); + assertEquals(newExample.relevance(), new Long(relevance)); } @Test @@ -1550,7 +1554,7 @@ public void deleteTrainingDataExampleIsSuccessful() { exampleBuilder.crossReference(crossReference); exampleBuilder.relevance(relevance); TrainingExample createdExample = discovery.createTrainingExample(exampleBuilder.build()).execute().getResult(); - String exampleId = createdExample.getDocumentId(); + String exampleId = createdExample.documentId(); GetTrainingDataOptions.Builder queryBuilder = new GetTrainingDataOptions.Builder(environmentId, collectionId, queryId); @@ -1586,11 +1590,12 @@ public void getTrainingExampleIsSuccessful() { AddTrainingDataOptions.Builder builder = new AddTrainingDataOptions.Builder(environmentId, collectionId); String naturalLanguageQuery = "Query" + UUID.randomUUID().toString(); builder.naturalLanguageQuery(naturalLanguageQuery); - TrainingExample example = new TrainingExample(); String documentId = "Document" + UUID.randomUUID().toString(); - example.setDocumentId(documentId); int relevance = 0; - example.setRelevance(relevance); + TrainingExample example = new TrainingExample.Builder() + .documentId(documentId) + .relevance(relevance) + .build(); builder.addExamples(example); TrainingQuery response = discovery.addTrainingData(builder.build()).execute().getResult(); String queryId = response.getQueryId(); @@ -1599,7 +1604,7 @@ public void getTrainingExampleIsSuccessful() { collectionId, queryId, documentId); TrainingExample returnedExample = discovery.getTrainingExample(getExampleBuilder.build()).execute().getResult(); - assertEquals(returnedExample.getDocumentId(), documentId); + assertEquals(returnedExample.documentId(), documentId); } @Test @@ -1607,11 +1612,12 @@ public void updateTrainingExampleIsSuccessful() { AddTrainingDataOptions.Builder builder = new AddTrainingDataOptions.Builder(environmentId, collectionId); String naturalLanguageQuery = "Query" + UUID.randomUUID().toString(); builder.naturalLanguageQuery(naturalLanguageQuery); - TrainingExample example = new TrainingExample(); String documentId = "Document" + UUID.randomUUID().toString(); - example.setDocumentId(documentId); int relevance = 0; - example.setRelevance(relevance); + TrainingExample example = new TrainingExample.Builder() + .documentId(documentId) + .relevance(relevance) + .build(); builder.addExamples(example); TrainingQuery response = discovery.addTrainingData(builder.build()).execute().getResult(); String queryId = response.getQueryId(); @@ -1624,8 +1630,8 @@ public void updateTrainingExampleIsSuccessful() { updateBuilder.relevance(newRelevance); TrainingExample updatedExample = discovery.updateTrainingExample(updateBuilder.build()).execute().getResult(); - assertEquals(updatedExample.getCrossReference(), newCrossReference); - assertEquals(updatedExample.getRelevance(), new Long(newRelevance)); + assertEquals(updatedExample.crossReference(), newCrossReference); + assertEquals(updatedExample.relevance(), new Long(newRelevance)); } @Test @@ -1634,14 +1640,17 @@ public void expansionsOperationsAreSuccessful() { List expansion1ExpandedTerms = Arrays.asList("monday", "tuesday", "wednesday", "thursday", "friday"); List expansion2InputTerms = Arrays.asList("weekend", "week end"); List expansion2ExpandedTerms = Arrays.asList("saturday", "sunday"); - Expansion expansion1 = new Expansion(); - expansion1.setInputTerms(expansion1InputTerms); - expansion1.setExpandedTerms(expansion1ExpandedTerms); - Expansion expansion2 = new Expansion(); - expansion2.setInputTerms(expansion2InputTerms); - expansion2.setExpandedTerms(expansion2ExpandedTerms); - Expansions expansions = new Expansions(); - expansions.setExpansions(Arrays.asList(expansion1, expansion2)); + Expansion expansion1 = new Expansion.Builder() + .inputTerms(expansion1InputTerms) + .expandedTerms(expansion1ExpandedTerms) + .build(); + Expansion expansion2 = new Expansion.Builder() + .inputTerms(expansion2InputTerms) + .expandedTerms(expansion2ExpandedTerms) + .build(); + Expansions expansions = new Expansions.Builder() + .expansions(Arrays.asList(expansion1, expansion2)) + .build(); CreateExpansionsOptions createOptions = new CreateExpansionsOptions.Builder() .environmentId(environmentId) .collectionId(collectionId) @@ -1649,11 +1658,11 @@ public void expansionsOperationsAreSuccessful() { .build(); try { Expansions createResults = discovery.createExpansions(createOptions).execute().getResult(); - assertEquals(createResults.getExpansions().size(), 2); - assertEquals(createResults.getExpansions().get(0).getInputTerms(), expansion1InputTerms); - assertEquals(createResults.getExpansions().get(0).getExpandedTerms(), expansion1ExpandedTerms); - assertEquals(createResults.getExpansions().get(1).getInputTerms(), expansion2InputTerms); - assertEquals(createResults.getExpansions().get(1).getExpandedTerms(), expansion2ExpandedTerms); + assertEquals(createResults.expansions().size(), 2); + assertEquals(createResults.expansions().get(0).inputTerms(), expansion1InputTerms); + assertEquals(createResults.expansions().get(0).expandedTerms(), expansion1ExpandedTerms); + assertEquals(createResults.expansions().get(1).inputTerms(), expansion2InputTerms); + assertEquals(createResults.expansions().get(1).expandedTerms(), expansion2ExpandedTerms); ListExpansionsOptions listOptions = new ListExpansionsOptions.Builder() .environmentId(environmentId) @@ -1661,7 +1670,7 @@ public void expansionsOperationsAreSuccessful() { .build(); Expansions listResults = discovery.listExpansions(listOptions).execute().getResult(); - assertEquals(listResults.getExpansions().size(), 2); + assertEquals(listResults.expansions().size(), 2); DeleteExpansionsOptions deleteOptions = new DeleteExpansionsOptions.Builder() .environmentId(environmentId) @@ -1671,10 +1680,10 @@ public void expansionsOperationsAreSuccessful() { Expansions emptyListResults = discovery.listExpansions(listOptions).execute().getResult(); - assertTrue(emptyListResults.getExpansions().get(0).getInputTerms() == null - || emptyListResults.getExpansions().get(0).getInputTerms().isEmpty()); - assertTrue(emptyListResults.getExpansions().get(0).getExpandedTerms() == null - || emptyListResults.getExpansions().get(0).getExpandedTerms().get(0).isEmpty()); + assertTrue(emptyListResults.expansions().get(0).inputTerms() == null + || emptyListResults.expansions().get(0).inputTerms().isEmpty()); + assertTrue(emptyListResults.expansions().get(0).expandedTerms() == null + || emptyListResults.expansions().get(0).expandedTerms().get(0).isEmpty()); } catch (InternalServerErrorException e) { System.out.println("Internal server error while trying to create expansion ¯\\_(ツ)_/¯ Probably not our issue" + " but may be worth looking into."); @@ -1701,35 +1710,38 @@ public void credentialsOperationsAreSuccessful() { String url = "https://login.salesforce.com"; String username = "test@username.com"; String password = "test_password"; - CredentialDetails credentialDetails = new CredentialDetails(); - credentialDetails.setCredentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD); - credentialDetails.setUrl(url); - credentialDetails.setUsername(username); - credentialDetails.setPassword(password); - Credentials credentials = new Credentials(); - credentials.setSourceType(Credentials.SourceType.SALESFORCE); - credentials.setCredentialDetails(credentialDetails); + CredentialDetails credentialDetails = new CredentialDetails.Builder() + .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) + .url(url) + .username(username) + .password(password) + .build(); + Credentials credentials = new Credentials.Builder() + .sourceType(Credentials.SourceType.SALESFORCE) + .credentialDetails(credentialDetails) + .build(); CreateCredentialsOptions createOptions = new CreateCredentialsOptions.Builder() .environmentId(environmentId) .credentials(credentials) .build(); Credentials createdCredentials = discovery.createCredentials(createOptions).execute().getResult(); - String credentialId = createdCredentials.getCredentialId(); + String credentialId = createdCredentials.credentialId(); // Create assertions - assertEquals(Credentials.SourceType.SALESFORCE, createdCredentials.getSourceType()); + assertEquals(Credentials.SourceType.SALESFORCE, createdCredentials.sourceType()); assertEquals(CredentialDetails.CredentialType.USERNAME_PASSWORD, - createdCredentials.getCredentialDetails().getCredentialType()); - assertEquals(url, createdCredentials.getCredentialDetails().getUrl()); - assertEquals(username, createdCredentials.getCredentialDetails().getUsername()); + createdCredentials.credentialDetails().credentialType()); + assertEquals(url, createdCredentials.credentialDetails().url()); + assertEquals(username, createdCredentials.credentialDetails().username()); String newUrl = "https://newlogin.salesforce.com"; - CredentialDetails updatedDetails = new CredentialDetails(); - updatedDetails.setCredentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD); - updatedDetails.setUrl(newUrl); - updatedDetails.setUsername(username); - updatedDetails.setPassword(password); + CredentialDetails updatedDetails = new CredentialDetails.Builder() + .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) + .url(newUrl) + .username(username) + .password(password) + .build(); UpdateCredentialsOptions updateOptions = new UpdateCredentialsOptions.Builder() .environmentId(environmentId) @@ -1740,7 +1752,7 @@ public void credentialsOperationsAreSuccessful() { Credentials updatedCredentials = discovery.updateCredentials(updateOptions).execute().getResult(); // Update assertion - assertEquals(newUrl, updatedCredentials.getCredentialDetails().getUrl()); + assertEquals(newUrl, updatedCredentials.credentialDetails().url()); GetCredentialsOptions getOptions = new GetCredentialsOptions.Builder() .environmentId(environmentId) @@ -1749,11 +1761,11 @@ public void credentialsOperationsAreSuccessful() { Credentials retrievedCredentials = discovery.getCredentials(getOptions).execute().getResult(); // Get assertions - assertEquals(Credentials.SourceType.SALESFORCE, retrievedCredentials.getSourceType()); + assertEquals(Credentials.SourceType.SALESFORCE, retrievedCredentials.sourceType()); assertEquals(CredentialDetails.CredentialType.USERNAME_PASSWORD, - retrievedCredentials.getCredentialDetails().getCredentialType()); - assertEquals(newUrl, retrievedCredentials.getCredentialDetails().getUrl()); - assertEquals(username, retrievedCredentials.getCredentialDetails().getUsername()); + retrievedCredentials.credentialDetails().credentialType()); + assertEquals(newUrl, retrievedCredentials.credentialDetails().url()); + assertEquals(username, retrievedCredentials.credentialDetails().username()); ListCredentialsOptions listOptions = new ListCredentialsOptions.Builder() .environmentId(environmentId) @@ -1785,11 +1797,12 @@ public void createEventIsSuccessful() { String sessionToken = queryResponse.getSessionToken(); // make createEvent call - EventData eventData = new EventData(); - eventData.setEnvironmentId(environmentId); - eventData.setCollectionId(collectionId); - eventData.setDocumentId(accepted.getDocumentId()); - eventData.setSessionToken(sessionToken); + EventData eventData = new EventData.Builder() + .environmentId(environmentId) + .collectionId(collectionId) + .documentId(accepted.getDocumentId()) + .sessionToken(sessionToken) + .build(); CreateEventOptions createEventOptions = new CreateEventOptions.Builder() .type(CreateEventOptions.Type.CLICK) .data(eventData) @@ -1850,11 +1863,12 @@ public void tokenizationDictionaryOperationsAreSuccessful() throws InterruptedEx System.out.println("Test collection created!"); try { - TokenDictRule tokenDictRule = new TokenDictRule(); - tokenDictRule.setText("token"); - tokenDictRule.setPartOfSpeech("noun"); - tokenDictRule.setReadings(Arrays.asList("reading 1", "reading 2")); - tokenDictRule.setTokens(Arrays.asList("token 1", "token 2")); + TokenDictRule tokenDictRule = new TokenDictRule.Builder() + .text("token") + .partOfSpeech("noun") + .readings(Arrays.asList("reading 1", "reading 2")) + .tokens(Arrays.asList("token 1", "token 2")) + .build(); // the service doesn't seem to like when we try and move too fast Thread.sleep(5000); @@ -1996,7 +2010,7 @@ private void deleteEnvironment(DeleteEnvironmentOptions deleteOptions) { private Configuration createConfiguration(CreateConfigurationOptions createOptions) { Configuration createResponse = discovery.createConfiguration(createOptions).execute().getResult(); - configurationIds.add(createResponse.getConfigurationId()); + configurationIds.add(createResponse.configurationId()); return createResponse; } @@ -2029,7 +2043,7 @@ private Collection createTestCollection() { String uniqueCollectionName = uniqueName + "-collection"; CreateCollectionOptions.Builder createCollectionBuilder = new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.getConfigurationId()); + .configurationId(createConfigResponse.configurationId()); return createCollection(createCollectionBuilder.build()); } diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java index ddb1658735d..cdde75ba42e 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java @@ -18,7 +18,7 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSyntaxException; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.discovery.v1.model.AddDocumentOptions; @@ -297,11 +297,7 @@ public static void setupClass() { @Before public void setup() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - discoveryService = new Discovery(VERSION, authConfig); + discoveryService = new Discovery(VERSION, new NoAuthAuthenticator()); discoveryService.setEndPoint(getMockWebServerUrl()); environmentId = "mock_envid"; @@ -375,7 +371,7 @@ public void cleanup() { */ @Test(expected = IllegalArgumentException.class) public void testConstructorWithNullVersionDate() { - new Discovery(null); + new Discovery(null, new NoAuthAuthenticator()); } /** @@ -383,7 +379,7 @@ public void testConstructorWithNullVersionDate() { */ @Test(expected = IllegalArgumentException.class) public void testConstructorWithEmptyVersionDate() { - new Discovery(""); + new Discovery("", new NoAuthAuthenticator()); } // Environment tests @@ -493,52 +489,58 @@ public void testSourceOptions() { Long requestTimeout = 2L; String bucketName = "bucket_name"; - SourceOptions sourceOptions = new SourceOptions(); - SourceOptionsFolder folder = new SourceOptionsFolder(); - folder.setOwnerUserId(folderOwnerUserId); - folder.setFolderId(folderId); - folder.setLimit(limit); - sourceOptions.setFolders(Collections.singletonList(folder)); - SourceOptionsObject object = new SourceOptionsObject(); - object.setName(objectName); - object.setLimit(limit); - sourceOptions.setObjects(Collections.singletonList(object)); - SourceOptionsSiteColl siteColl = new SourceOptionsSiteColl(); - siteColl.setSiteCollectionPath(siteCollectionPath); - siteColl.setLimit(limit); - sourceOptions.setSiteCollections(Collections.singletonList(siteColl)); - SourceOptionsWebCrawl webCrawl = new SourceOptionsWebCrawl(); - webCrawl.setUrl(url); - webCrawl.setLimitToStartingHosts(true); - webCrawl.setCrawlSpeed(SourceOptionsWebCrawl.CrawlSpeed.AGGRESSIVE); - webCrawl.setAllowUntrustedCertificate(true); - webCrawl.setMaximumHops(maximumHops); - webCrawl.setRequestTimeout(requestTimeout); - webCrawl.setOverrideRobotsTxt(true); - sourceOptions.setUrls(Collections.singletonList(webCrawl)); - SourceOptionsBuckets buckets = new SourceOptionsBuckets(); - buckets.setName(bucketName); - buckets.setLimit(limit); - sourceOptions.setBuckets(Collections.singletonList(buckets)); - sourceOptions.setCrawlAllBuckets(true); - - assertEquals(folderOwnerUserId, sourceOptions.getFolders().get(0).getOwnerUserId()); - assertEquals(folderId, sourceOptions.getFolders().get(0).getFolderId()); - assertEquals(limit, sourceOptions.getFolders().get(0).getLimit()); - assertEquals(objectName, sourceOptions.getObjects().get(0).getName()); - assertEquals(limit, sourceOptions.getObjects().get(0).getLimit()); - assertEquals(siteCollectionPath, sourceOptions.getSiteCollections().get(0).getSiteCollectionPath()); - assertEquals(limit, sourceOptions.getSiteCollections().get(0).getLimit()); - assertEquals(url, sourceOptions.getUrls().get(0).getUrl()); - assertTrue(sourceOptions.getUrls().get(0).isLimitToStartingHosts()); - assertEquals(SourceOptionsWebCrawl.CrawlSpeed.AGGRESSIVE, sourceOptions.getUrls().get(0).getCrawlSpeed()); - assertTrue(sourceOptions.getUrls().get(0).isAllowUntrustedCertificate()); - assertEquals(maximumHops, sourceOptions.getUrls().get(0).getMaximumHops()); - assertEquals(requestTimeout, sourceOptions.getUrls().get(0).getRequestTimeout()); - assertTrue(sourceOptions.getUrls().get(0).isOverrideRobotsTxt()); - assertEquals(bucketName, sourceOptions.getBuckets().get(0).getName()); - assertEquals(limit, sourceOptions.getBuckets().get(0).getLimit()); - assertTrue(sourceOptions.isCrawlAllBuckets()); + SourceOptionsFolder folder = new SourceOptionsFolder.Builder() + .ownerUserId(folderOwnerUserId) + .folderId(folderId) + .limit(limit) + .build(); + SourceOptionsObject object = new SourceOptionsObject.Builder() + .name(objectName) + .limit(limit) + .build(); + SourceOptionsSiteColl siteColl = new SourceOptionsSiteColl.Builder() + .siteCollectionPath(siteCollectionPath) + .limit(limit) + .build(); + SourceOptionsWebCrawl webCrawl = new SourceOptionsWebCrawl.Builder() + .url(url) + .limitToStartingHosts(true) + .crawlSpeed(SourceOptionsWebCrawl.CrawlSpeed.AGGRESSIVE) + .allowUntrustedCertificate(true) + .maximumHops(maximumHops) + .requestTimeout(requestTimeout) + .overrideRobotsTxt(true) + .build(); + SourceOptionsBuckets buckets = new SourceOptionsBuckets.Builder() + .name(bucketName) + .limit(limit) + .build(); + SourceOptions sourceOptions = new SourceOptions.Builder() + .folders(Collections.singletonList(folder)) + .objects(Collections.singletonList(object)) + .siteCollections(Collections.singletonList(siteColl)) + .urls(Collections.singletonList(webCrawl)) + .buckets(Collections.singletonList(buckets)) + .crawlAllBuckets(true) + .build(); + + assertEquals(folderOwnerUserId, sourceOptions.folders().get(0).ownerUserId()); + assertEquals(folderId, sourceOptions.folders().get(0).folderId()); + assertEquals(limit, sourceOptions.folders().get(0).limit()); + assertEquals(objectName, sourceOptions.objects().get(0).name()); + assertEquals(limit, sourceOptions.objects().get(0).limit()); + assertEquals(siteCollectionPath, sourceOptions.siteCollections().get(0).siteCollectionPath()); + assertEquals(limit, sourceOptions.siteCollections().get(0).limit()); + assertEquals(url, sourceOptions.urls().get(0).url()); + assertTrue(sourceOptions.urls().get(0).limitToStartingHosts()); + assertEquals(SourceOptionsWebCrawl.CrawlSpeed.AGGRESSIVE, sourceOptions.urls().get(0).crawlSpeed()); + assertTrue(sourceOptions.urls().get(0).allowUntrustedCertificate()); + assertEquals(maximumHops, sourceOptions.urls().get(0).maximumHops()); + assertEquals(requestTimeout, sourceOptions.urls().get(0).requestTimeout()); + assertTrue(sourceOptions.urls().get(0).overrideRobotsTxt()); + assertEquals(bucketName, sourceOptions.buckets().get(0).name()); + assertEquals(limit, sourceOptions.buckets().get(0).limit()); + assertTrue(sourceOptions.crawlAllBuckets()); } // Configuration tests @@ -546,22 +548,32 @@ public void testSourceOptions() { public void testCreateConfigurationOptions() { String name = "name"; String description = "description"; - Conversions conversions = new Conversions(); + Conversions conversions = new Conversions.Builder().build(); String firstEnrichmentName = "first"; String secondEnrichmentName = "second"; + String sourceField = "source_field"; + String destinationField = "destination_field"; List enrichments = new ArrayList<>(); - Enrichment firstEnrichment = new Enrichment(); - firstEnrichment.setEnrichmentName(firstEnrichmentName); + Enrichment firstEnrichment = new Enrichment.Builder() + .enrichment(firstEnrichmentName) + .sourceField(sourceField) + .destinationField(destinationField) + .build(); enrichments.add(firstEnrichment); - Enrichment secondEnrichment = new Enrichment(); - secondEnrichment.setEnrichmentName(secondEnrichmentName); + Enrichment secondEnrichment = new Enrichment.Builder() + .enrichment(secondEnrichmentName) + .sourceField(sourceField) + .destinationField(destinationField) + .build(); List normalizationOperations = new ArrayList<>(); - NormalizationOperation firstOp = new NormalizationOperation(); - firstOp.setOperation(NormalizationOperation.Operation.MERGE); - NormalizationOperation secondOp = new NormalizationOperation(); - secondOp.setOperation(NormalizationOperation.Operation.COPY); + NormalizationOperation firstOp = new NormalizationOperation.Builder() + .operation(NormalizationOperation.Operation.MERGE) + .build(); + NormalizationOperation secondOp = new NormalizationOperation.Builder() + .operation(NormalizationOperation.Operation.COPY) + .build(); normalizationOperations.add(firstOp); - Source source = new Source(); + Source source = new Source.Builder().build(); CreateConfigurationOptions createConfigurationOptions = new CreateConfigurationOptions.Builder() .environmentId(environmentId) @@ -652,8 +664,9 @@ public void updateConfigurationIsSuccessful() throws InterruptedException { UpdateConfigurationOptions.Builder updateBuilder = new UpdateConfigurationOptions.Builder(); updateBuilder.configurationId(configurationId); updateBuilder.environmentId(environmentId); - Configuration newConf = new Configuration(); - newConf.setName("newName"); + Configuration newConf = new Configuration.Builder() + .name("newName") + .build(); updateBuilder.configuration(newConf); Configuration response = discoveryService.updateConfiguration(updateBuilder.build()).execute().getResult(); @@ -881,7 +894,7 @@ public void queryIsSuccessful() throws InterruptedException { queryBuilder.count(5L); queryBuilder.offset(5L); String fieldNames = "field"; - queryBuilder.returnFields(fieldNames); + queryBuilder.xreturn(fieldNames); queryBuilder.query("field" + Operator.CONTAINS + 1); queryBuilder.filter("field" + Operator.CONTAINS + 1); queryBuilder.similar(true); @@ -889,7 +902,7 @@ public void queryIsSuccessful() throws InterruptedException { queryBuilder.similarDocumentIds(similarDocumentIds); String similarFields = "field1, field2"; queryBuilder.similarFields(similarFields); - queryBuilder.loggingOptOut(true); + queryBuilder.xWatsonLoggingOptOut(true); queryBuilder.bias("bias"); QueryResponse response = discoveryService.query(queryBuilder.build()).execute().getResult(); RecordedRequest request = server.takeRequest(); @@ -924,9 +937,10 @@ public void addTrainingDataIsSuccessful() throws InterruptedException { server.enqueue(jsonResponse(addTrainingQueryResp)); AddTrainingDataOptions.Builder builder = new AddTrainingDataOptions.Builder(environmentId, collectionId); builder.naturalLanguageQuery("Example query"); - TrainingExample example = new TrainingExample(); - example.setDocumentId(documentId); - example.setRelevance(0); + TrainingExample example = new TrainingExample.Builder() + .documentId(documentId) + .relevance(0) + .build(); builder.addExamples(example); TrainingQuery response = discoveryService.addTrainingData(builder.build()).execute().getResult(); RecordedRequest request = server.takeRequest(); @@ -1085,7 +1099,7 @@ public void federatedQueryIsSuccessful() throws InterruptedException { .environmentId(environmentId) .collectionIds(collectionId) .bias("bias") - .loggingOptOut(true); + .xWatsonLoggingOptOut(true); discoveryService.federatedQuery(builder.build()).execute().getResult(); RecordedRequest request = server.takeRequest(); @@ -1113,14 +1127,17 @@ public void createExpansionsIsSuccessful() throws InterruptedException { List expansion1ExpandedTerms = Arrays.asList("monday", "tuesday", "wednesday", "thursday", "friday"); List expansion2InputTerms = Arrays.asList("weekend", "week end"); List expansion2ExpandedTerms = Arrays.asList("saturday", "sunday"); - Expansion expansion1 = new Expansion(); - expansion1.setInputTerms(expansion1InputTerms); - expansion1.setExpandedTerms(expansion1ExpandedTerms); - Expansion expansion2 = new Expansion(); - expansion2.setInputTerms(expansion2InputTerms); - expansion2.setExpandedTerms(expansion2ExpandedTerms); - Expansions expansions = new Expansions(); - expansions.setExpansions(Arrays.asList(expansion1, expansion2)); + Expansion expansion1 = new Expansion.Builder() + .inputTerms(expansion1InputTerms) + .expandedTerms(expansion1ExpandedTerms) + .build(); + Expansion expansion2 = new Expansion.Builder() + .inputTerms(expansion2InputTerms) + .expandedTerms(expansion2ExpandedTerms) + .build(); + Expansions expansions = new Expansions.Builder() + .expansions(Arrays.asList(expansion1, expansion2)) + .build(); CreateExpansionsOptions createOptions = new CreateExpansionsOptions.Builder() .environmentId(environmentId) @@ -1132,8 +1149,8 @@ public void createExpansionsIsSuccessful() throws InterruptedException { assertEquals(EXPANSIONS_PATH, request.getPath()); assertEquals(POST, request.getMethod()); - assertEquals(expansion1, createResults.getExpansions().get(0)); - assertEquals(expansion2, createResults.getExpansions().get(1)); + assertEquals(expansion1, createResults.expansions().get(0)); + assertEquals(expansion2, createResults.expansions().get(1)); } @Test @@ -1144,12 +1161,14 @@ public void listExpansionsIsSuccessful() throws InterruptedException { List expansion1ExpandedTerms = Arrays.asList("monday", "tuesday", "wednesday", "thursday", "friday"); List expansion2InputTerms = Arrays.asList("weekend", "week end"); List expansion2ExpandedTerms = Arrays.asList("saturday", "sunday"); - Expansion expansion1 = new Expansion(); - expansion1.setInputTerms(expansion1InputTerms); - expansion1.setExpandedTerms(expansion1ExpandedTerms); - Expansion expansion2 = new Expansion(); - expansion2.setInputTerms(expansion2InputTerms); - expansion2.setExpandedTerms(expansion2ExpandedTerms); + Expansion expansion1 = new Expansion.Builder() + .inputTerms(expansion1InputTerms) + .expandedTerms(expansion1ExpandedTerms) + .build(); + Expansion expansion2 = new Expansion.Builder() + .inputTerms(expansion2InputTerms) + .expandedTerms(expansion2ExpandedTerms) + .build(); ListExpansionsOptions listOptions = new ListExpansionsOptions.Builder() .environmentId(environmentId) @@ -1160,8 +1179,8 @@ public void listExpansionsIsSuccessful() throws InterruptedException { assertEquals(EXPANSIONS_PATH, request.getPath()); assertEquals(GET, request.getMethod()); - assertEquals(expansion1, listResults.getExpansions().get(0)); - assertEquals(expansion2, listResults.getExpansions().get(1)); + assertEquals(expansion1, listResults.expansions().get(0)); + assertEquals(expansion2, listResults.expansions().get(1)); } @Test @@ -1218,58 +1237,61 @@ public void testCredentialDetails() { String accessKeyId = "access_key"; String secretAccessKey = "secret_access_key"; - CredentialDetails details = new CredentialDetails(); - details.setClientId(clientId); - details.setClientSecret(clientSecret); - details.setCredentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD); - details.setEnterpriseId(enterpriseId); - details.setOrganizationUrl(organizationUrl); - details.setPassphrase(passphrase); - details.setPassword(password); - details.setPrivateKey(privateKey); - details.setPublicKeyId(publicKeyId); - details.setSiteCollectionPath(siteCollectionPath); - details.setUrl(url); - details.setUsername(username); - details.setGatewayId(gatewayId); - details.setSourceVersion(sourceVersion); - details.setWebApplicationUrl(webApplicationUrl); - details.setDomain(domain); - details.setEndpoint(endpoint); - details.setAccessKeyId(accessKeyId); - details.setSecretAccessKey(secretAccessKey); - - assertEquals(clientId, details.getClientId()); - assertEquals(clientSecret, details.getClientSecret()); - assertEquals(CredentialDetails.CredentialType.USERNAME_PASSWORD, details.getCredentialType()); - assertEquals(enterpriseId, details.getEnterpriseId()); - assertEquals(organizationUrl, details.getOrganizationUrl()); - assertEquals(passphrase, details.getPassphrase()); - assertEquals(password, details.getPassword()); - assertEquals(privateKey, details.getPrivateKey()); - assertEquals(publicKeyId, details.getPublicKeyId()); - assertEquals(siteCollectionPath, details.getSiteCollectionPath()); - assertEquals(url, details.getUrl()); - assertEquals(username, details.getUsername()); - assertEquals(gatewayId, details.getGatewayId()); - assertEquals(sourceVersion, details.getSourceVersion()); - assertEquals(webApplicationUrl, details.getWebApplicationUrl()); - assertEquals(domain, details.getDomain()); - assertEquals(accessKeyId, details.getAccessKeyId()); - assertEquals(secretAccessKey, details.getSecretAccessKey()); + CredentialDetails details = new CredentialDetails.Builder() + .clientId(clientId) + .clientSecret(clientSecret) + .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) + .enterpriseId(enterpriseId) + .organizationUrl(organizationUrl) + .passphrase(passphrase) + .password(password) + .privateKey(privateKey) + .publicKeyId(publicKeyId) + .siteCollectionPath(siteCollectionPath) + .url(url) + .username(username) + .gatewayId(gatewayId) + .sourceVersion(sourceVersion) + .webApplicationUrl(webApplicationUrl) + .domain(domain) + .endpoint(endpoint) + .accessKeyId(accessKeyId) + .secretAccessKey(secretAccessKey) + .build(); + + assertEquals(clientId, details.clientId()); + assertEquals(clientSecret, details.clientSecret()); + assertEquals(CredentialDetails.CredentialType.USERNAME_PASSWORD, details.credentialType()); + assertEquals(enterpriseId, details.enterpriseId()); + assertEquals(organizationUrl, details.organizationUrl()); + assertEquals(passphrase, details.passphrase()); + assertEquals(password, details.password()); + assertEquals(privateKey, details.privateKey()); + assertEquals(publicKeyId, details.publicKeyId()); + assertEquals(siteCollectionPath, details.siteCollectionPath()); + assertEquals(url, details.url()); + assertEquals(username, details.username()); + assertEquals(gatewayId, details.gatewayId()); + assertEquals(sourceVersion, details.sourceVersion()); + assertEquals(webApplicationUrl, details.webApplicationUrl()); + assertEquals(domain, details.domain()); + assertEquals(accessKeyId, details.accessKeyId()); + assertEquals(secretAccessKey, details.secretAccessKey()); } @Test public void createCredentialsIsSuccessful() throws InterruptedException { server.enqueue(jsonResponse(credentialsResp)); - CredentialDetails details = new CredentialDetails(); - details.setCredentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD); - details.setUrl("url"); - details.setUsername("username"); - Credentials credentials = new Credentials(); - credentials.setSourceType(Credentials.SourceType.SALESFORCE); - credentials.setCredentialDetails(details); + CredentialDetails details = new CredentialDetails.Builder() + .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) + .url("url") + .username("username") + .build(); + Credentials credentials = new Credentials.Builder() + .sourceType(Credentials.SourceType.SALESFORCE) + .credentialDetails(details) + .build(); CreateCredentialsOptions options = new CreateCredentialsOptions.Builder() .environmentId(environmentId) @@ -1283,7 +1305,7 @@ public void createCredentialsIsSuccessful() throws InterruptedException { assertEquals(CREATE_CREDENTIALS_PATH, request.getPath()); assertEquals(POST, request.getMethod()); assertEquals(credentialsResp, credentialsResponse); - assertEquals(credentialsResp.getCredentialDetails(), credentialsResponse.getCredentialDetails()); + assertEquals(credentialsResp.credentialDetails(), credentialsResponse.credentialDetails()); } @Test @@ -1339,22 +1361,24 @@ public void listCredentialsIsSuccessful() throws InterruptedException { public void updateCredentialsIsSuccessful() throws InterruptedException { server.enqueue(jsonResponse(credentialsResp)); - CredentialDetails newDetails = new CredentialDetails(); - newDetails.setClientId("new_client_id"); - newDetails.setClientSecret("new_client_secret"); - newDetails.setCredentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD); - newDetails.setEnterpriseId("new_enterprise_id"); - newDetails.setOrganizationUrl("new_organization_url"); - newDetails.setPassphrase("new_passphrase"); - newDetails.setPassword("new_password"); - newDetails.setPrivateKey("new_private_key"); - newDetails.setPublicKeyId("new_public_key_id"); - newDetails.setSiteCollectionPath("new_site_collection_path"); - newDetails.setUrl("new_url"); - newDetails.setUsername("new_username"); - Credentials newCredentials = new Credentials(); - newCredentials.setSourceType(Credentials.SourceType.SALESFORCE); - newCredentials.setCredentialDetails(newDetails); + CredentialDetails newDetails = new CredentialDetails.Builder() + .clientId("new_client_id") + .clientSecret("new_client_secret") + .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) + .enterpriseId("new_enterprise_id") + .organizationUrl("new_organization_url") + .passphrase("new_passphrase") + .password("new_password") + .privateKey("new_private_key") + .publicKeyId("new_public_key_id") + .siteCollectionPath("new_site_collection_path") + .url("new_url") + .username("new_username") + .build(); + Credentials newCredentials = new Credentials.Builder() + .sourceType(Credentials.SourceType.SALESFORCE) + .credentialDetails(newDetails) + .build(); UpdateCredentialsOptions options = new UpdateCredentialsOptions.Builder() .environmentId(environmentId) @@ -1378,13 +1402,14 @@ public void createEventIsSuccessful() throws InterruptedException { Long displayRank = 1L; String sessionToken = "mock_session_token"; - EventData eventData = new EventData(); - eventData.setEnvironmentId(environmentId); - eventData.setCollectionId(collectionId); - eventData.setDocumentId(documentId); - eventData.setDisplayRank(displayRank); - eventData.setSessionToken(sessionToken); - eventData.setClientTimestamp(date); + EventData eventData = new EventData.Builder() + .environmentId(environmentId) + .collectionId(collectionId) + .documentId(documentId) + .displayRank(displayRank) + .sessionToken(sessionToken) + .clientTimestamp(date) + .build(); CreateEventOptions createEventOptions = new CreateEventOptions.Builder() .type(CreateEventOptions.Type.CLICK) .data(eventData) @@ -1396,13 +1421,13 @@ public void createEventIsSuccessful() throws InterruptedException { assertEquals(CREATE_EVENT_PATH, request.getPath()); assertEquals(POST, request.getMethod()); assertEquals(CreateEventOptions.Type.CLICK, response.getType()); - assertEquals(environmentId, response.getData().getEnvironmentId()); - assertEquals(collectionId, response.getData().getCollectionId()); - assertEquals(documentId, response.getData().getDocumentId()); - assertNotNull(response.getData().getClientTimestamp()); - assertEquals(displayRank, response.getData().getDisplayRank()); - assertEquals(queryId, response.getData().getQueryId()); - assertEquals(sessionToken, response.getData().getSessionToken()); + assertEquals(environmentId, response.getData().environmentId()); + assertEquals(collectionId, response.getData().collectionId()); + assertEquals(documentId, response.getData().documentId()); + assertNotNull(response.getData().clientTimestamp()); + assertEquals(displayRank, response.getData().displayRank()); + assertEquals(queryId, response.getData().queryId()); + assertEquals(sessionToken, response.getData().sessionToken()); } @Test @@ -1725,22 +1750,35 @@ public void testTokenDictRule() { List readings = Arrays.asList("reading 1", "reading 2"); List tokens = Arrays.asList("token 1", "token 2"); - TokenDictRule tokenDictRule = new TokenDictRule(); - tokenDictRule.setText(text); - tokenDictRule.setPartOfSpeech(partOfSpeech); - tokenDictRule.setReadings(readings); - tokenDictRule.setTokens(tokens); + TokenDictRule tokenDictRule = new TokenDictRule.Builder() + .text(text) + .partOfSpeech(partOfSpeech) + .readings(readings) + .tokens(tokens) + .build(); - assertEquals(text, tokenDictRule.getText()); - assertEquals(partOfSpeech, tokenDictRule.getPartOfSpeech()); - assertEquals(readings, tokenDictRule.getReadings()); - assertEquals(tokens, tokenDictRule.getTokens()); + assertEquals(text, tokenDictRule.text()); + assertEquals(partOfSpeech, tokenDictRule.partOfSpeech()); + assertEquals(readings, tokenDictRule.readings()); + assertEquals(tokens, tokenDictRule.tokens()); } @Test public void testCreateTokenizationDictionaryOptions() { - TokenDictRule firstTokenDictRule = new TokenDictRule(); - TokenDictRule secondTokenDictRule = new TokenDictRule(); + String text = "text"; + String partOfSpeech = "noun"; + List tokens = Arrays.asList("token 1", "token 2"); + + TokenDictRule firstTokenDictRule = new TokenDictRule.Builder() + .text(text) + .partOfSpeech(partOfSpeech) + .tokens(tokens) + .build(); + TokenDictRule secondTokenDictRule = new TokenDictRule.Builder() + .text(text) + .partOfSpeech(partOfSpeech) + .tokens(tokens) + .build(); List tokenDictRuleList = new ArrayList<>(); tokenDictRuleList.add(firstTokenDictRule); @@ -1784,10 +1822,18 @@ public void testDeleteTokenizationDictionaryOptions() { public void testCreateTokenizationDictionary() throws InterruptedException { server.enqueue(jsonResponse(tokenDictStatusResponse)); + String text = "text"; + String partOfSpeech = "noun"; + List tokens = Arrays.asList("token 1", "token 2"); + TokenDictRule tokenDictRule = new TokenDictRule.Builder() + .text(text) + .tokens(tokens) + .partOfSpeech(partOfSpeech) + .build(); CreateTokenizationDictionaryOptions createOptions = new CreateTokenizationDictionaryOptions.Builder() .environmentId(environmentId) .collectionId(collectionId) - .tokenizationRules(Collections.singletonList(new TokenDictRule())) + .tokenizationRules(Collections.singletonList(tokenDictRule)) .build(); TokenDictStatusResponse response = discoveryService.createTokenizationDictionary(createOptions).execute().getResult(); @@ -2042,21 +2088,22 @@ public void testSourceOptionsWebCrawl() { Long maximumHops = 1L; Long requestTimeout = 2000L; - SourceOptionsWebCrawl sourceOptionsWebCrawl = new SourceOptionsWebCrawl(); - sourceOptionsWebCrawl.setUrl(url); - sourceOptionsWebCrawl.setLimitToStartingHosts(true); - sourceOptionsWebCrawl.setCrawlSpeed(crawlSpeed); - sourceOptionsWebCrawl.setAllowUntrustedCertificate(true); - sourceOptionsWebCrawl.setMaximumHops(maximumHops); - sourceOptionsWebCrawl.setRequestTimeout(requestTimeout); - sourceOptionsWebCrawl.setOverrideRobotsTxt(true); - - assertEquals(url, sourceOptionsWebCrawl.getUrl()); - assertTrue(sourceOptionsWebCrawl.isLimitToStartingHosts()); - assertEquals(crawlSpeed, sourceOptionsWebCrawl.getCrawlSpeed()); - assertTrue(sourceOptionsWebCrawl.isAllowUntrustedCertificate()); - assertEquals(maximumHops, sourceOptionsWebCrawl.getMaximumHops()); - assertEquals(requestTimeout, sourceOptionsWebCrawl.getRequestTimeout()); - assertTrue(sourceOptionsWebCrawl.isOverrideRobotsTxt()); + SourceOptionsWebCrawl sourceOptionsWebCrawl = new SourceOptionsWebCrawl.Builder() + .url(url) + .limitToStartingHosts(true) + .crawlSpeed(crawlSpeed) + .allowUntrustedCertificate(true) + .maximumHops(maximumHops) + .requestTimeout(requestTimeout) + .overrideRobotsTxt(true) + .build(); + + assertEquals(url, sourceOptionsWebCrawl.url()); + assertTrue(sourceOptionsWebCrawl.limitToStartingHosts()); + assertEquals(crawlSpeed, sourceOptionsWebCrawl.crawlSpeed()); + assertTrue(sourceOptionsWebCrawl.allowUntrustedCertificate()); + assertEquals(maximumHops, sourceOptionsWebCrawl.maximumHops()); + assertEquals(requestTimeout, sourceOptionsWebCrawl.requestTimeout()); + assertTrue(sourceOptionsWebCrawl.overrideRobotsTxt()); } } From 853e3c779e356f73a6726fd8940faa5ffdbb80dd Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:47:52 -0400 Subject: [PATCH 09/28] chore(Language Translator): Fix generator template error --- .../language_translator/v3/LanguageTranslator.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java index 34e37fcad4b..31f25f4ca80 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java @@ -89,7 +89,7 @@ public LanguageTranslator(String versionDate, Authenticator authenticator) { */ public ServiceCall translate(TranslateOptions translateOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull(translateOptions, - "translateOptions cannot be null"); + "translateOptions cannot be null"); String[] pathSegments = { "v3/translate" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); @@ -99,7 +99,7 @@ public ServiceCall translate(TranslateOptions translateOption } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("text", {{corePackage}.util.GsonSingleton.getGson().toJsonTree(translateOptions.text())); + contentJson.add("text", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(translateOptions.text())); if (translateOptions.modelId() != null) { contentJson.addProperty("model_id", translateOptions.modelId()); } @@ -110,8 +110,9 @@ public ServiceCall translate(TranslateOptions translateOption contentJson.addProperty("target", translateOptions.target()); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() { + }.getType()); return createServiceCall(builder.build(), responseConverter); } From b982379fbd6ebc28608fd7786363289696868af5 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:48:11 -0400 Subject: [PATCH 10/28] test(Language Translator): Update tests --- .../v3/LanguageTranslatorIT.java | 22 +++++++++---------- .../v3/LanguageTranslatorTest.java | 14 +++++------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java index 4f37953efd1..dcf109bb7a4 100644 --- a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java +++ b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java @@ -16,7 +16,7 @@ import com.google.common.collect.ImmutableMap; import com.ibm.cloud.sdk.core.http.HttpMediaType; import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonHttpHeaders; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.language_translator.v3.model.DeleteDocumentOptions; @@ -81,10 +81,8 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", (iamApiKey == null)); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(iamApiKey) - .build(); - service = new LanguageTranslator("2018-05-01", iamOptions); + IamAuthenticator authenticator = new IamAuthenticator(iamApiKey); + service = new LanguageTranslator("2018-05-01", authenticator); service.setEndPoint(getProperty("language_translator.url")); // issue currently where document translation fails with learning opt-out @@ -144,7 +142,7 @@ public void testListModelsWithOptions() { ListModelsOptions options = new ListModelsOptions.Builder() .source("en") .target("es") - .defaultModels(true) + .xdefault(true) .build(); List models = service.listModels(options).execute().getResult().getModels(); @@ -190,8 +188,8 @@ public void testTranslateMultiple() { .modelId(ENGLISH_TO_SPANISH).build(); TranslationResult results = service.translate(options).execute().getResult(); assertEquals(2, results.getTranslations().size()); - assertEquals(translations.get(texts.get(0)), results.getTranslations().get(0).getTranslationOutput()); - assertEquals(translations.get(texts.get(1)), results.getTranslations().get(1).getTranslationOutput()); + assertEquals(translations.get(texts.get(0)), results.getTranslations().get(0).getTranslation()); + assertEquals(translations.get(texts.get(1)), results.getTranslations().get(1).getTranslation()); TranslateOptions.Builder builder = new TranslateOptions.Builder(); builder.source(Language.ENGLISH).target(Language.SPANISH); @@ -200,8 +198,8 @@ public void testTranslateMultiple() { } results = service.translate(builder.build()).execute().getResult(); assertEquals(2, results.getTranslations().size()); - assertEquals(translations.get(texts.get(0)), results.getTranslations().get(0).getTranslationOutput()); - assertEquals(translations.get(texts.get(1)), results.getTranslations().get(1).getTranslationOutput()); + assertEquals(translations.get(texts.get(0)), results.getTranslations().get(0).getTranslation()); + assertEquals(translations.get(texts.get(1)), results.getTranslations().get(1).getTranslation()); } /** @@ -272,7 +270,7 @@ private void testTranslationResult(String text, String result, TranslationResult assertEquals(translationResult.getCharacterCount().intValue(), text.length()); assertEquals(translationResult.getWordCount().intValue(), text.split(" ").length); assertNotNull(translationResult.getTranslations()); - assertNotNull(translationResult.getTranslations().get(0).getTranslationOutput()); - assertEquals(result, translationResult.getTranslations().get(0).getTranslationOutput()); + assertNotNull(translationResult.getTranslations().get(0).getTranslation()); + assertEquals(result, translationResult.getTranslations().get(0).getTranslation()); } } diff --git a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorTest.java b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorTest.java index 55966d12b10..ca5769fde70 100644 --- a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorTest.java +++ b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorTest.java @@ -18,7 +18,7 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.cloud.sdk.core.service.exception.BadRequestException; import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.watson.common.WatsonServiceUnitTest; @@ -102,11 +102,7 @@ public class LanguageTranslatorTest extends WatsonServiceUnitTest { public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new LanguageTranslator("2018-05-01", authConfig); + service = new LanguageTranslator("2018-05-01", new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); // fixtures @@ -290,8 +286,8 @@ public void testTranslateMultiple() throws InterruptedException { assertEquals("POST", request.getMethod()); assertEquals(GSON.toJson(requestBody), request.getBody().readUtf8()); assertEquals(2, translationResult.getTranslations().size()); - assertEquals(translations.get(texts.get(0)), translationResult.getTranslations().get(0).getTranslationOutput()); - assertEquals(translations.get(texts.get(1)), translationResult.getTranslations().get(1).getTranslationOutput()); + assertEquals(translations.get(texts.get(0)), translationResult.getTranslations().get(0).getTranslation()); + assertEquals(translations.get(texts.get(1)), translationResult.getTranslations().get(1).getTranslation()); } /** @@ -327,7 +323,7 @@ private void testTranslationResult(String text, TranslationResult translationRes assertNotNull(translationResult); assertEquals(translationResult.getWordCount().intValue(), text.split(" ").length); assertNotNull(translationResult.getTranslations()); - assertNotNull(translationResult.getTranslations().get(0).getTranslationOutput()); + assertNotNull(translationResult.getTranslations().get(0).getTranslation()); } /** From b33ce8648c082a446df157a45c778c526f0bfe63 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:51:03 -0400 Subject: [PATCH 11/28] test(Natural Language Classifier): Update tests --- .../v1/NaturalLanguageClassifierIT.java | 21 +++++++++--------- .../v1/NaturalLanguageClassifierTest.java | 22 +++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java b/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java index 5e0643c8769..75bc864396f 100644 --- a/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java +++ b/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java @@ -12,8 +12,8 @@ */ package com.ibm.watson.natural_language_classifier.v1; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.cloud.sdk.core.service.exception.NotFoundException; -import com.ibm.cloud.sdk.core.service.security.IamOptions; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.natural_language_classifier.v1.model.Classification; import com.ibm.watson.natural_language_classifier.v1.model.ClassificationCollection; @@ -64,12 +64,9 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new NaturalLanguageClassifier(); + IamAuthenticator authenticator = new IamAuthenticator(apiKey); + service = new NaturalLanguageClassifier(authenticator); service.setDefaultHeaders(getDefaultHeaders()); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); service.setEndPoint(getProperty("natural_language_classifier.url")); preCreatedClassifierId = getProperty("natural_language_classifier.classifier_id"); @@ -86,7 +83,7 @@ public void aCreate() throws Exception { final File metadata = new File("src/test/resources/natural_language_classifier/metadata.json"); CreateClassifierOptions createOptions = new CreateClassifierOptions.Builder() - .metadata(metadata) + .trainingMetadata(metadata) .trainingData(trainingData) .build(); Classifier classifier = service.createClassifier(createOptions).execute().getResult(); @@ -179,10 +176,12 @@ public void eDelete() throws InterruptedException { @Test public void fClassifyCollection() { ClassificationCollection classificationCollection = null; - ClassifyInput input1 = new ClassifyInput(); - input1.setText("How hot will it be today?"); - ClassifyInput input2 = new ClassifyInput(); - input2.setText("Is it hot outside?"); + ClassifyInput input1 = new ClassifyInput.Builder() + .text("How hot will it be today?") + .build(); + ClassifyInput input2 = new ClassifyInput.Builder() + .text("Is it hot outside?") + .build(); try { ClassifyCollectionOptions classifyOptions = new ClassifyCollectionOptions.Builder() diff --git a/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierTest.java b/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierTest.java index 5f37ded5a9f..1d276a9710f 100644 --- a/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierTest.java +++ b/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierTest.java @@ -13,7 +13,7 @@ package com.ibm.watson.natural_language_classifier.v1; import com.google.gson.JsonObject; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.natural_language_classifier.v1.model.Classification; import com.ibm.watson.natural_language_classifier.v1.model.ClassificationCollection; @@ -62,11 +62,7 @@ public class NaturalLanguageClassifierTest extends WatsonServiceUnitTest { @Before public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new NaturalLanguageClassifier(authConfig); + service = new NaturalLanguageClassifier(new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); classifierId = "foo"; @@ -114,10 +110,12 @@ public void testClassifyCollection() throws InterruptedException { server.enqueue(jsonResponse(classificationCollection)); - ClassifyInput input1 = new ClassifyInput(); - input1.setText("How hot will it be today?"); - ClassifyInput input2 = new ClassifyInput(); - input2.setText("Is it hot outside?"); + ClassifyInput input1 = new ClassifyInput.Builder() + .text("How hot will it be today?") + .build(); + ClassifyInput input2 = new ClassifyInput.Builder() + .text("Is it hot outside?") + .build(); List inputCollection = Arrays.asList(input1, input2); ClassifyCollectionOptions classifyOptions = new ClassifyCollectionOptions.Builder() @@ -176,7 +174,7 @@ public void testCreateClassifier() throws InterruptedException, FileNotFoundExce File metadata = new File(RESOURCE + "metadata.json"); File trainingData = new File(RESOURCE + "weather_data_train.csv"); CreateClassifierOptions createOptions = new CreateClassifierOptions.Builder() - .metadata(metadata) + .trainingMetadata(metadata) .trainingData(trainingData) .build(); final Classifier response = service.createClassifier(createOptions).execute().getResult(); @@ -241,7 +239,7 @@ public void testNullTrainingDataFile() throws FileNotFoundException { File metadata = new File(RESOURCE + "metadata.json"); File trainingData = new File(RESOURCE + "notfound.txt"); CreateClassifierOptions createOptions = new CreateClassifierOptions.Builder() - .metadata(metadata) + .trainingMetadata(metadata) .trainingData(trainingData) .build(); service.createClassifier(createOptions).execute(); From 59a7d9415f1f5226ca58075fd39d5f644b86407f Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:52:59 -0400 Subject: [PATCH 12/28] test(Natural Language Understanding): Update tests --- .../v1/NaturalLanguageUnderstandingIT.java | 11 ++++------- .../v1/NaturalLanguageUnderstandingTest.java | 12 ++++-------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java b/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java index 8bfd650494a..f6858eab373 100644 --- a/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java +++ b/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java @@ -13,7 +13,7 @@ package com.ibm.watson.natural_language_understanding.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.natural_language_understanding.v1.model.AnalysisResults; @@ -77,12 +77,9 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new NaturalLanguageUnderstanding("2018-11-16"); + IamAuthenticator authenticator = new IamAuthenticator(apiKey); + service = new NaturalLanguageUnderstanding("2018-11-16", authenticator); service.setDefaultHeaders(getDefaultHeaders()); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); service.setEndPoint(getProperty("natural_language_understanding.url")); } @@ -340,7 +337,7 @@ public void analyzeHtmlForMetadataIsSuccessful() throws Exception { String fileDate = "2016-05-23T20:13:00"; String fileAuthor = "Annalee Newitz"; Features features = new Features.Builder() - .metadata(new MetadataOptions()) + .metadata(new MetadataOptions.Builder().build()) .build(); AnalyzeOptions parameters = new AnalyzeOptions.Builder() .html(html) diff --git a/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingTest.java b/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingTest.java index 024f6357f63..7fe83f9485d 100644 --- a/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingTest.java +++ b/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingTest.java @@ -13,7 +13,7 @@ package com.ibm.watson.natural_language_understanding.v1; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.natural_language_understanding.v1.model.AnalysisResults; import com.ibm.watson.natural_language_understanding.v1.model.AnalyzeOptions; @@ -68,11 +68,7 @@ public class NaturalLanguageUnderstandingTest extends WatsonServiceUnitTest { @Before public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new NaturalLanguageUnderstanding("2018-11-16", authConfig); + service = new NaturalLanguageUnderstanding("2018-11-16", new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); modelId = "foo"; @@ -152,7 +148,7 @@ public void testModelOptions() throws InterruptedException { keywordsOptions.newBuilder(); // MetadataOptions - MetadataOptions metadataOptions = new MetadataOptions(); + MetadataOptions metadataOptions = new MetadataOptions.Builder().build(); assertNotNull(metadataOptions); // RelationsOptions @@ -298,7 +294,7 @@ public void testNullModelId() { @Test(expected = IllegalArgumentException.class) public void testNullVersion() { @SuppressWarnings("unused") - NaturalLanguageUnderstanding service2 = new NaturalLanguageUnderstanding(null); + NaturalLanguageUnderstanding service2 = new NaturalLanguageUnderstanding(null, new NoAuthAuthenticator()); } } From 845120a1767f0e81dbb978bbdcd267d036349aa2 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 11:54:55 -0400 Subject: [PATCH 13/28] test(Personality Insights): Update tests --- .../v3/PersonalityInsightsIT.java | 16 ++++++---------- .../v3/PersonalityInsightsTest.java | 12 ++++-------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java b/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java index 151349f6097..2e180b67d84 100644 --- a/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java +++ b/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java @@ -13,7 +13,7 @@ package com.ibm.watson.personality_insights.v3; import com.google.common.io.CharStreams; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.personality_insights.v3.model.ConsumptionPreferences; import com.ibm.watson.personality_insights.v3.model.Content; @@ -29,7 +29,7 @@ import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; -import java.util.Arrays; +import java.util.Collections; import java.util.Date; import java.util.UUID; @@ -56,12 +56,9 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new PersonalityInsights(VERSION_DATE_2016_10_19); + IamAuthenticator authenticator = new IamAuthenticator(apiKey); + service = new PersonalityInsights(VERSION_DATE_2016_10_19, authenticator); service.setEndPoint(getProperty("personality_insights.url")); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); service.setDefaultHeaders(getDefaultHeaders()); } @@ -190,7 +187,7 @@ public void getProfileWithASingleContentItem() throws Exception { .reply(false) .parentid(null) .build(); - Content content = new Content.Builder(Arrays.asList(cItem)).build(); + Content content = new Content.Builder(Collections.singletonList(cItem)).build(); ProfileOptions options = new ProfileOptions.Builder() .content(content) .consumptionPreferences(true) @@ -205,7 +202,6 @@ public void getProfileWithASingleContentItem() throws Exception { Assert.assertNotNull(profile.getValues().get(0).getCategory()); Assert.assertNotNull(profile.getValues().get(0).getName()); Assert.assertNotNull(profile.getValues().get(0).getTraitId()); - //Assert.assertNotNull(profile.getValues().get(0).getChildren()); Assert.assertNotNull(profile.getValues().get(0).getPercentile()); Assert.assertNotNull(profile.getValues().get(0).getRawScore()); @@ -241,7 +237,7 @@ public void getProfileWithASingleSpanishContentItem() throws Exception { .language(ContentItem.Language.ES) .build(); Content content = new Content.Builder() - .contentItems(Arrays.asList(cItem)) + .contentItems(Collections.singletonList(cItem)) .build(); ProfileOptions options = new ProfileOptions.Builder() .content(content) diff --git a/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsTest.java b/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsTest.java index cdb938fb003..a123769e68c 100644 --- a/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsTest.java +++ b/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsTest.java @@ -14,7 +14,7 @@ import com.ibm.cloud.sdk.core.http.HttpHeaders; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.personality_insights.v3.model.Content; import com.ibm.watson.personality_insights.v3.model.ContentItem; @@ -65,11 +65,7 @@ public PersonalityInsightsTest() throws FileNotFoundException { @Before public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new PersonalityInsights(VERSION_DATE_2016_10_19, authConfig); + service = new PersonalityInsights(VERSION_DATE_2016_10_19, new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); } @@ -78,7 +74,7 @@ public void setUp() throws Exception { */ @Test(expected = IllegalArgumentException.class) public void testConstructorWithNullVersionDate() { - new PersonalityInsights(null); + new PersonalityInsights(null, new NoAuthAuthenticator()); } /** @@ -86,7 +82,7 @@ public void testConstructorWithNullVersionDate() { */ @Test(expected = IllegalArgumentException.class) public void testConstructorWithEmptyVersionDate() { - new PersonalityInsights(""); + new PersonalityInsights("", new NoAuthAuthenticator()); } /** From a1626678d8e00dbb6ae440b4c68c0534597258cf Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:09:58 -0400 Subject: [PATCH 14/28] chore(Speech to Text): Apply manual changes --- .../speech_to_text/v1/SpeechToText.java | 62 +++++++++- .../v1/model/RecognizeOptions.java | 107 +++++++++++++++++- .../model/SpeechRecognitionAlternative.java | 8 +- 3 files changed, 166 insertions(+), 11 deletions(-) diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index 60214e2af8e..40ea51571bc 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -81,9 +81,15 @@ import com.ibm.watson.speech_to_text.v1.model.UpgradeLanguageModelOptions; import com.ibm.watson.speech_to_text.v1.model.Word; import com.ibm.watson.speech_to_text.v1.model.Words; +import com.ibm.watson.speech_to_text.v1.websocket.RecognizeCallback; +import com.ibm.watson.speech_to_text.v1.websocket.SpeechToTextWebSocketListener; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.WebSocket; + import java.util.Map; import java.util.Map.Entry; -import okhttp3.MultipartBody; /** * The IBM® Speech to Text service provides APIs that use IBM's speech-recognition capabilities to produce @@ -354,6 +360,54 @@ public ServiceCall recognize(RecognizeOptions recogniz return createServiceCall(builder.build(), responseConverter); } + /** + * Sends audio and returns transcription results for recognition requests over a WebSocket connection. Requests and + * responses are enabled over a single TCP connection that abstracts much of the complexity of the request to offer + * efficient implementation, low latency, high throughput, and an asynchronous response. By default, only final + * results are returned for any request; to enable interim results, set the interimResults parameter to true. + * + * The service imposes a data size limit of 100 MB per utterance (per recognition request). You can send multiple + * utterances over a single WebSocket connection. The service automatically detects the endianness of the incoming + * audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding. + * (For the audio/l16 format, you can specify the endianness.) + * + * @param recognizeOptions the recognize options + * @param callback the {@link RecognizeCallback} instance where results will be sent + * @return the {@link WebSocket} + */ + public WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, RecognizeCallback callback) { + com.ibm.cloud.sdk.core.util.Validator.notNull(recognizeOptions, "recognizeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(recognizeOptions.audio(), "audio cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); + + HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/recognize").newBuilder(); + + if (recognizeOptions.model() != null) { + urlBuilder.addQueryParameter("model", recognizeOptions.model()); + } + if (recognizeOptions.customizationId() != null) { + urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId()); + } + if (recognizeOptions.languageCustomizationId() != null) { + urlBuilder.addQueryParameter("language_customization_id", recognizeOptions.languageCustomizationId()); + } + if (recognizeOptions.acousticCustomizationId() != null) { + urlBuilder.addQueryParameter("acoustic_customization_id", recognizeOptions.acousticCustomizationId()); + } + if (recognizeOptions.baseModelVersion() != null) { + urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion()); + } + + String url = urlBuilder.toString().replace("https://", "wss://"); + Request.Builder builder = new Request.Builder().url(url); + + setAuthentication(builder); + setDefaultHeaders(builder); + + OkHttpClient client = configureHttpClient(); + return client.newWebSocket(builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback)); + } + /** * Register a callback. * @@ -1096,11 +1150,7 @@ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { if (addCorpusOptions.allowOverwrite() != null) { builder.query("allow_overwrite", String.valueOf(addCorpusOptions.allowOverwrite())); } - MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); - multipartBuilder.setType(MultipartBody.FORM); - okhttp3.RequestBody corpusFileBody = RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain"); - multipartBuilder.addFormDataPart("corpus_file", "filename", corpusFileBody); - builder.body(multipartBuilder.build()); + builder.body(RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain")); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java index 12e808b58db..1effd15a52b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.List; +import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; /** @@ -132,7 +133,8 @@ public interface Model { String ZH_CN_NARROWBANDMODEL = "zh-CN_NarrowbandModel"; } - private InputStream audio; + private transient InputStream audio; + @SerializedName("content-type") private String contentType; private String model; private String languageCustomizationId; @@ -153,6 +155,9 @@ public interface Model { private String grammarName; private Boolean redaction; private Boolean audioMetrics; + private Boolean interimResults; + private Boolean processingMetrics; + private Float processingMetricsInterval; /** * Builder. @@ -179,6 +184,9 @@ public static class Builder { private String grammarName; private Boolean redaction; private Boolean audioMetrics; + private Boolean interimResults; + private Boolean processingMetrics; + private Float processingMetricsInterval; private Builder(RecognizeOptions recognizeOptions) { this.audio = recognizeOptions.audio; @@ -202,6 +210,9 @@ private Builder(RecognizeOptions recognizeOptions) { this.grammarName = recognizeOptions.grammarName; this.redaction = recognizeOptions.redaction; this.audioMetrics = recognizeOptions.audioMetrics; + this.interimResults = recognizeOptions.interimResults; + this.processingMetrics = recognizeOptions.processingMetrics; + this.processingMetricsInterval = recognizeOptions.processingMetricsInterval; } /** @@ -488,6 +499,45 @@ public Builder audio(File audio) throws FileNotFoundException { this.audio = new FileInputStream(audio); return this; } + + /** + * Set the interimResults. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @param interimResults the interimResults + * @return the interimResults + */ + public Builder interimResults(Boolean interimResults) { + this.interimResults = interimResults; + return this; + } + + /** + * Set the processingMetrics. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @param processingMetrics the processingMetrics + * @return the processingMetrics + */ + public Builder processingMetrics(Boolean processingMetrics) { + this.processingMetrics = processingMetrics; + return this; + } + + /** + * Set the processingMetricsInterval. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @param processingMetricsInterval the processingMetricsInterval + * @return the processingMetricsInterval + */ + public Builder processingMetricsInterval(Float processingMetricsInterval) { + this.processingMetricsInterval = processingMetricsInterval; + return this; + } } private RecognizeOptions(Builder builder) { @@ -514,6 +564,9 @@ private RecognizeOptions(Builder builder) { grammarName = builder.grammarName; redaction = builder.redaction; audioMetrics = builder.audioMetrics; + interimResults = builder.interimResults; + processingMetrics = builder.processingMetrics; + processingMetricsInterval = builder.processingMetricsInterval; } /** @@ -840,4 +893,56 @@ public Boolean redaction() { public Boolean audioMetrics() { return audioMetrics; } + + /** + * Gets the interimResults. + * + * If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` objects. By default, + * the service returns a single `SpeechRecognitionResults` object with final results only. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @return the interimResults + */ + public Boolean interimResults() { + return interimResults; + } + + /** + * Gets the processingMetrics. + * + * If `true`, requests processing metrics about the service's transcription of the input audio. The service returns + * processing metrics at the interval specified by the `processing_metrics_interval` parameter. It also returns + * processing metrics for transcription events, for example, for final and interim results. By default, the service + * returns no processing metrics. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @return the processingMetrics + */ + public Boolean processingMetrics() { + return processingMetrics; + } + + /** + * Gets the processingMetricsInterval. + * + * Specifies the interval in real wall-clock seconds at which the service is to return processing metrics. The + * parameter is ignored unless the `processing_metrics` parameter is set to `true`. + * + * The parameter accepts a minimum value of 0.1 seconds. The level of precision is not restricted, so you can + * specify values such as 0.25 and 0.125. + * + * The service does not impose a maximum value. If you want to receive processing metrics only for transcription + * events instead of at periodic intervals, set the value to a large number. If the value is larger than the + * duration of the audio, the service returns processing metrics only for transcription events. + * + * NOTE: This parameter only works for the `recognizeUsingWebSocket` method. + * + * @return the processingMetricsInterval + */ + public Float processingMetricsInterval() { + return processingMetricsInterval; + } + } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java index c6682596831..a9385c76742 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java @@ -24,9 +24,9 @@ public class SpeechRecognitionAlternative extends GenericModel { private String transcript; private Double confidence; - private List timestamps; + private List timestamps; @SerializedName("word_confidence") - private List wordConfidence; + private List wordConfidence; /** * Gets the transcript. @@ -60,7 +60,7 @@ public Double getConfidence() { * * @return the timestamps */ - public List getTimestamps() { + public List getTimestamps() { return timestamps; } @@ -73,7 +73,7 @@ public List getTimestamps() { * * @return the wordConfidence */ - public List getWordConfidence() { + public List getWordConfidence() { return wordConfidence; } } From a29afe9b6554d4a0a6fddf5eb404165bc57cc5c3 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:10:17 -0400 Subject: [PATCH 15/28] test(Speech to Text): Update tests --- .../speech_to_text/v1/SpeechToTextIT.java | 7 ++++--- .../speech_to_text/v1/SpeechToTextTest.java | 21 ++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java index fe95b2b9fe0..c1d42ec7578 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java +++ b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java @@ -13,6 +13,7 @@ package com.ibm.watson.speech_to_text.v1; import com.ibm.cloud.sdk.core.http.HttpMediaType; +import com.ibm.cloud.sdk.core.security.BasicAuthenticator; import com.ibm.cloud.sdk.core.service.exception.NotFoundException; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; @@ -130,8 +131,8 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", username == null); - service = new SpeechToText(); - service.setUsernameAndPassword(username, password); + BasicAuthenticator authenticator = new BasicAuthenticator(username, password); + service = new SpeechToText(authenticator); service.setEndPoint(getProperty("speech_to_text.url")); service.setDefaultHeaders(getDefaultHeaders()); } @@ -319,7 +320,7 @@ public void onError(Exception e) { @Override public void onTranscription(SpeechRecognitionResults speechResults) { if (speechResults != null) { - if (speechResults.getResults() != null && speechResults.getResults().get(0).isFinalResults()) { + if (speechResults.getResults() != null && speechResults.getResults().get(0).isXfinal()) { asyncTranscriptionResults = speechResults; } if (speechResults.getAudioMetrics() != null) { diff --git a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java index 9373f024cff..71e89903cc4 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java +++ b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java @@ -16,7 +16,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.watson.common.TestUtils; @@ -169,11 +169,7 @@ public class SpeechToTextTest extends WatsonServiceUnitTest { public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new SpeechToText(authConfig); + service = new SpeechToText(new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); speechModel = loadFixture("src/test/resources/speech_to_text/speech-model.json", SpeechModel.class); @@ -1119,10 +1115,11 @@ public void testAddWords() throws InterruptedException, FileNotFoundException { wordsAsMap.put("words", new Word[] { newWord }); server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody("{}")); - CustomWord word = new CustomWord(); - word.setWord(newWord.getWord()); - word.setDisplayAs(newWord.getDisplayAs()); - word.setSoundsLike(newWord.getSoundsLike()); + CustomWord word = new CustomWord.Builder() + .word(newWord.getWord()) + .displayAs(newWord.getDisplayAs()) + .soundsLike(newWord.getSoundsLike()) + .build(); AddWordsOptions addOptions = new AddWordsOptions.Builder() .customizationId(id) @@ -1489,8 +1486,8 @@ public void testClosingInputStreamClosesWebSocket() throws Exception { outputStream.write(ByteString.encodeUtf8("test").toByteArray()); outputStream.close(); - webSocketRecorder.assertTextMessage("{\"customization_weight\":0.1," - + "\"content-type\":\"audio/l16; rate=44000\",\"action\":\"start\"}"); + webSocketRecorder.assertTextMessage("{\"content-type\":\"audio/l16; rate=44000\"," + + "\"customization_weight\":0.1,\"action\":\"start\"}"); webSocketRecorder.assertBinaryMessage(ByteString.encodeUtf8("test")); webSocketRecorder.assertTextMessage("{\"action\":\"stop\"}"); webSocketRecorder.assertExhausted(); From e2dae74e1531264d9cf6e22e232c67381972b951 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:22:51 -0400 Subject: [PATCH 16/28] test: Use interface when creating authenticators --- .../java/com/ibm/watson/assistant/v1/AssistantServiceTest.java | 3 ++- .../java/com/ibm/watson/assistant/v2/AssistantServiceTest.java | 3 ++- .../ibm/watson/compare_comply/v1/CompareComplyServiceTest.java | 3 ++- .../java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java | 3 ++- .../watson/language_translator/v3/LanguageTranslatorIT.java | 3 ++- .../v1/NaturalLanguageClassifierIT.java | 3 ++- .../v1/NaturalLanguageUnderstandingIT.java | 3 ++- .../watson/personality_insights/v3/PersonalityInsightsIT.java | 3 ++- .../java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java | 3 ++- 9 files changed, 18 insertions(+), 9 deletions(-) diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java index 5adf45b6291..8c29a3f212f 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v1; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import org.junit.Assume; @@ -45,7 +46,7 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - IamAuthenticator authenticator = new IamAuthenticator(apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey); service = new Assistant("2018-07-10", authenticator); service.setEndPoint(getProperty("assistant.url")); service.setDefaultHeaders(getDefaultHeaders()); diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java index 3c4edd0cadc..24246916dec 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.assistant.v2; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import org.junit.Assume; @@ -45,7 +46,7 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - IamAuthenticator authenticator = new IamAuthenticator(apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey); service = new Assistant("2019-02-28", authenticator); service.setEndPoint(getProperty("assistant.url")); service.setDefaultHeaders(getDefaultHeaders()); diff --git a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java index 7c5111dd39e..9527e65965e 100644 --- a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java +++ b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java @@ -1,5 +1,6 @@ package com.ibm.watson.compare_comply.v1; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import org.junit.Assume; @@ -25,7 +26,7 @@ public void setUp() throws Exception { String apiKey = getProperty("compare_comply.apikey"); Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - IamAuthenticator authenticator = new IamAuthenticator(apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey); service = new CompareComply(VERSION, authenticator); service.setEndPoint(getProperty("compare_comply.url")); service.setDefaultHeaders(getDefaultHeaders()); diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java index f8e5ac70bae..ad63c6d6d1d 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java @@ -17,6 +17,7 @@ import com.google.gson.JsonPrimitive; import com.google.gson.internal.LazilyParsedNumber; import com.ibm.cloud.sdk.core.http.HttpMediaType; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.BasicAuthenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.cloud.sdk.core.service.exception.BadRequestException; @@ -228,7 +229,7 @@ public void setup() throws Exception { super.setUp(); String apiKey = getProperty("discovery.apikey"); String url = getProperty("discovery.url"); - IamAuthenticator authenticator = new IamAuthenticator(apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey); discovery = new Discovery("2018-05-23", authenticator); discovery.setEndPoint(url); discovery.setDefaultHeaders(getDefaultHeaders()); diff --git a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java index dcf109bb7a4..9c42ee3fb3e 100644 --- a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java +++ b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java @@ -16,6 +16,7 @@ import com.google.common.collect.ImmutableMap; import com.ibm.cloud.sdk.core.http.HttpMediaType; import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonHttpHeaders; import com.ibm.watson.common.WatsonServiceTest; @@ -81,7 +82,7 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", (iamApiKey == null)); - IamAuthenticator authenticator = new IamAuthenticator(iamApiKey); + Authenticator authenticator = new IamAuthenticator(iamApiKey); service = new LanguageTranslator("2018-05-01", authenticator); service.setEndPoint(getProperty("language_translator.url")); diff --git a/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java b/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java index 75bc864396f..f330041e153 100644 --- a/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java +++ b/natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierIT.java @@ -12,6 +12,7 @@ */ package com.ibm.watson.natural_language_classifier.v1; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.cloud.sdk.core.service.exception.NotFoundException; import com.ibm.watson.common.WatsonServiceTest; @@ -64,7 +65,7 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - IamAuthenticator authenticator = new IamAuthenticator(apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey); service = new NaturalLanguageClassifier(authenticator); service.setDefaultHeaders(getDefaultHeaders()); service.setEndPoint(getProperty("natural_language_classifier.url")); diff --git a/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java b/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java index f6858eab373..7b8419dbf7f 100644 --- a/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java +++ b/natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstandingIT.java @@ -13,6 +13,7 @@ package com.ibm.watson.natural_language_understanding.v1; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; @@ -77,7 +78,7 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - IamAuthenticator authenticator = new IamAuthenticator(apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey); service = new NaturalLanguageUnderstanding("2018-11-16", authenticator); service.setDefaultHeaders(getDefaultHeaders()); service.setEndPoint(getProperty("natural_language_understanding.url")); diff --git a/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java b/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java index 2e180b67d84..c2f19074f17 100644 --- a/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java +++ b/personality-insights/src/test/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsIT.java @@ -13,6 +13,7 @@ package com.ibm.watson.personality_insights.v3; import com.google.common.io.CharStreams; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.personality_insights.v3.model.ConsumptionPreferences; @@ -56,7 +57,7 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - IamAuthenticator authenticator = new IamAuthenticator(apiKey); + Authenticator authenticator = new IamAuthenticator(apiKey); service = new PersonalityInsights(VERSION_DATE_2016_10_19, authenticator); service.setEndPoint(getProperty("personality_insights.url")); service.setDefaultHeaders(getDefaultHeaders()); diff --git a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java index c1d42ec7578..ef7d84be320 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java +++ b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java @@ -13,6 +13,7 @@ package com.ibm.watson.speech_to_text.v1; import com.ibm.cloud.sdk.core.http.HttpMediaType; +import com.ibm.cloud.sdk.core.security.Authenticator; import com.ibm.cloud.sdk.core.security.BasicAuthenticator; import com.ibm.cloud.sdk.core.service.exception.NotFoundException; import com.ibm.watson.common.RetryRunner; @@ -131,7 +132,7 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", username == null); - BasicAuthenticator authenticator = new BasicAuthenticator(username, password); + Authenticator authenticator = new BasicAuthenticator(username, password); service = new SpeechToText(authenticator); service.setEndPoint(getProperty("speech_to_text.url")); service.setDefaultHeaders(getDefaultHeaders()); From 7b7b13885b2839f8159e73e454366e2245a2cfe2 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:23:15 -0400 Subject: [PATCH 17/28] chore(Text to Speech): Apply manual changes --- .../text_to_speech/v1/TextToSpeech.java | 30 +++++++++++++++++ .../v1/model/SynthesizeOptions.java | 33 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index deef07e60a3..636bce7b2d9 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -42,6 +42,13 @@ import com.ibm.watson.text_to_speech.v1.model.VoiceModels; import com.ibm.watson.text_to_speech.v1.model.Voices; import com.ibm.watson.text_to_speech.v1.model.Words; +import com.ibm.watson.text_to_speech.v1.websocket.SynthesizeCallback; +import com.ibm.watson.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.WebSocket; + import java.io.InputStream; import java.util.Map; import java.util.Map.Entry; @@ -265,6 +272,29 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) return createServiceCall(builder.build(), responseConverter); } + public WebSocket synthesizeUsingWebSocket(SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { + com.ibm.cloud.sdk.core.util.Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); + + HttpUrl.Builder urlBuilder = HttpUrl.parse(getEndPoint() + "/v1/synthesize").newBuilder(); + + if (synthesizeOptions.voice() != null) { + urlBuilder.addQueryParameter("voice", synthesizeOptions.voice()); + } + if (synthesizeOptions.customizationId() != null) { + urlBuilder.addQueryParameter("customization_id", synthesizeOptions.customizationId()); + } + + String url = urlBuilder.toString().replace("https://", "wss://"); + Request.Builder builder = new Request.Builder().url(url); + + setAuthentication(builder); + setDefaultHeaders(builder); + + OkHttpClient client = configureHttpClient(); + return client.newWebSocket(builder.build(), new TextToSpeechWebSocketListener(synthesizeOptions, callback)); + } + /** * Get pronunciation. * diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java index d2dd5894c67..ab138aefa0e 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java @@ -14,6 +14,8 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + /** * The synthesize options. */ @@ -119,6 +121,7 @@ public interface Voice { private String accept; private String voice; private String customizationId; + private List timings; /** * Builder. @@ -128,12 +131,14 @@ public static class Builder { private String accept; private String voice; private String customizationId; + private List timings; private Builder(SynthesizeOptions synthesizeOptions) { this.text = synthesizeOptions.text; this.accept = synthesizeOptions.accept; this.voice = synthesizeOptions.voice; this.customizationId = synthesizeOptions.customizationId; + this.timings = synthesizeOptions.timings; } /** @@ -203,6 +208,17 @@ public Builder customizationId(String customizationId) { this.customizationId = customizationId; return this; } + + /** + * Set the timings. + * + * @param timings the timings + * @return the SynthesizeOptions builder + */ + public Builder timings(List timings) { + this.timings = timings; + return this; + } } private SynthesizeOptions(Builder builder) { @@ -212,6 +228,7 @@ private SynthesizeOptions(Builder builder) { accept = builder.accept; voice = builder.voice; customizationId = builder.customizationId; + timings = builder.timings; } /** @@ -271,4 +288,20 @@ public String voice() { public String customizationId() { return customizationId; } + + /** + * Gets the timings. + * + * An array that specifies whether the service is to return word timing information for all strings of the input + * text. Specify `words` as the element of the array to request word timing information. The service returns the + * start and end time of each word of the input. Specify an empty array or omit the parameter to receive no word + * timing information. Not supported for Japanese input text. + * + * NOTE: This parameter only works for the `synthesizeUsingWebSocket` method. + * + * @return the timings + */ + public List getTimings() { + return timings; + } } From 873369f2a02342a5856eadefb31423cd21bc8240 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:24:26 -0400 Subject: [PATCH 18/28] test(Text to Speech): Update tests --- .../text_to_speech/v1/CustomizationsIT.java | 84 ++++++++++--------- .../text_to_speech/v1/CustomizationsTest.java | 43 ++++------ .../text_to_speech/v1/TextToSpeechIT.java | 10 +-- .../text_to_speech/v1/TextToSpeechTest.java | 8 +- 4 files changed, 67 insertions(+), 78 deletions(-) diff --git a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsIT.java b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsIT.java index 8ca56afdeef..c4133e9465c 100755 --- a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsIT.java +++ b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsIT.java @@ -13,8 +13,9 @@ package com.ibm.watson.text_to_speech.v1; import com.google.common.collect.ImmutableList; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.cloud.sdk.core.service.exception.UnauthorizedException; -import com.ibm.cloud.sdk.core.service.security.IamOptions; import com.ibm.watson.common.TestUtils; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.text_to_speech.v1.model.AddWordOptions; @@ -76,34 +77,35 @@ public void setUp() throws Exception { String apiKey = getProperty("text_to_speech.apikey"); Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new TextToSpeech(); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); + Authenticator authenticator = new IamAuthenticator(apiKey); + service = new TextToSpeech(authenticator); service.setEndPoint(getProperty("text_to_speech.url")); service.setDefaultHeaders(getDefaultHeaders()); } private List instantiateWords() { - Word word1 = new Word(); - word1.setWord("hodor"); - word1.setTranslation("hold the door"); - Word word2 = new Word(); - word2.setWord("shocking"); - word2.setTranslation(""); + Word word1 = new Word.Builder() + .word("hodor") + .translation("hold the door") + .build(); + Word word2 = new Word.Builder() + .word("shocking") + .translation("") + .build(); return ImmutableList.of(word1, word2); } private List instantiateWordsJapanese() { - Word word1 = new Word(); - word1.setWord("hodor"); - word1.setTranslation("hold the door"); - word1.setPartOfSpeech(Word.PartOfSpeech.JOSI); - Word word2 = new Word(); - word2.setWord("clodor"); - word2.setTranslation("close the door"); - word2.setPartOfSpeech(Word.PartOfSpeech.HOKA); + Word word1 = new Word.Builder() + .word("hodor") + .translation("hold the door") + .partOfSpeech(Word.PartOfSpeech.JOSI) + .build(); + Word word2 = new Word.Builder() + .word("clodor") + .translation("close the door") + .partOfSpeech(Word.PartOfSpeech.HOKA) + .build(); return ImmutableList.of(word1, word2); } @@ -359,8 +361,8 @@ public void testAddWord() { final Word expected = instantiateWords().get(0); AddWordOptions addOptions = new AddWordOptions.Builder() - .word(expected.getWord()) - .translation(expected.getTranslation()) + .word(expected.word()) + .translation(expected.translation()) .customizationId(model.getCustomizationId()) .build(); service.addWord(addOptions).execute().getResult(); @@ -369,12 +371,12 @@ public void testAddWord() { .customizationId(model.getCustomizationId()) .build(); final Words results = service.listWords(listOptions).execute().getResult(); - assertEquals(1, results.getWords().size()); + assertEquals(1, results.words().size()); - final Word result = results.getWords().get(0); + final Word result = results.words().get(0); assertEquals(expected, result); - assertEquals(expected.getWord(), result.getWord()); - assertEquals(expected.getTranslation(), result.getTranslation()); + assertEquals(expected.word(), result.word()); + assertEquals(expected.translation(), result.translation()); } /** @@ -396,7 +398,7 @@ public void testAddWords() { .customizationId(model.getCustomizationId()) .build(); final Words words = service.listWords(listOptions).execute().getResult(); - assertEquals(expected.size(), words.getWords().size()); + assertEquals(expected.size(), words.words().size()); } /** @@ -418,7 +420,7 @@ public void testAddWordsJapanese() { .customizationId(model.getCustomizationId()) .build(); final Words words = service.listWords(listOptions).execute().getResult(); - assertEquals(expected.size(), words.getWords().size()); + assertEquals(expected.size(), words.words().size()); } /** @@ -438,10 +440,10 @@ public void testGetWord() { GetWordOptions getOptions = new GetWordOptions.Builder() .customizationId(model.getCustomizationId()) - .word(expected.get(0).getWord()) + .word(expected.get(0).word()) .build(); final Translation translation = service.getWord(getOptions).execute().getResult(); - assertEquals(expected.get(0).getTranslation(), translation.getTranslation()); + assertEquals(expected.get(0).translation(), translation.translation()); } /** @@ -461,11 +463,11 @@ public void testGetWordJapanese() { GetWordOptions getOptions = new GetWordOptions.Builder() .customizationId(model.getCustomizationId()) - .word(expected.get(0).getWord()) + .word(expected.get(0).word()) .build(); final Translation translation = service.getWord(getOptions).execute().getResult(); - assertEquals(expected.get(0).getTranslation(), translation.getTranslation()); - assertEquals(expected.get(0).getPartOfSpeech(), translation.getPartOfSpeech()); + assertEquals(expected.get(0).translation(), translation.translation()); + assertEquals(expected.get(0).partOfSpeech(), translation.partOfSpeech()); } /** @@ -478,14 +480,14 @@ public void testDeleteWord() { final Word expected = instantiateWords().get(0); AddWordOptions addOptions = new AddWordOptions.Builder() - .word(expected.getWord()) - .translation(expected.getTranslation()) + .word(expected.word()) + .translation(expected.translation()) .customizationId(model.getCustomizationId()) .build(); service.addWord(addOptions).execute().getResult(); DeleteWordOptions deleteOptions = new DeleteWordOptions.Builder() .customizationId(model.getCustomizationId()) - .word(expected.getWord()) + .word(expected.word()) .build(); service.deleteWord(deleteOptions).execute(); @@ -493,7 +495,7 @@ public void testDeleteWord() { .customizationId(model.getCustomizationId()) .build(); final Words results = service.listWords(listOptions).execute().getResult(); - assertEquals(0, results.getWords().size()); + assertEquals(0, results.words().size()); } /** @@ -508,19 +510,19 @@ public void testSynthesize() throws IOException { final Word expected = instantiateWords().get(0); AddWordOptions addOptions = new AddWordOptions.Builder() - .word(expected.getWord()) - .translation(expected.getTranslation()) + .word(expected.word()) + .translation(expected.translation()) .customizationId(model.getCustomizationId()) .build(); service.addWord(addOptions).execute().getResult(); SynthesizeOptions synthesizeOptions1 = new SynthesizeOptions.Builder() - .text(expected.getWord()) + .text(expected.word()) .voice(SynthesizeOptions.Voice.EN_US_MICHAELVOICE) .accept(SynthesizeOptions.Accept.AUDIO_WAV) .build(); final InputStream stream1 = service.synthesize(synthesizeOptions1).execute().getResult(); SynthesizeOptions synthesizeOptions2 = new SynthesizeOptions.Builder() - .text(expected.getWord()) + .text(expected.word()) .voice(SynthesizeOptions.Voice.EN_US_MICHAELVOICE) .accept(SynthesizeOptions.Accept.AUDIO_WAV) .customizationId(model.getCustomizationId()) diff --git a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsTest.java b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsTest.java index 22b34693faa..c76fd22a97a 100755 --- a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsTest.java +++ b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/CustomizationsTest.java @@ -14,7 +14,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.text_to_speech.v1.model.AddWordOptions; import com.ibm.watson.text_to_speech.v1.model.AddWordsOptions; @@ -82,11 +82,7 @@ public class CustomizationsTest extends WatsonServiceUnitTest { public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new TextToSpeech(authConfig); + service = new TextToSpeech(new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); voiceModel = loadFixture("src/test/resources/text_to_speech/voice_model.json", VoiceModel.class); @@ -95,18 +91,15 @@ public void setUp() throws Exception { voice = loadFixture("src/test/resources/text_to_speech/voice.json", Voice.class); } - private static List instantiateWords() { - Word word = new Word(); - word.setWord("hodor"); - word.setTranslation("hold the door"); - return ImmutableList.of(word); + private static Word instantiateWord() { + return new Word.Builder() + .word("hodor") + .translation("hold the door") + .build(); } - private static Word instantiateWord() { - Word word = new Word(); - word.setWord("hodor"); - word.setTranslation("hold the door"); - return word; + private static List instantiateWords() { + return ImmutableList.of(instantiateWord()); } /** @@ -366,7 +359,7 @@ public void testListWords() throws InterruptedException { assertEquals(String.format(WORDS_PATH, CUSTOMIZATION_ID), request.getPath()); assertEquals("GET", request.getMethod()); - assertEquals(expected, result.getWords()); + assertEquals(expected, result.words()); } /** @@ -378,17 +371,17 @@ public void testListWords() throws InterruptedException { public void testGetWord() throws InterruptedException { final Word expected = instantiateWords().get(0); - server.enqueue(jsonResponse(ImmutableMap.of(TRANSLATION, expected.getTranslation()))); + server.enqueue(jsonResponse(ImmutableMap.of(TRANSLATION, expected.translation()))); GetWordOptions getOptions = new GetWordOptions.Builder() .customizationId(CUSTOMIZATION_ID) - .word(expected.getWord()) + .word(expected.word()) .build(); final Translation result = service.getWord(getOptions).execute().getResult(); final RecordedRequest request = server.takeRequest(); - assertEquals(String.format(WORDS_PATH, CUSTOMIZATION_ID) + "/" + expected.getWord(), request.getPath()); + assertEquals(String.format(WORDS_PATH, CUSTOMIZATION_ID) + "/" + expected.word(), request.getPath()); assertEquals("GET", request.getMethod()); - assertEquals(expected.getTranslation(), result.getTranslation()); + assertEquals(expected.translation(), result.translation()); } /** @@ -424,13 +417,13 @@ public void testAddWord() throws InterruptedException { server.enqueue(new MockResponse().setResponseCode(201)); AddWordOptions addOptions = new AddWordOptions.Builder() .customizationId(CUSTOMIZATION_ID) - .word(expected.getWord()) - .translation(expected.getTranslation()) + .word(expected.word()) + .translation(expected.translation()) .build(); service.addWord(addOptions).execute().getResult(); RecordedRequest request = server.takeRequest(); - assertEquals(String.format(WORD_PATH, CUSTOMIZATION_ID, expected.getWord()), request.getPath()); + assertEquals(String.format(WORD_PATH, CUSTOMIZATION_ID, expected.word()), request.getPath()); assertEquals("PUT", request.getMethod()); } @@ -441,7 +434,7 @@ public void testAddWord() throws InterruptedException { */ @Test public void testDeleteWord() throws InterruptedException { - final String expected = instantiateWords().get(0).getWord(); + final String expected = instantiateWords().get(0).word(); server.enqueue(new MockResponse().setResponseCode(204)); DeleteWordOptions deleteOptions = new DeleteWordOptions.Builder() diff --git a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechIT.java b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechIT.java index abd3d2d33f9..2053f8edd63 100644 --- a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechIT.java +++ b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechIT.java @@ -13,7 +13,8 @@ package com.ibm.watson.text_to_speech.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.text_to_speech.v1.model.DeleteUserDataOptions; @@ -78,11 +79,8 @@ public void setUp() throws Exception { String apiKey = getProperty("text_to_speech.apikey"); Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new TextToSpeech(); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); + Authenticator authenticator = new IamAuthenticator(apiKey); + service = new TextToSpeech(authenticator); service.setEndPoint(getProperty("text_to_speech.url")); service.setDefaultHeaders(getDefaultHeaders()); voiceName = getProperty("text_to_speech.voice_name"); diff --git a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechTest.java b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechTest.java index ba188c95f49..dabc6f3a0f4 100644 --- a/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechTest.java +++ b/text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1/TextToSpeechTest.java @@ -15,7 +15,7 @@ import com.google.common.io.Files; import com.google.gson.Gson; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.watson.common.TestUtils; import com.ibm.watson.common.WatsonServiceUnitTest; @@ -105,11 +105,7 @@ private static void writeInputStreamToOutputStream(InputStream inputStream, Outp public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new TextToSpeech(authConfig); + service = new TextToSpeech(new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); getVoiceResponse = loadFixture("src/test/resources/text_to_speech/get_voice_response.json", Voice.class); From 1db8776a4ea9fee572e8f92ac83ef7d3ffbab8f8 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:26:52 -0400 Subject: [PATCH 19/28] test(Tone Analyzer): Update tests --- .../ibm/watson/tone_analyzer/v3/ToneAnalyzerIT.java | 10 ++++------ .../watson/tone_analyzer/v3/ToneAnalyzerTest.java | 13 +++---------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerIT.java b/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerIT.java index 033ec1665eb..99d04c9395e 100755 --- a/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerIT.java +++ b/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerIT.java @@ -13,7 +13,8 @@ package com.ibm.watson.tone_analyzer.v3; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.tone_analyzer.v3.model.ToneAnalysis; @@ -65,11 +66,8 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null); - service = new ToneAnalyzer(VERSION_DATE_VALUE); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(apiKey) - .build(); - service.setIamCredentials(iamOptions); + Authenticator authenticator = new IamAuthenticator(apiKey); + service = new ToneAnalyzer(VERSION_DATE_VALUE, authenticator); service.setEndPoint(getProperty("tone_analyzer.url")); service.setDefaultHeaders(getDefaultHeaders()); diff --git a/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java b/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java index b640858b7cf..c6aea8e3566 100644 --- a/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java +++ b/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java @@ -14,7 +14,7 @@ import com.ibm.cloud.sdk.core.http.HttpHeaders; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.cloud.sdk.core.util.RequestUtils; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.tone_analyzer.v3.model.ToneAnalysis; @@ -58,11 +58,7 @@ public class ToneAnalyzerTest extends WatsonServiceUnitTest { @Before public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new ToneAnalyzer(VERSION_DATE_VALUE, authConfig); + service = new ToneAnalyzer(VERSION_DATE_VALUE, new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); } @@ -73,8 +69,7 @@ public void setUp() throws Exception { @Test public void testReadme() throws InterruptedException, IOException { - ToneAnalyzer service = new ToneAnalyzer(VERSION_DATE); - service.setUsernameAndPassword("", ""); + ToneAnalyzer service = new ToneAnalyzer(VERSION_DATE, new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); // exclude ToneAnalysis mockResponse = loadFixture(FIXTURE, ToneAnalysis.class); // exclude @@ -132,7 +127,6 @@ public void testtones() throws InterruptedException, IOException { String path = StringUtils.join(TONE_PATH, "?", VERSION_DATE, "=", VERSION_DATE_VALUE); assertEquals(path, request.getPath()); - assertNotNull(request.getHeader(HttpHeaders.AUTHORIZATION)); assertEquals(serviceResponse, mockResponse); assertEquals(HttpMediaType.APPLICATION_JSON, request.getHeader(HttpHeaders.ACCEPT)); @@ -201,7 +195,6 @@ public void testGetChatTones() throws IOException, InterruptedException { String path = StringUtils.join(CHAT_TONE_PATH, "?", VERSION_DATE, "=", VERSION_DATE_VALUE); assertEquals(path, request.getPath()); - assertNotNull(request.getHeader(HttpHeaders.AUTHORIZATION)); assertEquals(serviceResponse, mockResponse); assertEquals(HttpMediaType.APPLICATION_JSON, request.getHeader(HttpHeaders.ACCEPT)); } From 79dfdf1e8cdbcbeb26c3129f9ef096e1ae41b410 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:28:45 -0400 Subject: [PATCH 20/28] test(Visual Recognition): Update tests --- .../visual_recognition/v3/VisualRecognitionIT.java | 10 ++++------ .../visual_recognition/v3/VisualRecognitionTest.java | 8 ++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionIT.java b/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionIT.java index 1417b7ce815..4e2dc9e5806 100644 --- a/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionIT.java +++ b/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionIT.java @@ -12,7 +12,8 @@ */ package com.ibm.watson.visual_recognition.v3; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.common.RetryRunner; import com.ibm.watson.common.WatsonServiceTest; import com.ibm.watson.visual_recognition.v3.model.ClassifiedImages; @@ -115,11 +116,8 @@ public void setUp() throws Exception { String url = getProperty("visual_recognition.url"); classifierId = getProperty("visual_recognition.classifier_id"); - service = new VisualRecognition(VERSION); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey(iamApiKey) - .build(); - service.setIamCredentials(iamOptions); + Authenticator authenticator = new IamAuthenticator(iamApiKey); + service = new VisualRecognition(VERSION, authenticator); service.setDefaultHeaders(getDefaultHeaders()); service.setEndPoint(url); } diff --git a/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionTest.java b/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionTest.java index 21c3f8c79d3..c256a52480e 100644 --- a/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionTest.java +++ b/visual-recognition/src/test/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionTest.java @@ -16,7 +16,7 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.basicauth.BasicAuthConfig; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.common.WatsonServiceUnitTest; import com.ibm.watson.visual_recognition.v3.model.ClassifiedImages; import com.ibm.watson.visual_recognition.v3.model.Classifier; @@ -78,11 +78,7 @@ public class VisualRecognitionTest extends WatsonServiceUnitTest { public void setUp() throws Exception { super.setUp(); - BasicAuthConfig authConfig = new BasicAuthConfig.Builder() - .username("") - .password("") - .build(); - service = new VisualRecognition(VERSION, authConfig); + service = new VisualRecognition(VERSION, new NoAuthAuthenticator()); service.setEndPoint(getMockWebServerUrl()); } From 1e33378d93d45f01018780379141a90f54518669 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:29:00 -0400 Subject: [PATCH 21/28] build: Update core dependency --- assistant/build.gradle | 2 +- common/build.gradle | 2 +- compare-comply/build.gradle | 2 +- discovery/build.gradle | 2 +- language-translator/build.gradle | 2 +- natural-language-classifier/build.gradle | 2 +- natural-language-understanding/build.gradle | 2 +- personality-insights/build.gradle | 2 +- speech-to-text/build.gradle | 2 +- text-to-speech/build.gradle | 2 +- tone-analyzer/build.gradle | 2 +- visual-recognition/build.gradle | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/assistant/build.gradle b/assistant/build.gradle index 514ea1646ef..884fc2e614d 100644 --- a/assistant/build.gradle +++ b/assistant/build.gradle @@ -60,7 +60,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/common/build.gradle b/common/build.gradle index 0cab1da43bd..d2383828206 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -58,7 +58,7 @@ checkstyle { } dependencies { - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/compare-comply/build.gradle b/compare-comply/build.gradle index 514ea1646ef..884fc2e614d 100644 --- a/compare-comply/build.gradle +++ b/compare-comply/build.gradle @@ -60,7 +60,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/discovery/build.gradle b/discovery/build.gradle index 97c76151ee6..402f5d73922 100644 --- a/discovery/build.gradle +++ b/discovery/build.gradle @@ -64,7 +64,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/language-translator/build.gradle b/language-translator/build.gradle index f7ee74b8ece..6f80fd8e8ec 100644 --- a/language-translator/build.gradle +++ b/language-translator/build.gradle @@ -60,7 +60,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/natural-language-classifier/build.gradle b/natural-language-classifier/build.gradle index 97c76151ee6..402f5d73922 100644 --- a/natural-language-classifier/build.gradle +++ b/natural-language-classifier/build.gradle @@ -64,7 +64,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/natural-language-understanding/build.gradle b/natural-language-understanding/build.gradle index f7ee74b8ece..6f80fd8e8ec 100644 --- a/natural-language-understanding/build.gradle +++ b/natural-language-understanding/build.gradle @@ -60,7 +60,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/personality-insights/build.gradle b/personality-insights/build.gradle index f7ee74b8ece..6f80fd8e8ec 100644 --- a/personality-insights/build.gradle +++ b/personality-insights/build.gradle @@ -60,7 +60,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/speech-to-text/build.gradle b/speech-to-text/build.gradle index 97c76151ee6..402f5d73922 100644 --- a/speech-to-text/build.gradle +++ b/speech-to-text/build.gradle @@ -64,7 +64,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/text-to-speech/build.gradle b/text-to-speech/build.gradle index f7ee74b8ece..6f80fd8e8ec 100644 --- a/text-to-speech/build.gradle +++ b/text-to-speech/build.gradle @@ -60,7 +60,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/tone-analyzer/build.gradle b/tone-analyzer/build.gradle index f7ee74b8ece..6f80fd8e8ec 100644 --- a/tone-analyzer/build.gradle +++ b/tone-analyzer/build.gradle @@ -60,7 +60,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } diff --git a/visual-recognition/build.gradle b/visual-recognition/build.gradle index 97c76151ee6..402f5d73922 100644 --- a/visual-recognition/build.gradle +++ b/visual-recognition/build.gradle @@ -64,7 +64,7 @@ checkstyle { dependencies { compile project(':common') testCompile project(':common').sourceSets.test.output - compile 'com.ibm.cloud:sdk-core:4.5.0' + compile 'com.ibm.cloud:sdk-core:7.0.0-rc1' signature 'org.codehaus.mojo.signature:java17:1.0@signature' } From 5a70ef66d101c26ba26184cda05343d46526673c Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 14:49:16 -0400 Subject: [PATCH 22/28] style: Address checkstyle complaints --- .../v1/model/CreateDialogNodeOptions.java | 3 +- .../assistant/v1/model/CreateValue.java | 3 +- .../v1/model/CreateValueOptions.java | 3 +- .../watson/assistant/v1/model/DialogNode.java | 3 +- .../assistant/v1/model/DialogNodeAction.java | 5 +-- .../assistant/v1/model/DialogNodeOutput.java | 3 +- .../assistant/v1/model/SystemResponse.java | 1 - .../v1/model/UpdateDialogNodeOptions.java | 3 +- .../v1/model/UpdateValueOptions.java | 3 +- .../ibm/watson/assistant/v1/model/Value.java | 3 +- .../v1/model/WorkspaceSystemSettings.java | 5 +-- .../assistant/v2/model/DialogNodeAction.java | 5 +-- .../assistant/v2/model/DialogSuggestion.java | 5 +-- .../v2/model/MessageContextSkill.java | 5 +-- .../v2/model/MessageContextSkills.java | 1 - .../watson/assistant/v1/AssistantTest.java | 1 - .../compare_comply/v1/CompareComply.java | 4 +- .../discovery/v1/model/CredentialDetails.java | 8 +++- .../discovery/v1/model/DocumentSnapshot.java | 5 +-- .../watson/discovery/v1/model/Enrichment.java | 3 +- .../v1/model/NluEnrichmentCategories.java | 1 - .../discovery/v1/model/QueryResult.java | 5 +-- .../model/GetTranslatedDocumentOptions.java | 9 ++-- .../v3/model/TranslateDocumentOptions.java | 4 +- .../v1/model/CreateClassifierOptions.java | 4 +- .../v1/NaturalLanguageUnderstanding.java | 11 +++-- .../v1/model/AnalyzeOptions.java | 12 ++++-- .../v1/model/CategoriesOptions.java | 4 +- .../v1/model/CategoriesResult.java | 4 +- .../v1/model/EntitiesOptions.java | 8 +++- .../v1/model/Features.java | 8 +++- .../v1/model/RelationsOptions.java | 7 +++- .../v3/PersonalityInsights.java | 3 +- .../speech_to_text/v1/SpeechToText.java | 42 +++++++++++++------ .../v1/model/CreateAcousticModelOptions.java | 6 ++- .../v1/model/CreateLanguageModelOptions.java | 6 ++- .../speech_to_text/v1/SpeechToTextTest.java | 4 +- .../text_to_speech/v1/TextToSpeech.java | 7 +++- .../tone_analyzer/v3/ToneAnalyzerTest.java | 1 - .../v3/VisualRecognition.java | 4 +- 40 files changed, 142 insertions(+), 80 deletions(-) diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java index 308755b901f..b3e46c00f71 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateDialogNodeOptions.java @@ -555,7 +555,8 @@ public String previousSibling() { * Gets the output. * * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). * * @return the output */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java index 7ac07a25cee..a0535b9ab62 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValue.java @@ -276,7 +276,8 @@ public List synonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the patterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java index 4a0cca456b5..b5a07562331 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/CreateValueOptions.java @@ -305,7 +305,8 @@ public List synonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the patterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java index 56f65df14fa..7dc886e0847 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNode.java @@ -552,7 +552,8 @@ public String previousSibling() { * Gets the output. * * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). * * @return the output */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java index 06fd35062b1..a78b3310647 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeAction.java @@ -12,12 +12,11 @@ */ package com.ibm.watson.assistant.v1.model; -import java.util.List; -import java.util.Map; - import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.Map; + /** * DialogNodeAction. */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java index ffc2ebb9d6a..40c931fbf69 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutput.java @@ -20,7 +20,8 @@ /** * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). */ public class DialogNodeOutput extends DynamicModel { @SerializedName("generic") diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java index 9edc0346413..82f988db403 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/SystemResponse.java @@ -12,7 +12,6 @@ */ package com.ibm.watson.assistant.v1.model; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java index 97244b6b312..35fa23ad1ec 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateDialogNodeOptions.java @@ -553,7 +553,8 @@ public String newPreviousSibling() { * Gets the newOutput. * * The output of the dialog node. For more information about how to specify dialog node output, see the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). * * @return the newOutput */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java index 39fca761963..e3e5d314ba6 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/UpdateValueOptions.java @@ -331,7 +331,8 @@ public List newSynonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the newPatterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java index d4da9369e5f..c5893ab3700 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/Value.java @@ -280,7 +280,8 @@ public List synonyms() { * An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the value * type), but not both. A pattern is a regular expression; for more information about how to specify a pattern, see * the - * [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + * [documentation] + * (https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). * * @return the patterns */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java index be25743507a..fa5724b9cdd 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java @@ -12,12 +12,11 @@ */ package com.ibm.watson.assistant.v1.model; -import java.util.List; -import java.util.Map; - import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.Map; + /** * Global settings for the workspace. */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java index 832e64af670..eb8c1fea0bb 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogNodeAction.java @@ -12,12 +12,11 @@ */ package com.ibm.watson.assistant.v2.model; -import java.util.List; -import java.util.Map; - import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.Map; + /** * DialogNodeAction. */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java index 6e55e57d0e6..b69d89b3113 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java @@ -12,11 +12,10 @@ */ package com.ibm.watson.assistant.v2.model; -import java.util.List; -import java.util.Map; - import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.Map; + /** * DialogSuggestion. */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java index 615ae5b0afd..c432d4b9bfc 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java @@ -12,12 +12,11 @@ */ package com.ibm.watson.assistant.v2.model; -import java.util.List; -import java.util.Map; - import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.Map; + /** * Contains information specific to a particular skill used by the Assistant. */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java index 15786f3798c..16a72b30f57 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkills.java @@ -12,7 +12,6 @@ */ package com.ibm.watson.assistant.v2.model; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; diff --git a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java index dc32a1714d5..e2bc0d68983 100644 --- a/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java +++ b/assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java @@ -12,7 +12,6 @@ */ package com.ibm.watson.assistant.v1; -import com.ibm.cloud.sdk.core.http.HttpHeaders; import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.watson.assistant.v1.model.Context; import com.ibm.watson.assistant.v1.model.Counterexample; diff --git a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java index e0cb2554fc6..29f1fb82484 100644 --- a/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java +++ b/compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/CompareComply.java @@ -410,7 +410,9 @@ public ServiceCall deleteFeedback(DeleteFeedbackOptions deleteF * Run Compare and Comply methods over a collection of input documents. * * **Important:** Batch processing requires the use of the [IBM Cloud Object Storage - * service](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage). + * service] + * (https://cloud.ibm.com/docs/services/cloud-object-storage? + * topic=cloud-object-storage-about#about-ibm-cloud-object-storage). * The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using batch * processing](https://cloud.ibm.com/docs/services/compare-comply?topic=compare-comply-batching#before-you-batch). * diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java index 5a058847054..a87ba2e186d 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java @@ -618,7 +618,9 @@ public String endpoint() { * The access key ID associated with the cloud object store. Only valid, and required, with a **credential_type** of * `aws4_hmac`. This value is never returned and is only used when creating or modifying **credentials**. For more * infomation, see the [cloud object store - * documentation](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). + * documentation] + * (https://cloud.ibm.com/docs/services/cloud-object-storage? + * topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). * * @return the accessKeyId */ @@ -632,7 +634,9 @@ public String accessKeyId() { * The secret access key associated with the cloud object store. Only valid, and required, with a **credential_type** * of `aws4_hmac`. This value is never returned and is only used when creating or modifying **credentials**. For more * infomation, see the [cloud object store - * documentation](https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). + * documentation] + * (https://cloud.ibm.com/docs/services/cloud-object-storage? + * topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). * * @return the secretAccessKey */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java index e3885ea75ff..89481123e84 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentSnapshot.java @@ -12,11 +12,10 @@ */ package com.ibm.watson.discovery.v1.model; -import java.util.List; -import java.util.Map; - import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.Map; + /** * DocumentSnapshot. */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java index 7162542f884..cd9f35fc5d5 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java @@ -244,7 +244,8 @@ public Boolean overwrite() { * When using `elements` the **options** object must contain Element Classification options. Additionally, when using * the `elements` enrichment the configuration specified and files ingested must meet all the criteria specified in * [the - * documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-element-classification#element-classification). + * documentation] + * (https://cloud.ibm.com/docs/services/discovery?topic=discovery-element-classification#element-classification). * * @return the enrichment */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java index 5242d80b6e9..b7b6e239db1 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentCategories.java @@ -12,7 +12,6 @@ */ package com.ibm.watson.discovery.v1.model; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java index e5f935f56a3..97f0dc84739 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java @@ -12,13 +12,12 @@ */ package com.ibm.watson.discovery.v1.model; -import java.util.List; -import java.util.Map; - import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.ibm.cloud.sdk.core.service.model.DynamicModel; +import java.util.Map; + /** * QueryResult. */ diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java index 3227e87c918..7f1bd052428 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/GetTranslatedDocumentOptions.java @@ -43,15 +43,18 @@ public interface Accept { /** application/vnd.ms-excel. */ String APPLICATION_VND_MS_EXCEL = "application/vnd.ms-excel"; /** application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. */ - String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET + = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; /** application/vnd.ms-powerpoint. */ String APPLICATION_VND_MS_POWERPOINT = "application/vnd.ms-powerpoint"; /** application/vnd.openxmlformats-officedocument.presentationml.presentation. */ - String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; + String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION + = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; /** application/msword. */ String APPLICATION_MSWORD = "application/msword"; /** application/vnd.openxmlformats-officedocument.wordprocessingml.document. */ - String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; + String APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT + = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; /** application/vnd.oasis.opendocument.spreadsheet. */ String APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET = "application/vnd.oasis.opendocument.spreadsheet"; /** application/vnd.oasis.opendocument.presentation. */ diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java index 90eb13ce329..84a2c838e20 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java @@ -201,7 +201,9 @@ public Builder newBuilder() { * The source file to translate. * * [Supported file - * types](https://cloud.ibm.com/docs/services/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats) + * types] + * (https://cloud.ibm.com/docs/services/language-translator + * ?topic=language-translator-document-translator-tutorial#supported-file-formats) * * Maximum file size: **20 MB**. * diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java index d08f3c8882a..eeaaef0bf49 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/CreateClassifierOptions.java @@ -152,7 +152,9 @@ public InputStream trainingMetadata() { * * Training data in CSV format. Each text value must have at least one class. The data can include up to 3,000 classes * and 20,000 records. For details, see [Data - * preparation](https://cloud.ibm.com/docs/services/natural-language-classifier?topic=natural-language-classifier-using-your-data). + * preparation] + * (https://cloud.ibm.com/docs/services/natural-language-classifier + * ?topic=natural-language-classifier-using-your-data). * * @return the trainingData */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java index dab26834e12..b701b1ec88b 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java @@ -35,7 +35,8 @@ * analysis by default, so the results can ignore most advertisements and other unwanted content. * * You can create [custom - * models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) + * models] + * (https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) * with Watson Knowledge Studio to detect custom entities, relations, and categories in Natural Language Understanding. * * @version v1 @@ -135,7 +136,9 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { * List models. * * Lists Watson Knowledge Studio [custom entities and relations - * models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) + * models] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-customizing) * that are deployed to your Natural Language Understanding service. * * @param listModelsOptions the {@link ListModelsOptions} containing the options for the call @@ -162,7 +165,9 @@ public ServiceCall listModels(ListModelsOptions listModelsOpt * List models. * * Lists Watson Knowledge Studio [custom entities and relations - * models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) + * models] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-customizing) * that are deployed to your Natural Language Understanding service. * * @return a {@link ServiceCall} with a response type of {@link ListModelsResults} diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java index 4d1d2c7d92c..dfe004b5a49 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java @@ -265,7 +265,9 @@ public String url() { * Gets the clean. * * Set this to `false` to disable webpage cleaning. To learn more about webpage cleaning, see the [Analyzing - * webpages](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages) + * webpages] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-analyzing-webpages) * documentation. * * @return the clean @@ -278,7 +280,9 @@ public Boolean clean() { * Gets the xpath. * * An [XPath - * query](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages#xpath) + * query] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-analyzing-webpages#xpath) * to perform on `html` or `url` input. Results of the query will be appended to the cleaned webpage text before it is * analyzed. To analyze only the results of the XPath query, set the `clean` parameter to `false`. * @@ -315,7 +319,9 @@ public Boolean returnAnalyzedText() { * * ISO 639-1 code that specifies the language of your text. This overrides automatic language detection. Language * support differs depending on the features you include in your analysis. See [Language - * support](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-language-support) + * support] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-language-support) * for more information. * * @return the language diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java index e7515c41650..82709533353 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java @@ -130,7 +130,9 @@ public Long limit() { * Gets the model. * * Enter a [custom - * model](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) + * model] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-customizing) * ID to override the standard categories model. * * @return the model diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java index 7e4dc585ada..f0ec70ff22c 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java @@ -28,7 +28,9 @@ public class CategoriesResult extends GenericModel { * * The path to the category through the 5-level taxonomy hierarchy. For the complete list of categories, see the * [Categories - * hierarchy](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy) + * hierarchy] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-categories#categories-hierarchy) * documentation. * * @return the label diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java index 720f9a267df..7b23993808a 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java @@ -16,7 +16,9 @@ /** * Identifies people, cities, organizations, and other entities in the content. See [Entity types and - * subtypes](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-entity-types). + * subtypes] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-entity-types). * * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. * Arabic, Chinese, and Dutch are supported only through custom models. @@ -161,7 +163,9 @@ public Boolean mentions() { * Gets the model. * * Enter a [custom - * model](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) + * model] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-customizing) * ID to override the standard entity detection model. * * @return the model diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java index 8a7d76dde76..3d214aa1ced 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java @@ -241,7 +241,9 @@ public EmotionOptions emotion() { * Gets the entities. * * Identifies people, cities, organizations, and other entities in the content. See [Entity types and - * subtypes](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-entity-types). + * subtypes] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-entity-types). * * Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. * Arabic, Chinese, and Dutch are supported only through custom models. @@ -282,7 +284,9 @@ public MetadataOptions metadata() { * * Recognizes when two entities are related and identifies the type of relation. For example, an `awardedTo` relation * might connect the entities "Nobel Prize" and "Albert Einstein". See [Relation - * types](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-relations). + * types] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-relations). * * Supported languages: Arabic, English, German, Japanese, Korean, Spanish. Chinese, Dutch, French, Italian, and * Portuguese custom models are also supported. diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java index 8a0efd7f432..67581914b39 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java @@ -17,7 +17,8 @@ /** * Recognizes when two entities are related and identifies the type of relation. For example, an `awardedTo` relation * might connect the entities "Nobel Prize" and "Albert Einstein". See [Relation - * types](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-relations). + * types] + * (https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-relations). * * Supported languages: Arabic, English, German, Japanese, Korean, Spanish. Chinese, Dutch, French, Italian, and * Portuguese custom models are also supported. @@ -80,7 +81,9 @@ public Builder newBuilder() { * Gets the model. * * Enter a [custom - * model](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing) + * model] + * (https://cloud.ibm.com/docs/services/natural-language-understanding + * ?topic=natural-language-understanding-customizing) * ID to override the default model. * * @return the model diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java index d8f185a4e77..e4927232782 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java @@ -38,7 +38,8 @@ * [Personality * models](https://cloud.ibm.com/docs/services/personality-insights?topic=personality-insights-models#models). * * For information about the meaning of the consumption preferences, see [Consumption - * preferences](https://cloud.ibm.com/docs/services/personality-insights?topic=personality-insights-preferences#preferences). + * preferences] + * (https://cloud.ibm.com/docs/services/personality-insights?topic=personality-insights-preferences#preferences). * * * **Note:** Request logging is disabled for the Personality Insights service. Regardless of whether you set the diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index 40ea51571bc..6cfa8b6e5ef 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -793,7 +793,8 @@ public ServiceCall deleteJob(DeleteJobOptions deleteJobOptions) { * create it. * * **See also:** [Create a custom language - * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#createModel-language). + * model] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#createModel-language). * * @param createLanguageModelOptions the {@link CreateLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LanguageModel} @@ -833,7 +834,8 @@ public ServiceCall createLanguageModel(CreateLanguageModelOptions * list information about it. * * **See also:** [Listing custom language - * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). + * models] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). * * @param listLanguageModelsOptions the {@link ListLanguageModelsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LanguageModels} @@ -866,7 +868,8 @@ public ServiceCall listLanguageModels(ListLanguageModelsOptions * list information about it. * * **See also:** [Listing custom language - * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). + * models] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). * * @return a {@link ServiceCall} with a response type of {@link LanguageModels} */ @@ -881,7 +884,8 @@ public ServiceCall listLanguageModels() { * that owns a model to list information about it. * * **See also:** [Listing custom language - * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). + * models] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). * * @param getLanguageModelOptions the {@link GetLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LanguageModel} @@ -912,7 +916,9 @@ public ServiceCall getLanguageModel(GetLanguageModelOptions getLa * service that owns a model to delete it. * * **See also:** [Deleting a custom language - * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#deleteModel-language). + * model] + * (https://cloud.ibm.com/docs/services/speech-to-text + * ?topic=speech-to-text-manageLanguageModels#deleteModel-language). * * @param deleteLanguageModelOptions the {@link DeleteLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -1003,7 +1009,8 @@ public ServiceCall trainLanguageModel(TrainLanguageModelOption * credentials for the instance of the service that owns a model to reset it. * * **See also:** [Resetting a custom language - * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#resetModel-language). + * model] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#resetModel-language). * * @param resetLanguageModelOptions the {@link ResetLanguageModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -1512,7 +1519,8 @@ public ServiceCall listGrammars(ListGrammarsOptions listGrammarsOption * * **See also:** * * [Understanding - * grammars](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarUnderstand#grammarUnderstand) + * grammars] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarUnderstand#grammarUnderstand) * * [Add a grammar to the custom language * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarAdd#addGrammar). * @@ -1648,7 +1656,8 @@ public ServiceCall createAcousticModel(CreateAcousticModelOptions * list information about it. * * **See also:** [Listing custom acoustic - * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). + * models] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). * * @param listAcousticModelsOptions the {@link ListAcousticModelsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link AcousticModels} @@ -1681,7 +1690,8 @@ public ServiceCall listAcousticModels(ListAcousticModelsOptions * list information about it. * * **See also:** [Listing custom acoustic - * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). + * models] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). * * @return a {@link ServiceCall} with a response type of {@link AcousticModels} */ @@ -1696,7 +1706,8 @@ public ServiceCall listAcousticModels() { * that owns a model to list information about it. * * **See also:** [Listing custom acoustic - * models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). + * models] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). * * @param getAcousticModelOptions the {@link GetAcousticModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link AcousticModel} @@ -1727,7 +1738,9 @@ public ServiceCall getAcousticModel(GetAcousticModelOptions getAc * that owns a model to delete it. * * **See also:** [Deleting a custom acoustic - * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#deleteModel-acoustic). + * model] + * (https://cloud.ibm.com/docs/services/speech-to-text + * ?topic=speech-to-text-manageAcousticModels#deleteModel-acoustic). * * @param deleteAcousticModelOptions the {@link DeleteAcousticModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -1828,7 +1841,8 @@ public ServiceCall trainAcousticModel(TrainAcousticModelOption * model to reset it. * * **See also:** [Resetting a custom acoustic - * model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#resetModel-acoustic). + * model] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#resetModel-acoustic). * * @param resetAcousticModelOptions the {@link ResetAcousticModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void @@ -2139,7 +2153,9 @@ public ServiceCall deleteAudio(DeleteAudioOptions deleteAudioOptions) { * data. * * **See also:** [Information - * security](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-information-security#information-security). + * security] + * (https://cloud.ibm.com/docs/services/speech-to-text + * ?topic=speech-to-text-information-security#information-security). * * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java index f8b9f5f07d4..30d564e376b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateAcousticModelOptions.java @@ -24,7 +24,8 @@ public class CreateAcousticModelOptions extends GenericModel { * can be used only with the base model that it customizes. * * To determine whether a base model supports acoustic model customization, refer to [Language support for - * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). */ public interface BaseModelName { /** ar-AR_BroadbandModel. */ @@ -206,7 +207,8 @@ public String name() { * can be used only with the base model that it customizes. * * To determine whether a base model supports acoustic model customization, refer to [Language support for - * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). * * @return the baseModelName */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java index 79d21e2d2ca..5b4acb2d2e2 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateLanguageModelOptions.java @@ -25,7 +25,8 @@ public class CreateLanguageModelOptions extends GenericModel { * * To determine whether a base model supports language model customization, use the **Get a model** method and check * that the attribute `custom_language_model` is set to `true`. You can also refer to [Language support for - * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). */ public interface BaseModelName { /** de-DE_BroadbandModel. */ @@ -217,7 +218,8 @@ public String name() { * * To determine whether a base model supports language model customization, use the **Get a model** method and check * that the attribute `custom_language_model` is set to `true`. You can also refer to [Language support for - * customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). + * customization] + * (https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport). * * @return the baseModelName */ diff --git a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java index 71e89903cc4..2ceacbbfe86 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java +++ b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java @@ -1486,8 +1486,8 @@ public void testClosingInputStreamClosesWebSocket() throws Exception { outputStream.write(ByteString.encodeUtf8("test").toByteArray()); outputStream.close(); - webSocketRecorder.assertTextMessage("{\"content-type\":\"audio/l16; rate=44000\"," + - "\"customization_weight\":0.1,\"action\":\"start\"}"); + webSocketRecorder.assertTextMessage("{\"content-type\":\"audio/l16; rate=44000\"," + + "\"customization_weight\":0.1,\"action\":\"start\"}"); webSocketRecorder.assertBinaryMessage(ByteString.encodeUtf8("test")); webSocketRecorder.assertTextMessage("{\"action\":\"stop\"}"); webSocketRecorder.assertExhausted(); diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index 636bce7b2d9..109ed71078b 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -305,7 +305,8 @@ public WebSocket synthesizeUsingWebSocket(SynthesizeOptions synthesizeOptions, S * **Note:** This method is currently a beta release. * * **See also:** [Querying a word from a - * language](https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-customWords#cuWordsQueryLanguage). + * language] + * (https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-customWords#cuWordsQueryLanguage). * * @param getPronunciationOptions the {@link GetPronunciationOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Pronunciation} @@ -761,7 +762,9 @@ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { * data. * * **See also:** [Information - * security](https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-information-security#information-security). + * security] + * (https://cloud.ibm.com/docs/services/text-to-speech + * ?topic=text-to-speech-information-security#information-security). * * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void diff --git a/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java b/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java index c6aea8e3566..a8c703504f0 100644 --- a/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java +++ b/tone-analyzer/src/test/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerTest.java @@ -32,7 +32,6 @@ import java.util.List; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; /** diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java index d34aa4c7191..ecfd015c128 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java @@ -325,7 +325,9 @@ public ServiceCall getClassifier(GetClassifierOptions getClassifierO * * Update a custom classifier by adding new positive or negative classes or by adding new images to existing classes. * You must supply at least one set of positive or negative examples. For details, see [Updating custom - * classifiers](https://cloud.ibm.com/docs/services/visual-recognition?topic=visual-recognition-customizing#updating-custom-classifiers). + * classifiers] + * (https://cloud.ibm.com/docs/services/visual-recognition + * ?topic=visual-recognition-customizing#updating-custom-classifiers). * * Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image file names, and classifier and class * names). The service assumes UTF-8 encoding if it encounters non-ASCII characters. From fe142edb6421ac052d695e208b010d21ed4bd88c Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 15:49:06 -0400 Subject: [PATCH 23/28] docs: Update all READMEs with auth changes and new core features --- README.md | 103 +++++++++++++++-------- assistant/README.md | 14 +-- compare-comply/README.md | 7 +- discovery/README.md | 7 +- language-translator/README.md | 7 +- natural-language-classifier/README.md | 7 +- natural-language-understanding/README.md | 9 +- personality-insights/README.md | 7 +- speech-to-text/README.md | 14 +-- text-to-speech/README.md | 14 +-- tone-analyzer/README.md | 9 +- visual-recognition/README.md | 7 +- 12 files changed, 96 insertions(+), 109 deletions(-) diff --git a/README.md b/README.md index ee0f35aceac..4245bd04b7e 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,14 @@ Java client library to use the [Watson APIs][wdc]. * [Authentication](#authentication) * [IAM](#iam) * [Username and password](#username-and-password) - * [ICP](#icp) + * [Cloud Pak for Data](#cloud-pak-for-data) * [Using the SDK](#using-the-sdk) * [Parsing responses](#parsing-responses) * [Configuring the HTTP client](#configuring-the-http-client) * [Making asynchronous API calls](#making-asynchronous-api-calls) * [Default headers](#default-headers) * [Sending request headers](#sending-request-headers) + * [Canceling requests](#canceling-requests) * [FAQ](#faq) * IBM Watson Services * [Assistant](assistant) @@ -114,7 +115,7 @@ Watson services are migrating to token-based Identity and Access Management (IAM - With some service instances, you authenticate to the API by using **[IAM](#iam)**. - In other instances, you authenticate by providing the **[username and password](#username-and-password)** for the service instance. -- If you're using a Watson service on ICP, you'll need to authenticate in a [specific way](#icp). +- If you're using a Watson service on Cloud Pak for Data, you'll need to authenticate in a [specific way](#cloud-pak-for-data). ### Getting credentials @@ -170,68 +171,56 @@ Some services use token-based Identity and Access Management (IAM) authenticatio You supply either an IAM service **API key** or an **access token**: - Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary. -- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/services/watson/getting-started-iam.html). If you want to switch to API key, override your stored IAM credentials with an IAM API key. Then call the `setIamCredentials()` method again. +- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/services/watson/getting-started-iam.html). Supplying the IAM API key: ```java // letting the SDK manage the IAM token -IamOptions options = new IamOptions.Builder() - .apiKey("") - .url("") // optional - the default value is https://iam.cloud.ibm.com/identity/token - .build(); -Discovery service = new Discovery("2017-11-07", options); +Authenticator authenticator = new IamAuthenticator(""); +Discovery service = new Discovery("2017-11-07", authenticator); ``` Supplying the access token: ```java // assuming control of managing IAM token -IamOptions options = new IamOptions.Builder() - .accessToken("") - .build(); -Discovery service = new Discovery("2017-11-07", options); +Authenticator authenticator = new BearerTokenAuthenticator(""); +Discovery service = new Discovery("2017-11-07", authenticator); ``` #### Username and password ```java -// in the constructor -BasicAuthConfig config = new BasicAuthConfig.Builder() - .username("") - .password("", ""); +Discovery service = new Discovery("2017-11-07", authenticator); ``` -#### ICP +#### Cloud Pak for Data Like IAM, you can pass in credentials to let the SDK manage an access token for you or directly supply an access token to do it yourself. ```java // letting the SDK manage the token -ICP4DConfig config = new ICP4DConfig.Builder() - .url("") - .username("") - .password("") - .disableSSLVerification(true) - .build(); -Discovery service = new Discovery("2017-11-07", config); -service.setEndPoint(""); +Authenticator authenticator = new CloudPakForDataAuthenticator( + "", + "", + "", + true, // disabling SSL verification + null, +); +Discovery service = new Discovery("2017-11-07", authenticator); +service.setEndPoint(""); ``` ```java // assuming control of managing the access token -ICP4DConfig config = new ICP4DConfig.Builder() - .url("") - .userManagedAccessToken("") - .disableSSLVerification(true) - .build(); -Discovery service = new Discovery("2017-11-07", config); -service.setEndPoint(""); +Authenticator authenticator = new BearerTokenAuthenticator(""); +Discovery service = new Discovery("2017-11-07", authenticator); +service.setEndPoint(""); ``` -Be sure to both disable SSL verification when authenticating and set the endpoint explicitly to the URL given in ICP. +Be sure to both disable SSL verification when authenticating and set the endpoint explicitly to the URL given in Cloud Pak for Data. ## Using the SDK @@ -259,8 +248,9 @@ System.out.println("Response header names: " + responseHeaders.names()); The HTTP client can be configured by using the `configureClient()` method on your service object, passing in an `HttpConfigOptions` object. Currently, the following options are supported: - Disabling SSL verification (only do this if you really mean to!) ⚠️ - Using a proxy (more info here: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564)) +- Setting HTTP logging verbosity -Here's an example of setting both of the above: +Here's an example of setting the above: ```java Discovery service = new Discovery("2017-11-07"); @@ -269,6 +259,7 @@ Discovery service = new Discovery("2017-11-07"); HttpConfigOptions options = new HttpConfigOptions.Builder() .disableSslVerification(true) .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080))) + .loggingLevel(HttpConfigOptions.LoggingLevel.BASIC) .build(); service.configureClient(options); @@ -329,7 +320,7 @@ Default headers can be specified at any time by using the `setDefaultHeaders(Map The example below sends the `X-Watson-Learning-Opt-Out` header in every request preventing Watson from using the payload to improve the service. ```java -PersonalityInsights service = new PersonalityInsights("2016-10-19"); +PersonalityInsights service = new PersonalityInsights("2016-10-19", new NoAuthAuthenticator()); Map headers = new HashMap(); headers.put(WatsonHttpHeaders.X_WATSON_LEARNING_OPT_OUT, "true"); @@ -349,6 +340,44 @@ Response workspaces = service.listWorkspaces() .execute(); ``` +### Canceling requests + +It's possible that you may want to cancel a request you make to a service. For example, you may set some timeout threshold and just want to cancel an asynchronous if it doesn't respond in time. You can do that by calling the `cancel()` method on your `ServiceCall` object. For example: + +```java +// time to consider timeout (in ms) +long timeoutThreshold = 3000; + +// storing ServiceCall object we'll use to list our Assistant v1 workspaces +ServiceCall call = service.listWorkspaces(); + +long startTime = System.currentTimeMillis(); +call.enqueue(new ServiceCallback() { + @Override + public void onResponse(Response response) { + // store the result somewhere + fakeDb.store("my-key", response.getResult()); + } + + @Override + public void onFailure(Exception e) { + System.out.println("The request failed :("); + } +}); + +// keep waiting for the call to complete while we're within the timeout bounds +while ((fakeDb.retrieve("my-key") == null) && (System.currentTimeMillis() - startTime < timeoutThreshold)) { + Thread.sleep(500); +} + +// if we timed out and it's STILL not complete, we'll just cancel the call +if (fakeDb.retrieve("my-key") == null) { + call.cancel(); +} +``` + +Doing so will call your `onFailure()` implementation. + ## FAQ ### Does this SDK play well with Android? diff --git a/assistant/README.md b/assistant/README.md index 82a1340423e..e308825f067 100644 --- a/assistant/README.md +++ b/assistant/README.md @@ -24,11 +24,8 @@ Use the [Assistant][assistant] service to identify intents, entities, and conduc // make sure to use the Assistant v1 import! import com.ibm.watson.assistant.v1.Assistant; -Assistant service = new Assistant("2018-02-16"); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +Assistant service = new Assistant("2018-02-16", authenticator); MessageInput input = new MessageInput(); input.setText("Hi"); @@ -78,11 +75,8 @@ System.out.println(response); // make sure to use the Assistant v2 import! import com.ibm.watson.assistant.v2.Assistant; -Assistant service = new Assistant("2018-09-20"); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +Assistant service = new Assistant("2018-09-20", authenticator); MessageInput input = new MessageInput.Builder() .text("Hi") diff --git a/compare-comply/README.md b/compare-comply/README.md index 317dd025dd5..10c5d0f87c7 100644 --- a/compare-comply/README.md +++ b/compare-comply/README.md @@ -19,11 +19,8 @@ ## Usage Use the [Compare and Comply](https://cloud.ibm.com/docs/services/compare-comply/index.html#about) service to enable better and faster document understanding. Below is an example of converting a PDF file into HTML: ```java -CompareComply service = new CompareComply("2018-10-15"); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +CompareComply service = new CompareComply("2018-10-15", authenticator); ConvertToHtmlOptions convertToHtmlOptions = new ConvertToHtmlOptions.Builder() .file("~/path/to/file.pdf") diff --git a/discovery/README.md b/discovery/README.md index d7b915afcae..941c96d1742 100644 --- a/discovery/README.md +++ b/discovery/README.md @@ -20,11 +20,8 @@ The [Discovery][discovery] wraps the environment, collection, configuration, document, and query operations of the Discovery service. ```java -Discovery discovery = new Discovery("2017-11-07"); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +Discovery discovery = new Discovery("2017-11-07", authenticator); //Build an empty query on an existing environment/collection String environmentId = ""; diff --git a/language-translator/README.md b/language-translator/README.md index 2841456196d..08525d0ad14 100644 --- a/language-translator/README.md +++ b/language-translator/README.md @@ -21,11 +21,8 @@ Select a domain, then identify or select the language of text, and then translat Example: Translate 'hello' from English to Spanish using the [Language Translator][language_translator] service. ```java -LanguageTranslator service = new LanguageTranslator(); -IamOptions iamOptions = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(iamOptions); +Authenticator authenticator = new IamAuthenticator(""); +LanguageTranslator service = new LanguageTranslator(authenticator); TranslateOptions translateOptions = new TranslateOptions.Builder() .addText("hello") diff --git a/natural-language-classifier/README.md b/natural-language-classifier/README.md index 6f60e1c2751..91556372cf4 100644 --- a/natural-language-classifier/README.md +++ b/natural-language-classifier/README.md @@ -20,11 +20,8 @@ Use [Natural Language Classifier](https://cloud.ibm.com/docs/services/natural-language-classifier?topic=natural-language-classifier-natural-language-classifier) service to create a classifier instance by providing a set of representative strings and a set of one or more correct classes for each as training. Then use the trained classifier to classify your new question for best matching answers or to retrieve next actions for your application. ```java -NaturalLanguageClassifier service = new NaturalLanguageClassifier(); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +NaturalLanguageClassifier service = new NaturalLanguageClassifier(authenticator); ClassifyOptions classifyOptions = new ClassifyOptions.Builder() .classifierId("") diff --git a/natural-language-understanding/README.md b/natural-language-understanding/README.md index b194434152a..1469ae1e0c0 100644 --- a/natural-language-understanding/README.md +++ b/natural-language-understanding/README.md @@ -23,15 +23,12 @@ Language Understanding will give you results for the features you request. The s analysis by default, so the results can ignore most advertisements and other unwanted content. ```java -NaturalLanguageUnderstanding service = new NaturalLanguageUnderstanding("2017-02-27"); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +NaturalLanguageUnderstanding service = new NaturalLanguageUnderstanding("2017-02-27", authenticator); EntitiesOptions entities = new EntitiesOptions.Builder() .sentiment(true) - .limit(1) + .limit(1L) .build(); Features features = new Features.Builder() .entities(entities) diff --git a/personality-insights/README.md b/personality-insights/README.md index 866f40d6c32..b64dc9df0bb 100755 --- a/personality-insights/README.md +++ b/personality-insights/README.md @@ -21,11 +21,8 @@ Use linguistic analytics to infer personality and social characteristics, includ Example: Analyze text and get a personality profile using the [Personality Insights][personality_insights] service. ```java -PersonalityInsights service = new PersonalityInsights("2016-10-19"); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +PersonalityInsights service = new PersonalityInsights("2016-10-19", authenticator); // Demo content from Moby Dick by Hermann Melville (Chapter 1) String text = "Call me Ishmael. Some years ago-never mind how long precisely-having " diff --git a/speech-to-text/README.md b/speech-to-text/README.md index eb11cbb92d8..80c84ab4962 100755 --- a/speech-to-text/README.md +++ b/speech-to-text/README.md @@ -20,11 +20,8 @@ Use the [Speech to Text][speech_to_text] service to recognize the text from a .wav file. ```java -SpeechToText service = new SpeechToText(); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +SpeechToText service = new SpeechToText(authenticator); File audio = new File("src/test/resources/sample1.wav"); @@ -42,11 +39,8 @@ System.out.println(transcript); Speech to Text supports WebSocket, the url is: `wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize` ```java -SpeechToText service = new SpeechToText(); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +SpeechToText service = new SpeechToText(authenticator); InputStream audio = new FileInputStream("src/test/resources/sample1.wav"); diff --git a/text-to-speech/README.md b/text-to-speech/README.md index 67e90146399..a7cdc6ad29b 100755 --- a/text-to-speech/README.md +++ b/text-to-speech/README.md @@ -20,11 +20,8 @@ Use the [Text to Speech][text_to_speech] service to get the available voices to synthesize. ```java -TextToSpeech service = new TextToSpeech(); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +TextToSpeech service = new TextToSpeech(authenticator); Voices voices = service.listVoices().execute().getResult(); System.out.println(voices); @@ -33,11 +30,8 @@ System.out.println(voices); ## Usage with WebSockets The Watson Text to Speech service supports the use of WebSockets as an alternative to the `synthesize()` method, which converts text to speech. Here is an example of using the WebSocket version of the method to get an audio file: ```java -TextToSpeech service = new TextToSpeech(); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +TextToSpeech service = new TextToSpeech(authenticator); String text = "It's beginning to look a lot like Christmas"; SynthesizeOptions synthesizeOptions = new SynthesizeOptions.Builder() diff --git a/tone-analyzer/README.md b/tone-analyzer/README.md index 313b3b7d9f7..6553ded04e1 100755 --- a/tone-analyzer/README.md +++ b/tone-analyzer/README.md @@ -20,11 +20,8 @@ Use the [Tone Analyzer][tone_analyzer] service to get the tone of your email. ```java -ToneAnalyzer service = new ToneAnalyzer("2017-09-21"); -IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(options); +Authenticator authenticator = new IamAuthenticator(""); +ToneAnalyzer service = new ToneAnalyzer("2017-09-21", authenticator); String text = "I know the times are difficult! Our sales have been " @@ -40,7 +37,7 @@ String text = // Call the service and get the tone ToneOptions toneOptions = new ToneOptions.Builder() - .html(text) + .text(text) .build(); ToneAnalysis tone = service.tone(toneOptions).execute().getResult(); diff --git a/visual-recognition/README.md b/visual-recognition/README.md index bb1937db40d..0f6bec82552 100644 --- a/visual-recognition/README.md +++ b/visual-recognition/README.md @@ -23,11 +23,8 @@ following picture. ![Car](https://visual-recognition-demo.ng.bluemix.net/images/samples/5.jpg) ```java -VisualRecognition service = new VisualRecognition("2016-05-20"); -IamOptions iamOptions = new IamOptions.Builder() - .apiKey("") - .build(); -service.setIamCredentials(iamOptions); +Authenticator authenticator = new IamAuthenticator(""); +VisualRecognition service = new VisualRecognition("2016-05-20", authenticator); System.out.println("Classify an image"); ClassifyOptions options = new ClassifyOptions.Builder() From fe989209bcde72dbbc0a45f12afbdb5fa4340d18 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 16:26:32 -0400 Subject: [PATCH 24/28] docs: Update examples to use new library --- examples/build.gradle | 2 +- .../watson/assistant/v1/AssistantExample.java | 14 +++++---- ...sistantToneAnalyzerIntegrationExample.java | 31 +++++++++---------- .../ToneDetection.java | 4 +-- .../discovery/v1/DiscoveryQueryExample.java | 10 +++--- .../v2/LanguageTranslatorExample.java | 10 +++--- .../v1/NaturalLanguageClassifierExample.java | 10 +++--- .../v3/PersonalityInsightsExample.java | 10 +++--- .../v1/CustomizationExample.java | 20 ++++++------ .../v1/MicrophoneWithWebSocketsExample.java | 10 +++--- .../v1/RecognizeUsingWebSocketsExample.java | 10 +++--- ...ingWebSocketsWithSpeakerLabelsExample.java | 10 +++--- .../v1/SpeechToTextExample.java | 10 +++--- .../v1/CustomizationExample.java | 24 +++++++------- .../v1/TextToSpeechExample.java | 10 +++--- .../v1/TranslateAndSynthesizeExample.java | 17 ++++------ .../v3/ToneAnalyzerChatExample.java | 10 +++--- .../tone_analyzer/v3/ToneAnalyzerExample.java | 9 +++--- .../v3/VisualRecognitionExample.java | 10 +++--- 19 files changed, 100 insertions(+), 131 deletions(-) diff --git a/examples/build.gradle b/examples/build.gradle index 6bcc0a46a5a..18db4a09526 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -33,5 +33,5 @@ checkstyle { } dependencies { - compile 'com.ibm.watson:ibm-watson:7.0.0' + compile 'com.ibm.watson:ibm-watson:8.0.0-rc1' } diff --git a/examples/src/main/java/com/ibm/watson/assistant/v1/AssistantExample.java b/examples/src/main/java/com/ibm/watson/assistant/v1/AssistantExample.java index 9c0943a6018..86e8e708a70 100644 --- a/examples/src/main/java/com/ibm/watson/assistant/v1/AssistantExample.java +++ b/examples/src/main/java/com/ibm/watson/assistant/v1/AssistantExample.java @@ -12,6 +12,8 @@ */ package com.ibm.watson.assistant.v1; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.assistant.v1.model.InputData; import com.ibm.watson.assistant.v1.model.MessageOptions; import com.ibm.watson.assistant.v1.model.MessageResponse; @@ -32,13 +34,11 @@ public class AssistantExample { public static void main(String[] args) throws Exception { - Assistant service = new Assistant("2018-02-16"); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + Assistant service = new Assistant("2018-02-16", authenticator); - InputData input = new InputData.Builder("Hi").build(); + MessageInput input = new MessageInput(); + input.setText("Hi"); MessageOptions options = new MessageOptions.Builder("") .input(input) .build(); @@ -69,6 +69,8 @@ public void accept(Response response) throws Exception { System.out.println(response.getResult()); } }); + + Thread.sleep(5000); } } diff --git a/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/AssistantToneAnalyzerIntegrationExample.java b/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/AssistantToneAnalyzerIntegrationExample.java index 34416ede715..015b7837790 100644 --- a/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/AssistantToneAnalyzerIntegrationExample.java +++ b/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/AssistantToneAnalyzerIntegrationExample.java @@ -25,7 +25,6 @@ import com.ibm.watson.tone_analyzer.v3.model.ToneOptions; import com.ibm.cloud.sdk.core.http.Response; import com.ibm.cloud.sdk.core.http.ServiceCallback; -import com.ibm.cloud.sdk.core.service.security.IamOptions; /** @@ -36,18 +35,12 @@ public class AssistantToneAnalyzerIntegrationExample { public static void main(String[] args) throws Exception { // instantiate the assistant service - Assistant assistantService = new Assistant("2018-02-16"); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - assistantService.setIamCredentials(options); + Authenticator assistantAuthenticator = new IamAuthenticator(""); + Assistant assistantService = new Assistant("2018-02-16", assistantAuthenticator); // instantiate the tone analyzer service - ToneAnalyzer toneService = new ToneAnalyzer("2017-09-21"); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - toneService.setIamCredentials(options); + Authenticator toneAuthenticator = new IamAuthenticator(""); + ToneAnalyzer toneService = new ToneAnalyzer("2017-09-21", toneAuthenticator); // workspace id String workspaceId = ""; @@ -58,12 +51,12 @@ public static void main(String[] args) throws Exception { boolean maintainHistory = false; /** - * Input for the Assistant service: input (String): an input string (the user's conversation turn) and context - * (Map: any context that needs to be maintained - either added by the client app or passed in the + * Input for the Assistant service: text (String): an input string (the user's conversation turn) and context + * (Context): any context that needs to be maintained - either added by the client app or passed in the * response from the Assistant service on the previous conversation turn. */ - String input = "I am happy"; - Map context = new HashMap<>(); + String text = "I am happy"; + Context context = null; // UPDATE CONTEXT HERE IF CONTINUING AN ONGOING CONVERSATION // set local context variable to the context from the last response from the @@ -82,10 +75,14 @@ public void onResponse(Response toneResponsePayload) { // update context with the tone data returned by the Tone Analyzer context = ToneDetection.updateUserTone(context, toneResponsePayload.getResult(), maintainHistory); + // create input for message + MessageInput input = new MessageInput(); + input.setText(text); + // call Assistant Service with the input and tone-aware context MessageOptions messageOptions = new MessageOptions.Builder(workspaceId) - .input(new InputData.Builder(input).build()) - .context((Context) context) + .input(input) + .context(context) .build(); assistantService.message(messageOptions).enqueue(new ServiceCallback() { @Override diff --git a/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/ToneDetection.java b/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/ToneDetection.java index 7333efa102f..f1afe5a0687 100644 --- a/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/ToneDetection.java +++ b/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/ToneDetection.java @@ -62,7 +62,7 @@ private ToneDetection() { } * @returns assistantPayload where the user object has been updated with tone information from the * toneAnalyzerPayload */ - public static Map updateUserTone(Map context, ToneAnalysis toneAnalyzerPayload, + public static Map updateUserTone(Context context, ToneAnalysis toneAnalyzerPayload, boolean maintainHistory) { List emotionTone = new ArrayList(); @@ -70,7 +70,7 @@ public static Map updateUserTone(Map context, To List socialTone = new ArrayList(); // If the context doesn't already contain the user object, initialize it - if (!context.containsKey("user")) { + if (context.containsKey("user") != null) { context.put("user", initUser()); } diff --git a/examples/src/main/java/com/ibm/watson/discovery/v1/DiscoveryQueryExample.java b/examples/src/main/java/com/ibm/watson/discovery/v1/DiscoveryQueryExample.java index 4b9a58eca2c..4f4b8ed9708 100644 --- a/examples/src/main/java/com/ibm/watson/discovery/v1/DiscoveryQueryExample.java +++ b/examples/src/main/java/com/ibm/watson/discovery/v1/DiscoveryQueryExample.java @@ -34,7 +34,8 @@ import com.ibm.watson.discovery.v1.model.QueryOptions; import com.ibm.watson.discovery.v1.model.QueryResponse; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; /** * End-to-end example for querying Discovery. @@ -43,11 +44,8 @@ public class DiscoveryQueryExample { private static final String DEFAULT_CONFIG_NAME = "Default Configuration"; public static void main(String[] args) { - Discovery discovery = new Discovery("2017-11-07"); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + Discovery discovery = new Discovery("2017-11-07", authenticator); String environmentId = null; String configurationId = null; diff --git a/examples/src/main/java/com/ibm/watson/language_translator/v2/LanguageTranslatorExample.java b/examples/src/main/java/com/ibm/watson/language_translator/v2/LanguageTranslatorExample.java index 0da6d0942f4..f9ad3b82968 100644 --- a/examples/src/main/java/com/ibm/watson/language_translator/v2/LanguageTranslatorExample.java +++ b/examples/src/main/java/com/ibm/watson/language_translator/v2/LanguageTranslatorExample.java @@ -12,10 +12,11 @@ */ package com.ibm.watson.language_translator.v2; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.language_translator.v2.model.TranslateOptions; import com.ibm.watson.language_translator.v2.model.TranslationResult; import com.ibm.watson.language_translator.v2.util.Language; -import com.ibm.cloud.sdk.core.service.security.IamOptions; /** * Example of how to translate a sentence from English to Spanish. @@ -23,11 +24,8 @@ public class LanguageTranslatorExample { public static void main(String[] args) { - LanguageTranslator service = new LanguageTranslator(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + LanguageTranslator service = new LanguageTranslator(authenticator); TranslateOptions translateOptions = new TranslateOptions.Builder() .addText("hello") diff --git a/examples/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierExample.java b/examples/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierExample.java index e2cd91366dd..6198aa0cabd 100644 --- a/examples/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierExample.java +++ b/examples/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifierExample.java @@ -12,18 +12,16 @@ */ package com.ibm.watson.natural_language_classifier.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.natural_language_classifier.v1.model.ClassifyOptions; import com.ibm.watson.natural_language_classifier.v1.model.Classification; public class NaturalLanguageClassifierExample { public static void main(String[] args) { - NaturalLanguageClassifier service = new NaturalLanguageClassifier(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + NaturalLanguageClassifier service = new NaturalLanguageClassifier(authenticator); ClassifyOptions classifyOptions = new ClassifyOptions.Builder() .classifierId("") diff --git a/examples/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsExample.java b/examples/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsExample.java index 8a17562e8b6..b748bd61f03 100644 --- a/examples/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsExample.java +++ b/examples/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsightsExample.java @@ -12,18 +12,16 @@ */ package com.ibm.watson.personality_insights.v3; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.personality_insights.v3.model.Profile; import com.ibm.watson.personality_insights.v3.model.ProfileOptions; -import com.ibm.cloud.sdk.core.service.security.IamOptions; public class PersonalityInsightsExample { public static void main(String[] args) { - PersonalityInsights service = new PersonalityInsights("2016-10-19"); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + PersonalityInsights service = new PersonalityInsights("2016-10-19", authenticator); String text = "Call me Ishmael. Some years ago-never mind how long " + "precisely-having little or no money in my purse, and nothing " diff --git a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/CustomizationExample.java b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/CustomizationExample.java index 092d740e2a5..f6b5415814a 100755 --- a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/CustomizationExample.java +++ b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/CustomizationExample.java @@ -13,7 +13,6 @@ package com.ibm.watson.speech_to_text.v1; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.service.security.IamOptions; import com.ibm.watson.speech_to_text.v1.model.AddCorpusOptions; import com.ibm.watson.speech_to_text.v1.model.AddWordOptions; import com.ibm.watson.speech_to_text.v1.model.Corpora; @@ -29,6 +28,8 @@ import com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults; import com.ibm.watson.speech_to_text.v1.model.TrainLanguageModelOptions; import com.ibm.watson.speech_to_text.v1.model.Words; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import java.io.File; import java.io.FileNotFoundException; @@ -48,11 +49,8 @@ public class CustomizationExample { * @throws InterruptedException the interrupted exception */ public static void main(String[] args) throws InterruptedException, FileNotFoundException { - SpeechToText service = new SpeechToText(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + SpeechToText service = new SpeechToText(authenticator); // Create language model CreateLanguageModelOptions createOptions = new CreateLanguageModelOptions.Builder() @@ -69,10 +67,9 @@ public static void main(String[] args) throws InterruptedException, FileNotFound .customizationId(id) .corpusName("corpus-1") .corpusFile(new File(CORPUS_FILE)) - .corpusFileContentType(HttpMediaType.TEXT_PLAIN) .allowOverwrite(false) .build(); - service.addCorpus(addOptions).execute(); + service.addCorpus(addOptions).execute().getResult(); // Get corpus status GetCorpusOptions getOptions = new GetCorpusOptions.Builder() @@ -80,8 +77,9 @@ public static void main(String[] args) throws InterruptedException, FileNotFound .corpusName("corpus-1") .build(); for ( - int x = 0; x < 30 - && (service.getCorpus(getOptions).execute().getResult()).getStatus() != Corpus.Status.ANALYZED; x++ + int x = 0; + x < 30 && !service.getCorpus(getOptions).execute().getResult().getStatus().equals(Corpus.Status.ANALYZED); + x++ ) { Thread.sleep(5000); } @@ -142,7 +140,7 @@ public static void main(String[] args) throws InterruptedException, FileNotFound .build(); service.trainLanguageModel(trainOptions).execute(); - for (int x = 0; x < 30 && myModel.getStatus() != LanguageModel.Status.AVAILABLE; x++) { + for (int x = 0; x < 30 && !myModel.getStatus().equals(LanguageModel.Status.AVAILABLE); x++) { GetLanguageModelOptions getLanguageModelOptions = new GetLanguageModelOptions.Builder() .customizationId(id) .build(); diff --git a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/MicrophoneWithWebSocketsExample.java b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/MicrophoneWithWebSocketsExample.java index 8dd7984ecc7..d2478ae9d57 100644 --- a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/MicrophoneWithWebSocketsExample.java +++ b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/MicrophoneWithWebSocketsExample.java @@ -18,8 +18,9 @@ import javax.sound.sampled.DataLine; import javax.sound.sampled.TargetDataLine; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.service.security.IamOptions; import com.ibm.watson.speech_to_text.v1.model.RecognizeOptions; import com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults; import com.ibm.watson.speech_to_text.v1.websocket.BaseRecognizeCallback; @@ -36,11 +37,8 @@ public class MicrophoneWithWebSocketsExample { * @throws Exception the exception */ public static void main(final String[] args) throws Exception { - SpeechToText service = new SpeechToText(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + SpeechToText service = new SpeechToText(authenticator); // Signed PCM AudioFormat with 16kHz, 16 bit sample size, mono int sampleRate = 16000; diff --git a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsExample.java b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsExample.java index 586f1d7768e..597dc8f0a87 100644 --- a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsExample.java +++ b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsExample.java @@ -18,7 +18,8 @@ import java.util.concurrent.TimeUnit; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.speech_to_text.v1.model.RecognizeOptions; import com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults; import com.ibm.watson.speech_to_text.v1.websocket.BaseRecognizeCallback; @@ -30,11 +31,8 @@ public class RecognizeUsingWebSocketsExample { private static CountDownLatch lock = new CountDownLatch(1); public static void main(String[] args) throws FileNotFoundException, InterruptedException { - SpeechToText service = new SpeechToText(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + SpeechToText service = new SpeechToText(authenticator); FileInputStream audio = new FileInputStream("src/test/resources/speech_to_text/sample1.wav"); diff --git a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsWithSpeakerLabelsExample.java b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsWithSpeakerLabelsExample.java index 3d78b86c7e6..55c2dba55aa 100644 --- a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsWithSpeakerLabelsExample.java +++ b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/RecognizeUsingWebSocketsWithSpeakerLabelsExample.java @@ -14,7 +14,8 @@ import com.ibm.cloud.sdk.core.util.GsonSingleton; import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.speech_to_text.v1.model.RecognizeOptions; import com.ibm.watson.speech_to_text.v1.model.SpeakerLabelsResult; import com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionAlternative; @@ -230,11 +231,8 @@ private void cleanFinal() { public static void main(String[] args) throws FileNotFoundException, InterruptedException { FileInputStream audio = new FileInputStream("src/test/resources/speech_to_text/twospeakers.wav"); - SpeechToText service = new SpeechToText(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + SpeechToText service = new SpeechToText(authenticator); RecognizeOptions options = new RecognizeOptions.Builder() .audio(audio) diff --git a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToTextExample.java b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToTextExample.java index 3bbef183c9b..8c2ca336e87 100644 --- a/examples/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToTextExample.java +++ b/examples/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToTextExample.java @@ -15,7 +15,8 @@ import java.io.File; import java.io.FileNotFoundException; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.speech_to_text.v1.model.RecognizeOptions; import com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults; @@ -26,11 +27,8 @@ public class SpeechToTextExample { public static void main(String[] args) throws FileNotFoundException { - SpeechToText service = new SpeechToText(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + SpeechToText service = new SpeechToText(authenticator); File audio = new File("src/test/resources/speech_to_text/sample1.wav"); RecognizeOptions options = new RecognizeOptions.Builder() diff --git a/examples/src/main/java/com/ibm/watson/text_to_speech/v1/CustomizationExample.java b/examples/src/main/java/com/ibm/watson/text_to_speech/v1/CustomizationExample.java index a9e15b72c7f..e19862bbd08 100755 --- a/examples/src/main/java/com/ibm/watson/text_to_speech/v1/CustomizationExample.java +++ b/examples/src/main/java/com/ibm/watson/text_to_speech/v1/CustomizationExample.java @@ -12,7 +12,8 @@ */ package com.ibm.watson.text_to_speech.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.text_to_speech.v1.model.AddWordOptions; import com.ibm.watson.text_to_speech.v1.model.AddWordsOptions; import com.ibm.watson.text_to_speech.v1.model.CreateVoiceModelOptions; @@ -41,11 +42,8 @@ public class CustomizationExample { public static void main(String[] args) throws IOException { - TextToSpeech service = new TextToSpeech(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + TextToSpeech service = new TextToSpeech(authenticator); // create custom voice model. CreateVoiceModelOptions createOptions = new CreateVoiceModelOptions.Builder() @@ -77,12 +75,14 @@ public static void main(String[] args) throws IOException { System.out.println(customVoiceModels); // create multiple custom word translations - Word word1 = new Word(); - word1.setWord("hodor"); - word1.setTranslation("hold the door"); - Word word2 = new Word(); - word2.setWord("plz"); - word2.setTranslation("please"); + Word word1 = new Word.Builder() + .word("hodor") + .translation("hold the door") + .build(); + Word word2 = new Word.Builder() + .word("plz") + .translation("please") + .build(); List words = Arrays.asList(word1, word2); AddWordsOptions addOptions = new AddWordsOptions.Builder() .customizationId(customVoiceModel.getCustomizationId()) diff --git a/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeechExample.java b/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeechExample.java index b78e223af5c..b216a6b12ed 100644 --- a/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeechExample.java +++ b/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeechExample.java @@ -12,17 +12,15 @@ */ package com.ibm.watson.text_to_speech.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Voices; public class TextToSpeechExample { public static void main(String[] args) { - TextToSpeech service = new TextToSpeech(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + TextToSpeech service = new TextToSpeech(authenticator); Voices voices = service.listVoices().execute().getResult(); System.out.println(voices); diff --git a/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TranslateAndSynthesizeExample.java b/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TranslateAndSynthesizeExample.java index dce4290e929..14022af8808 100644 --- a/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TranslateAndSynthesizeExample.java +++ b/examples/src/main/java/com/ibm/watson/text_to_speech/v1/TranslateAndSynthesizeExample.java @@ -12,7 +12,8 @@ */ package com.ibm.watson.text_to_speech.v1; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.language_translator.v2.model.TranslationResult; import com.ibm.watson.language_translator.v2.LanguageTranslator; import com.ibm.watson.language_translator.v2.model.TranslateOptions; @@ -32,17 +33,11 @@ public class TranslateAndSynthesizeExample { public static void main(String[] args) throws IOException { - LanguageTranslator translator = new LanguageTranslator(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - translator.setIamCredentials(options); + Authenticator ltAuthenticator = new IamAuthenticator(""); + LanguageTranslator translator = new LanguageTranslator(ltAuthenticator); - TextToSpeech synthesizer = new TextToSpeech(); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - synthesizer.setIamCredentials(options); + Authenticator ttsAuthenticator = new IamAuthenticator(""); + TextToSpeech synthesizer = new TextToSpeech(ttsAuthenticator); String text = "Greetings from Watson Developer Cloud"; diff --git a/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerChatExample.java b/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerChatExample.java index 770ba2cb791..a4a00692e53 100644 --- a/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerChatExample.java +++ b/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerChatExample.java @@ -12,7 +12,8 @@ */ package com.ibm.watson.tone_analyzer.v3; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.tone_analyzer.v3.model.ToneChatOptions; import com.ibm.watson.tone_analyzer.v3.model.Utterance; import com.ibm.watson.tone_analyzer.v3.model.UtteranceAnalyses; @@ -23,11 +24,8 @@ public class ToneAnalyzerChatExample { public static void main(String[] args) { - ToneAnalyzer service = new ToneAnalyzer("2017-09-21"); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + ToneAnalyzer service = new ToneAnalyzer("2017-09-21", authenticator); String[] texts = { "My charger isn't working.", diff --git a/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerExample.java b/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerExample.java index efe15f25a7f..138db828442 100644 --- a/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerExample.java +++ b/examples/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzerExample.java @@ -12,6 +12,8 @@ */ package com.ibm.watson.tone_analyzer.v3; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.tone_analyzer.v3.model.ToneAnalysis; import com.ibm.watson.tone_analyzer.v3.model.ToneOptions; @@ -19,11 +21,8 @@ public class ToneAnalyzerExample { public static void main(String[] args) { - ToneAnalyzer service = new ToneAnalyzer("2017-09-21"); - IamOptions options = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(options); + Authenticator authenticator = new IamAuthenticator(""); + ToneAnalyzer service = new ToneAnalyzer("2017-09-21", authenticator); String text = "I know the times are difficult! Our sales have been " + "disappointing for the past three quarters for our data analytics " diff --git a/examples/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionExample.java b/examples/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionExample.java index ba684fb4322..7576498de31 100644 --- a/examples/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionExample.java +++ b/examples/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognitionExample.java @@ -15,7 +15,8 @@ import java.io.File; import java.io.FileNotFoundException; -import com.ibm.cloud.sdk.core.service.security.IamOptions; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.IamAuthenticator; import com.ibm.watson.visual_recognition.v3.model.ClassifiedImages; import com.ibm.watson.visual_recognition.v3.model.Classifier; import com.ibm.watson.visual_recognition.v3.model.ClassifyOptions; @@ -25,11 +26,8 @@ public class VisualRecognitionExample { public static void main(String[] args) throws FileNotFoundException { - VisualRecognition service = new VisualRecognition(VERSION); - IamOptions iamOptions = new IamOptions.Builder() - .apiKey("") - .build(); - service.setIamCredentials(iamOptions); + Authenticator authenticator = new IamAuthenticator(""); + VisualRecognition service = new VisualRecognition(VERSION, authenticator); System.out.println("Classify an image"); ClassifyOptions options = new ClassifyOptions.Builder() From c5c9f5ad268e292ff1a6cc164ff534a341d2ecc8 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 16:33:15 -0400 Subject: [PATCH 25/28] build: Update version numbers --- .bumpversion.cfg | 2 +- README.md | 10 +++++----- assistant/README.md | 4 ++-- compare-comply/README.md | 4 ++-- discovery/README.md | 4 ++-- docker/pom.xml | 2 +- gradle.properties | 2 +- language-translator/README.md | 4 ++-- natural-language-classifier/README.md | 4 ++-- natural-language-understanding/README.md | 4 ++-- personality-insights/README.md | 4 ++-- speech-to-text/README.md | 4 ++-- text-to-speech/README.md | 4 ++-- tone-analyzer/README.md | 4 ++-- visual-recognition/README.md | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b41f7549e3e..3b060a5f329 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 7.4.0 +current_version = 8.0.0-rc1 commit = True message = Update version numbers from {current_version} -> {new_version} diff --git a/README.md b/README.md index 4245bd04b7e..62640b2e108 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ All the services: com.ibm.watson ibm-watson - 7.4.0 + 8.0.0-rc1 ``` @@ -73,7 +73,7 @@ Only Discovery: com.ibm.watson discovery - 7.4.0 + 8.0.0-rc1 ``` @@ -81,13 +81,13 @@ Only Discovery: All the services: ```gradle -'com.ibm.watson:ibm-watson:7.4.0' +'com.ibm.watson:ibm-watson:8.0.0-rc1' ``` Only Assistant: ```gradle -'com.ibm.watson:assistant:7.4.0' +'com.ibm.watson:assistant:8.0.0-rc1' ``` ##### JAR @@ -436,7 +436,7 @@ We do :sunglasses: http://ibm.github.io/ ## Featured projects We'd love to highlight cool open-source projects that use this SDK! If you'd like to get your project added to the list, feel free to make an issue linking us to it. -[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-7.4.0/ibm-watson-7.4.0-jar-with-dependencies.jar +[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-8.0.0-rc1/ibm-watson-8.0.0-rc1-jar-with-dependencies.jar ## Contributors ✨ diff --git a/assistant/README.md b/assistant/README.md index e308825f067..4e170aa6865 100644 --- a/assistant/README.md +++ b/assistant/README.md @@ -7,13 +7,13 @@ com.ibm.watson assistant - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:assistant:7.4.0' +'com.ibm.watson:assistant:8.0.0-rc1' ``` ## Usage diff --git a/compare-comply/README.md b/compare-comply/README.md index 10c5d0f87c7..55c5e28db83 100644 --- a/compare-comply/README.md +++ b/compare-comply/README.md @@ -7,13 +7,13 @@ com.ibm.watson compare-comply - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson.developer_cloud:compare-comply:7.4.0' +'com.ibm.watson.developer_cloud:compare-comply:8.0.0-rc1' ``` ## Usage diff --git a/discovery/README.md b/discovery/README.md index 941c96d1742..747cb3efa54 100644 --- a/discovery/README.md +++ b/discovery/README.md @@ -7,13 +7,13 @@ com.ibm.watson discovery - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:discovery:7.4.0' +'com.ibm.watson:discovery:8.0.0-rc1' ``` ## Usage diff --git a/docker/pom.xml b/docker/pom.xml index 6b866188ba6..03e0ea912f9 100644 --- a/docker/pom.xml +++ b/docker/pom.xml @@ -17,7 +17,7 @@ com.ibm.watson ibm-watson - 7.4.0 + 8.0.0-rc1 diff --git a/gradle.properties b/gradle.properties index a40958873d2..96b2249b9e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ -version=7.4.0 +version=8.0.0-rc1 group=com.ibm.watson diff --git a/language-translator/README.md b/language-translator/README.md index 08525d0ad14..cf78b47a794 100644 --- a/language-translator/README.md +++ b/language-translator/README.md @@ -7,13 +7,13 @@ com.ibm.watson language-translator - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:language-translator:7.4.0' +'com.ibm.watson:language-translator:8.0.0-rc1' ``` ## Usage diff --git a/natural-language-classifier/README.md b/natural-language-classifier/README.md index 91556372cf4..e2a0cb4be36 100644 --- a/natural-language-classifier/README.md +++ b/natural-language-classifier/README.md @@ -7,13 +7,13 @@ com.ibm.watson natural-language-classifier - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:natural-language-classifier:7.4.0' +'com.ibm.watson:natural-language-classifier:8.0.0-rc1' ``` ## Usage diff --git a/natural-language-understanding/README.md b/natural-language-understanding/README.md index 1469ae1e0c0..3a1ab7605f2 100644 --- a/natural-language-understanding/README.md +++ b/natural-language-understanding/README.md @@ -7,13 +7,13 @@ com.ibm.watson natural-language-understanding - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:natural-language-understanding:7.4.0' +'com.ibm.watson:natural-language-understanding:8.0.0-rc1' ``` ## Usage diff --git a/personality-insights/README.md b/personality-insights/README.md index b64dc9df0bb..27476750689 100755 --- a/personality-insights/README.md +++ b/personality-insights/README.md @@ -7,13 +7,13 @@ com.ibm.watson personality-insights - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:personality-insights:7.4.0' +'com.ibm.watson:personality-insights:8.0.0-rc1' ``` ## Usage diff --git a/speech-to-text/README.md b/speech-to-text/README.md index 80c84ab4962..50ece55e5c5 100755 --- a/speech-to-text/README.md +++ b/speech-to-text/README.md @@ -7,13 +7,13 @@ com.ibm.watson speech-to-text - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:speech-to-text:7.4.0' +'com.ibm.watson:speech-to-text:8.0.0-rc1' ``` ## Usage diff --git a/text-to-speech/README.md b/text-to-speech/README.md index a7cdc6ad29b..0b57f4fe20c 100755 --- a/text-to-speech/README.md +++ b/text-to-speech/README.md @@ -7,13 +7,13 @@ com.ibm.watson text-to-speech - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:text-to-speech:7.4.0' +'com.ibm.watson:text-to-speech:8.0.0-rc1' ``` ## Usage diff --git a/tone-analyzer/README.md b/tone-analyzer/README.md index 6553ded04e1..e503baa5297 100755 --- a/tone-analyzer/README.md +++ b/tone-analyzer/README.md @@ -7,13 +7,13 @@ com.ibm.watson tone-analyzer - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:tone-analyzer:7.4.0' +'com.ibm.watson:tone-analyzer:8.0.0-rc1' ``` ## Usage diff --git a/visual-recognition/README.md b/visual-recognition/README.md index 0f6bec82552..d2533492afe 100644 --- a/visual-recognition/README.md +++ b/visual-recognition/README.md @@ -7,13 +7,13 @@ com.ibm.watson visual-recognition - 7.4.0 + 8.0.0-rc1 ``` ##### Gradle ```gradle -'com.ibm.watson:visual-recognition:7.4.0' +'com.ibm.watson:visual-recognition:8.0.0-rc1' ``` ## Usage From 8d9c314c21e8d37b341ac8d54b00147b3221e5fe Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Wed, 28 Aug 2019 16:33:36 -0400 Subject: [PATCH 26/28] ci: Disable semantic-release for release candidate --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6ee093d9eb6..9a959b3434a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,12 +51,12 @@ script: after_success: - bash <(curl -s https://codecov.io/bash) deploy: -- provider: script - skip_cleanup: true - script: "semantic-release" - on: - branch: master - jdk: openjdk7 +#- provider: script + #skip_cleanup: true + #script: "semantic-release" + #on: + #branch: master + #jdk: openjdk7 - provider: script script: ".utility/push-javadoc-to-gh-pages.sh" skip_cleanup: true From 7efb5b80c5422c5240472999566ad5d13e63d9bf Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Thu, 29 Aug 2019 09:26:49 -0400 Subject: [PATCH 27/28] refactor: Use better naming for reserved word vars --- .../ibm/watson/discovery/v1/Discovery.java | 16 ++++----- .../model/FederatedQueryNoticesOptions.java | 34 +++++++++---------- .../v1/model/FederatedQueryOptions.java | 24 ++++++------- .../ibm/watson/discovery/v1/model/Field.java | 12 +++---- .../v1/model/QueryNoticesOptions.java | 34 +++++++++---------- .../discovery/v1/model/QueryOptions.java | 24 ++++++------- .../discovery/v1/DiscoveryServiceTest.java | 2 +- .../v3/LanguageTranslator.java | 4 +-- .../v3/model/ListModelsOptions.java | 24 ++++++------- .../v3/LanguageTranslatorIT.java | 2 +- .../v1/model/AudioMetricsDetails.java | 10 +++--- .../v1/model/SpeakerLabelsResult.java | 10 +++--- .../v1/model/SpeechRecognitionResult.java | 10 +++--- .../speech_to_text/v1/SpeechToTextIT.java | 2 +- .../speech_to_text/v1/SpeechToTextTest.java | 4 +-- .../visual_recognition/v3/model/Class.java | 10 +++--- .../v3/model/ClassResult.java | 10 +++--- 17 files changed, 116 insertions(+), 116 deletions(-) diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java index f80dba529b2..c88955c5c78 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java @@ -1261,8 +1261,8 @@ public ServiceCall query(QueryOptions queryOptions) { if (queryOptions.count() != null) { contentJson.addProperty("count", queryOptions.count()); } - if (queryOptions.xreturn() != null) { - contentJson.addProperty("return", queryOptions.xreturn()); + if (queryOptions.xReturn() != null) { + contentJson.addProperty("return", queryOptions.xReturn()); } if (queryOptions.offset() != null) { contentJson.addProperty("offset", queryOptions.offset()); @@ -1352,8 +1352,8 @@ public ServiceCall queryNotices(QueryNoticesOptions queryN if (queryNoticesOptions.count() != null) { builder.query("count", String.valueOf(queryNoticesOptions.count())); } - if (queryNoticesOptions.xreturn() != null) { - builder.query("return", RequestUtils.join(queryNoticesOptions.xreturn(), ",")); + if (queryNoticesOptions.xReturn() != null) { + builder.query("return", RequestUtils.join(queryNoticesOptions.xReturn(), ",")); } if (queryNoticesOptions.offset() != null) { builder.query("offset", String.valueOf(queryNoticesOptions.offset())); @@ -1436,8 +1436,8 @@ public ServiceCall federatedQuery(FederatedQueryOptions federated if (federatedQueryOptions.count() != null) { contentJson.addProperty("count", federatedQueryOptions.count()); } - if (federatedQueryOptions.xreturn() != null) { - contentJson.addProperty("return", federatedQueryOptions.xreturn()); + if (federatedQueryOptions.xReturn() != null) { + contentJson.addProperty("return", federatedQueryOptions.xReturn()); } if (federatedQueryOptions.offset() != null) { contentJson.addProperty("offset", federatedQueryOptions.offset()); @@ -1526,8 +1526,8 @@ public ServiceCall federatedQueryNotices( if (federatedQueryNoticesOptions.count() != null) { builder.query("count", String.valueOf(federatedQueryNoticesOptions.count())); } - if (federatedQueryNoticesOptions.xreturn() != null) { - builder.query("return", RequestUtils.join(federatedQueryNoticesOptions.xreturn(), ",")); + if (federatedQueryNoticesOptions.xReturn() != null) { + builder.query("return", RequestUtils.join(federatedQueryNoticesOptions.xReturn(), ",")); } if (federatedQueryNoticesOptions.offset() != null) { builder.query("offset", String.valueOf(federatedQueryNoticesOptions.offset())); diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java index 4054af0e91a..7fa933f16ef 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java @@ -29,7 +29,7 @@ public class FederatedQueryNoticesOptions extends GenericModel { private String naturalLanguageQuery; private String aggregation; private Long count; - private List xreturn; + private List xReturn; private Long offset; private List sort; private Boolean highlight; @@ -49,7 +49,7 @@ public static class Builder { private String naturalLanguageQuery; private String aggregation; private Long count; - private List xreturn; + private List xReturn; private Long offset; private List sort; private Boolean highlight; @@ -66,7 +66,7 @@ private Builder(FederatedQueryNoticesOptions federatedQueryNoticesOptions) { this.naturalLanguageQuery = federatedQueryNoticesOptions.naturalLanguageQuery; this.aggregation = federatedQueryNoticesOptions.aggregation; this.count = federatedQueryNoticesOptions.count; - this.xreturn = federatedQueryNoticesOptions.xreturn; + this.xReturn = federatedQueryNoticesOptions.xReturn; this.offset = federatedQueryNoticesOptions.offset; this.sort = federatedQueryNoticesOptions.sort; this.highlight = federatedQueryNoticesOptions.highlight; @@ -119,7 +119,7 @@ public Builder addCollectionIds(String collectionIds) { } /** - * Adds an returnField to xreturn. + * Adds an returnField to xReturn. * * @param returnField the new returnField * @return the FederatedQueryNoticesOptions builder @@ -127,10 +127,10 @@ public Builder addCollectionIds(String collectionIds) { public Builder addReturnField(String returnField) { com.ibm.cloud.sdk.core.util.Validator.notNull(returnField, "returnField cannot be null"); - if (this.xreturn == null) { - this.xreturn = new ArrayList(); + if (this.xReturn == null) { + this.xReturn = new ArrayList(); } - this.xreturn.add(returnField); + this.xReturn.add(returnField); return this; } @@ -261,14 +261,14 @@ public Builder count(long count) { } /** - * Set the xreturn. - * Existing xreturn will be replaced. + * Set the xReturn. + * Existing xReturn will be replaced. * - * @param xreturn the xreturn + * @param xReturn the xReturn * @return the FederatedQueryNoticesOptions builder */ - public Builder xreturn(List xreturn) { - this.xreturn = xreturn; + public Builder xReturn(List xReturn) { + this.xReturn = xReturn; return this; } @@ -365,7 +365,7 @@ private FederatedQueryNoticesOptions(Builder builder) { naturalLanguageQuery = builder.naturalLanguageQuery; aggregation = builder.aggregation; count = builder.count; - xreturn = builder.xreturn; + xReturn = builder.xReturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -467,14 +467,14 @@ public Long count() { } /** - * Gets the xreturn. + * Gets the xReturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the xreturn + * @return the xReturn */ - public List xreturn() { - return xreturn; + public List xReturn() { + return xReturn; } /** diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java index b93ccf474a9..fe853475933 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java @@ -26,7 +26,7 @@ public class FederatedQueryOptions extends GenericModel { private Boolean passages; private String aggregation; private Long count; - private String xreturn; + private String xReturn; private Long offset; private String sort; private Boolean highlight; @@ -53,7 +53,7 @@ public static class Builder { private Boolean passages; private String aggregation; private Long count; - private String xreturn; + private String xReturn; private Long offset; private String sort; private Boolean highlight; @@ -77,7 +77,7 @@ private Builder(FederatedQueryOptions federatedQueryOptions) { this.passages = federatedQueryOptions.passages; this.aggregation = federatedQueryOptions.aggregation; this.count = federatedQueryOptions.count; - this.xreturn = federatedQueryOptions.xreturn; + this.xReturn = federatedQueryOptions.xReturn; this.offset = federatedQueryOptions.offset; this.sort = federatedQueryOptions.sort; this.highlight = federatedQueryOptions.highlight; @@ -196,13 +196,13 @@ public Builder count(long count) { } /** - * Set the xreturn. + * Set the xReturn. * - * @param xreturn the xreturn + * @param xReturn the xReturn * @return the FederatedQueryOptions builder */ - public Builder xreturn(String xreturn) { - this.xreturn = xreturn; + public Builder xReturn(String xReturn) { + this.xReturn = xReturn; return this; } @@ -371,7 +371,7 @@ private FederatedQueryOptions(Builder builder) { passages = builder.passages; aggregation = builder.aggregation; count = builder.count; - xreturn = builder.xreturn; + xReturn = builder.xReturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -479,14 +479,14 @@ public Long count() { } /** - * Gets the xreturn. + * Gets the xReturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the xreturn + * @return the xReturn */ - public String xreturn() { - return xreturn; + public String xReturn() { + return xReturn; } /** diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java index 1a4bf91c510..8c3529f849f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java @@ -30,19 +30,19 @@ public interface Type { /** date. */ String DATE = "date"; /** long. */ - String XLONG = "long"; + String X_LONG = "long"; /** integer. */ String INTEGER = "integer"; /** short. */ - String XSHORT = "short"; + String X_SHORT = "short"; /** byte. */ - String XBYTE = "byte"; + String X_BYTE = "byte"; /** double. */ - String XDOUBLE = "double"; + String X_DOUBLE = "double"; /** float. */ - String XFLOAT = "float"; + String X_FLOAT = "float"; /** boolean. */ - String XBOOLEAN = "boolean"; + String X_BOOLEAN = "boolean"; /** binary. */ String BINARY = "binary"; } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java index 3a1f2031338..75cc835ba14 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java @@ -30,7 +30,7 @@ public class QueryNoticesOptions extends GenericModel { private Boolean passages; private String aggregation; private Long count; - private List xreturn; + private List xReturn; private Long offset; private List sort; private Boolean highlight; @@ -54,7 +54,7 @@ public static class Builder { private Boolean passages; private String aggregation; private Long count; - private List xreturn; + private List xReturn; private Long offset; private List sort; private Boolean highlight; @@ -75,7 +75,7 @@ private Builder(QueryNoticesOptions queryNoticesOptions) { this.passages = queryNoticesOptions.passages; this.aggregation = queryNoticesOptions.aggregation; this.count = queryNoticesOptions.count; - this.xreturn = queryNoticesOptions.xreturn; + this.xReturn = queryNoticesOptions.xReturn; this.offset = queryNoticesOptions.offset; this.sort = queryNoticesOptions.sort; this.highlight = queryNoticesOptions.highlight; @@ -115,7 +115,7 @@ public QueryNoticesOptions build() { } /** - * Adds an returnField to xreturn. + * Adds an returnField to xReturn. * * @param returnField the new returnField * @return the QueryNoticesOptions builder @@ -123,10 +123,10 @@ public QueryNoticesOptions build() { public Builder addReturnField(String returnField) { com.ibm.cloud.sdk.core.util.Validator.notNull(returnField, "returnField cannot be null"); - if (this.xreturn == null) { - this.xreturn = new ArrayList(); + if (this.xReturn == null) { + this.xReturn = new ArrayList(); } - this.xreturn.add(returnField); + this.xReturn.add(returnField); return this; } @@ -283,14 +283,14 @@ public Builder count(long count) { } /** - * Set the xreturn. - * Existing xreturn will be replaced. + * Set the xReturn. + * Existing xReturn will be replaced. * - * @param xreturn the xreturn + * @param xReturn the xReturn * @return the QueryNoticesOptions builder */ - public Builder xreturn(List xreturn) { - this.xreturn = xreturn; + public Builder xReturn(List xReturn) { + this.xReturn = xReturn; return this; } @@ -422,7 +422,7 @@ private QueryNoticesOptions(Builder builder) { passages = builder.passages; aggregation = builder.aggregation; count = builder.count; - xreturn = builder.xreturn; + xReturn = builder.xReturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -538,14 +538,14 @@ public Long count() { } /** - * Gets the xreturn. + * Gets the xReturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the xreturn + * @return the xReturn */ - public List xreturn() { - return xreturn; + public List xReturn() { + return xReturn; } /** diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java index 795b68a9517..df699217e58 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java @@ -27,7 +27,7 @@ public class QueryOptions extends GenericModel { private Boolean passages; private String aggregation; private Long count; - private String xreturn; + private String xReturn; private Long offset; private String sort; private Boolean highlight; @@ -55,7 +55,7 @@ public static class Builder { private Boolean passages; private String aggregation; private Long count; - private String xreturn; + private String xReturn; private Long offset; private String sort; private Boolean highlight; @@ -80,7 +80,7 @@ private Builder(QueryOptions queryOptions) { this.passages = queryOptions.passages; this.aggregation = queryOptions.aggregation; this.count = queryOptions.count; - this.xreturn = queryOptions.xreturn; + this.xReturn = queryOptions.xReturn; this.offset = queryOptions.offset; this.sort = queryOptions.sort; this.highlight = queryOptions.highlight; @@ -212,13 +212,13 @@ public Builder count(long count) { } /** - * Set the xreturn. + * Set the xReturn. * - * @param xreturn the xreturn + * @param xReturn the xReturn * @return the QueryOptions builder */ - public Builder xreturn(String xreturn) { - this.xreturn = xreturn; + public Builder xReturn(String xReturn) { + this.xReturn = xReturn; return this; } @@ -390,7 +390,7 @@ private QueryOptions(Builder builder) { passages = builder.passages; aggregation = builder.aggregation; count = builder.count; - xreturn = builder.xreturn; + xReturn = builder.xReturn; offset = builder.offset; sort = builder.sort; highlight = builder.highlight; @@ -509,14 +509,14 @@ public Long count() { } /** - * Gets the xreturn. + * Gets the xReturn. * * A comma-separated list of the portion of the document hierarchy to return. * - * @return the xreturn + * @return the xReturn */ - public String xreturn() { - return xreturn; + public String xReturn() { + return xReturn; } /** diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java index cdde75ba42e..31a1c229426 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java @@ -894,7 +894,7 @@ public void queryIsSuccessful() throws InterruptedException { queryBuilder.count(5L); queryBuilder.offset(5L); String fieldNames = "field"; - queryBuilder.xreturn(fieldNames); + queryBuilder.xReturn(fieldNames); queryBuilder.query("field" + Operator.CONTAINS + 1); queryBuilder.filter("field" + Operator.CONTAINS + 1); queryBuilder.similar(true); diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java index 31f25f4ca80..61835c27bae 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java @@ -206,8 +206,8 @@ public ServiceCall listModels(ListModelsOptions listModelsOpt if (listModelsOptions.target() != null) { builder.query("target", listModelsOptions.target()); } - if (listModelsOptions.xdefault() != null) { - builder.query("default", String.valueOf(listModelsOptions.xdefault())); + if (listModelsOptions.xDefault() != null) { + builder.query("default", String.valueOf(listModelsOptions.xDefault())); } } ResponseConverter responseConverter = ResponseConverterUtils.getValue( diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java index 48e10db3aa5..3444b4af075 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java @@ -21,7 +21,7 @@ public class ListModelsOptions extends GenericModel { private String source; private String target; - private Boolean xdefault; + private Boolean xDefault; /** * Builder. @@ -29,12 +29,12 @@ public class ListModelsOptions extends GenericModel { public static class Builder { private String source; private String target; - private Boolean xdefault; + private Boolean xDefault; private Builder(ListModelsOptions listModelsOptions) { this.source = listModelsOptions.source; this.target = listModelsOptions.target; - this.xdefault = listModelsOptions.xdefault; + this.xDefault = listModelsOptions.xDefault; } /** @@ -75,13 +75,13 @@ public Builder target(String target) { } /** - * Set the xdefault. + * Set the xDefault. * - * @param xdefault the xdefault + * @param xDefault the xDefault * @return the ListModelsOptions builder */ - public Builder xdefault(Boolean xdefault) { - this.xdefault = xdefault; + public Builder xDefault(Boolean xDefault) { + this.xDefault = xDefault; return this; } } @@ -89,7 +89,7 @@ public Builder xdefault(Boolean xdefault) { private ListModelsOptions(Builder builder) { source = builder.source; target = builder.target; - xdefault = builder.xdefault; + xDefault = builder.xDefault; } /** @@ -124,15 +124,15 @@ public String target() { } /** - * Gets the xdefault. + * Gets the xDefault. * * If the default parameter isn't specified, the service will return all models (default and non-default) for each * language pair. To return only default models, set this to `true`. To return only non-default models, set this to * `false`. There is exactly one default model per language pair, the IBM provided base model. * - * @return the xdefault + * @return the xDefault */ - public Boolean xdefault() { - return xdefault; + public Boolean xDefault() { + return xDefault; } } diff --git a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java index 9c42ee3fb3e..ce9d8178620 100644 --- a/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java +++ b/language-translator/src/test/java/com/ibm/watson/language_translator/v3/LanguageTranslatorIT.java @@ -143,7 +143,7 @@ public void testListModelsWithOptions() { ListModelsOptions options = new ListModelsOptions.Builder() .source("en") .target("es") - .xdefault(true) + .xDefault(true) .build(); List models = service.listModels(options).execute().getResult().getModels(); diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java index c095e0de812..b70a2d8589b 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/AudioMetricsDetails.java @@ -23,7 +23,7 @@ public class AudioMetricsDetails extends GenericModel { @SerializedName("final") - private Boolean xfinal; + private Boolean xFinal; @SerializedName("end_time") private Float endTime; @SerializedName("signal_to_noise_ratio") @@ -42,16 +42,16 @@ public class AudioMetricsDetails extends GenericModel { private List nonSpeechLevel; /** - * Gets the xfinal. + * Gets the xFinal. * * If `true`, indicates the end of the audio stream, meaning that transcription is complete. Currently, the field is * always `true`. The service returns metrics just once per audio stream. The results provide aggregated audio metrics * that pertain to the complete audio stream. * - * @return the xfinal + * @return the xFinal */ - public Boolean isXfinal() { - return xfinal; + public Boolean isXFinal() { + return xFinal; } /** diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java index 0cb5ae2d903..cb0fd926179 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeakerLabelsResult.java @@ -25,7 +25,7 @@ public class SpeakerLabelsResult extends GenericModel { private Long speaker; private Float confidence; @SerializedName("final") - private Boolean xfinal; + private Boolean xFinal; /** * Gets the from. @@ -75,15 +75,15 @@ public Float getConfidence() { } /** - * Gets the xfinal. + * Gets the xFinal. * * An indication of whether the service might further change word and speaker-label results. A value of `true` means * that the service guarantees not to send any further updates for the current or any preceding results; `false` means * that the service might send further updates to the results. * - * @return the xfinal + * @return the xFinal */ - public Boolean isXfinal() { - return xfinal; + public Boolean isXFinal() { + return xFinal; } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java index 74a98d9bbae..e3233fcfcdb 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionResult.java @@ -24,7 +24,7 @@ public class SpeechRecognitionResult extends GenericModel { @SerializedName("final") - private Boolean xfinal; + private Boolean xFinal; private List alternatives; @SerializedName("keywords_result") private Map> keywordsResult; @@ -32,15 +32,15 @@ public class SpeechRecognitionResult extends GenericModel { private List wordAlternatives; /** - * Gets the xfinal. + * Gets the xFinal. * * An indication of whether the transcription results are final. If `true`, the results for this utterance are not * updated further; no additional results are sent for a `result_index` once its results are indicated as final. * - * @return the xfinal + * @return the xFinal */ - public Boolean isXfinal() { - return xfinal; + public Boolean isXFinal() { + return xFinal; } /** diff --git a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java index ef7d84be320..83f3ac223b8 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java +++ b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextIT.java @@ -321,7 +321,7 @@ public void onError(Exception e) { @Override public void onTranscription(SpeechRecognitionResults speechResults) { if (speechResults != null) { - if (speechResults.getResults() != null && speechResults.getResults().get(0).isXfinal()) { + if (speechResults.getResults() != null && speechResults.getResults().get(0).isXFinal()) { asyncTranscriptionResults = speechResults; } if (speechResults.getAudioMetrics() != null) { diff --git a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java index 2ceacbbfe86..d92780d3c36 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java +++ b/speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1/SpeechToTextTest.java @@ -344,8 +344,8 @@ public void testRecognize() throws URISyntaxException, InterruptedException, Fil assertEquals(HttpMediaType.AUDIO_WAV, request.getHeader(CONTENT_TYPE)); assertEquals(recognitionResults.getAudioMetrics().getSamplingInterval(), result.getAudioMetrics().getSamplingInterval()); - assertEquals(recognitionResults.getAudioMetrics().getAccumulated().isXfinal(), - result.getAudioMetrics().getAccumulated().isXfinal()); + assertEquals(recognitionResults.getAudioMetrics().getAccumulated().isXFinal(), + result.getAudioMetrics().getAccumulated().isXFinal()); assertEquals(recognitionResults.getAudioMetrics().getAccumulated().getEndTime(), result.getAudioMetrics().getAccumulated().getEndTime()); assertEquals(recognitionResults.getAudioMetrics().getAccumulated().getSpeechRatio(), diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java index 187ef6d543e..596cdbe17b0 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/Class.java @@ -21,16 +21,16 @@ public class Class extends GenericModel { @SerializedName("class") - private String xclass; + private String xClass; /** - * Gets the xclass. + * Gets the xClass. * * The name of the class. * - * @return the xclass + * @return the xClass */ - public String getXclass() { - return xclass; + public String getXClass() { + return xClass; } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java index 0491609f071..36ce24e9419 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/model/ClassResult.java @@ -21,13 +21,13 @@ public class ClassResult extends GenericModel { @SerializedName("class") - private String xclass; + private String xClass; private Float score; @SerializedName("type_hierarchy") private String typeHierarchy; /** - * Gets the xclass. + * Gets the xClass. * * Name of the class. * @@ -36,10 +36,10 @@ public class ClassResult extends GenericModel { * response might not be in the specified language when the requested language is not supported or when there is no * translation for the class name. * - * @return the xclass + * @return the xClass */ - public String getXclass() { - return xclass; + public String getXClass() { + return xClass; } /** From b667b16398101c2287e7d602415c7029992b55f1 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Thu, 29 Aug 2019 09:27:02 -0400 Subject: [PATCH 28/28] docs(README): Add snippet about ICP auth --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 62640b2e108..3941f3b2399 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Java client library to use the [Watson APIs][wdc]. * [Authentication](#authentication) * [IAM](#iam) * [Username and password](#username-and-password) + * [ICP](#icp) * [Cloud Pak for Data](#cloud-pak-for-data) * [Using the SDK](#using-the-sdk) * [Parsing responses](#parsing-responses) @@ -197,6 +198,20 @@ Authenticator authenticator = new BasicAuthenticator("", "") Discovery service = new Discovery("2017-11-07", authenticator); ``` +#### ICP +Authenticating with ICP is similar to the basic username and password method, except that you need to make sure to disable SSL verification to authenticate properly. See [here](#configuring-the-http-client) for more information. + +```java +Authenticator authenticator = new BasicAuthenticator("", ""); +Discovery service = new Discovery("2017-11-07", authenticator); + +HttpConfigOptions options = new HttpConfigOptions.Builder() + .disableSslVerification(true) + .build(); + +service.configureClient(options); +``` + #### Cloud Pak for Data Like IAM, you can pass in credentials to let the SDK manage an access token for you or directly supply an access token to do it yourself.